diff --git a/Changelog.todo.md b/Changelog.todo.md index 911c35b2..4394fed3 100644 --- a/Changelog.todo.md +++ b/Changelog.todo.md @@ -1,4 +1,4 @@ -# Changelog (dummy, to be filled, later used in release time) +# Changelog - Remote PC @@ -8,7 +8,7 @@ - Added option to select a file directly on the remote PC tool (basically same system as on <=0.5 Goldleaf versions, for those who like the classic system!) - - Goldtree's messages were slightly changed to be more accurate. + - Goldtree's messages were slightly changed to be more accurate. Now it shows its version to avoid confusion between different executables. - NSP installs @@ -38,9 +38,7 @@ - Copying files from PC to SD which are over 4GB is now correctly handled, creating a concatenation file (see above) to correctly handle it. - - Goldleaf takes advantage now from hbloader v2.2.0's heap reservation, which reserved 128MB of heap for other applets. Goldleaf probably won't work without this trick, so its support is uncertain with old Atmosphere or other CFWs (unless it's launched overriding an application or from the forwarder) - - - The forwarder was updated with hbloader's latest version. + - The forwarder was updated with hbloader's latest version, thus now the forwarder's version is 0.2. - User / accounts @@ -72,4 +70,8 @@ - Goldleaf now has been compiled with an experimental Plutonium branch which uses smart pointers instead of raw pointers aiming no memory leaks! - - Now, Goldleaf also supports dutch language! Thanks a lot to **Mega** for helping with the translation! \ No newline at end of file + - Now, Goldleaf also supports dutch language! Thanks a lot to **Mega** for helping with the translation! + +## Known bugs + +- Browsing (fast?) over certain (empty?) folders can sometimes have weird behavior, resulting into crashes. \ No newline at end of file diff --git a/Goldleaf/Include/fs/fs_Common.hpp b/Goldleaf/Include/fs/fs_Common.hpp index 5aa68e1c..5ddbe93e 100644 --- a/Goldleaf/Include/fs/fs_Common.hpp +++ b/Goldleaf/Include/fs/fs_Common.hpp @@ -49,9 +49,9 @@ namespace fs void CreateConcatenationFile(pu::String Path); void CreateDirectory(pu::String Path); void CopyFile(pu::String Path, pu::String NewPath); - void CopyFileProgress(pu::String Path, pu::String NewPath, std::function Callback); + void CopyFileProgress(pu::String Path, pu::String NewPath, std::function Callback); void CopyDirectory(pu::String Dir, pu::String NewDir); - void CopyDirectoryProgress(pu::String Dir, pu::String NewDir, std::function Callback); + void CopyDirectoryProgress(pu::String Dir, pu::String NewDir, std::function Callback); void DeleteFile(pu::String Path); void DeleteDirectory(pu::String Path); bool IsFileBinary(pu::String Path); diff --git a/Goldleaf/Include/fs/fs_Explorer.hpp b/Goldleaf/Include/fs/fs_Explorer.hpp index f20d4628..19da590c 100644 --- a/Goldleaf/Include/fs/fs_Explorer.hpp +++ b/Goldleaf/Include/fs/fs_Explorer.hpp @@ -31,9 +31,9 @@ namespace fs pu::String MakeFull(pu::String Path); bool IsFullPath(pu::String Path); void CopyFile(pu::String Path, pu::String NewPath); - void CopyFileProgress(pu::String Path, pu::String NewPath, std::function Callback); + void CopyFileProgress(pu::String Path, pu::String NewPath, std::function Callback); void CopyDirectory(pu::String Dir, pu::String NewDir); - void CopyDirectoryProgress(pu::String Dir, pu::String NewDir, std::function Callback); + void CopyDirectoryProgress(pu::String Dir, pu::String NewDir, std::function Callback); bool IsFileBinary(pu::String Path); std::vector ReadFile(pu::String Path); std::vector ReadFileLines(pu::String Path, u32 LineOffset, u32 LineCount); diff --git a/Goldleaf/Source/Main.cpp b/Goldleaf/Source/Main.cpp index 98f35373..842a9a5a 100644 --- a/Goldleaf/Source/Main.cpp +++ b/Goldleaf/Source/Main.cpp @@ -3,8 +3,14 @@ #include #include +extern char *fake_heap_end; +void *new_heap_addr = NULL; + +static constexpr u64 HeapSize = 0x10000000; + void Initialize() { + if((GetLaunchMode() == LaunchMode::Applet) && R_SUCCEEDED(svcSetHeapSize(&new_heap_addr, HeapSize))) fake_heap_end = (char*)new_heap_addr + HeapSize; // TODO: Better way to handle this than exiting? User won't know what happened if(R_FAILED(ncm::Initialize())) exit(1); @@ -55,6 +61,7 @@ void Finalize() ncmExit(); nifmExit(); pdmqryExit(); + if(GetLaunchMode() == LaunchMode::Applet) svcSetHeapSize(&new_heap_addr, ((u8*)envGetHeapOverrideAddr() + envGetHeapOverrideSize()) - (u8*)new_heap_addr); } namespace ui diff --git a/Goldleaf/Source/fs/fs_Common.cpp b/Goldleaf/Source/fs/fs_Common.cpp index ba11af57..ff53502d 100644 --- a/Goldleaf/Source/fs/fs_Common.cpp +++ b/Goldleaf/Source/fs/fs_Common.cpp @@ -67,7 +67,7 @@ namespace fs gexp->CopyFile(Path, NewPath); } - void CopyFileProgress(pu::String Path, pu::String NewPath, std::function Callback) + void CopyFileProgress(pu::String Path, pu::String NewPath, std::function Callback) { Explorer *gexp = GetExplorerForPath(Path); Explorer *ogexp = GetExplorerForPath(NewPath); @@ -82,7 +82,7 @@ namespace fs gexp->CopyDirectory(Dir, NewDir); } - void CopyDirectoryProgress(pu::String Dir, pu::String NewDir, std::function Callback) + void CopyDirectoryProgress(pu::String Dir, pu::String NewDir, std::function Callback) { Explorer *gexp = GetExplorerForPath(Dir); gexp->CopyDirectoryProgress(Dir, NewDir, Callback); diff --git a/Goldleaf/Source/fs/fs_Explorer.cpp b/Goldleaf/Source/fs/fs_Explorer.cpp index 03c1a2c7..2695b675 100644 --- a/Goldleaf/Source/fs/fs_Explorer.cpp +++ b/Goldleaf/Source/fs/fs_Explorer.cpp @@ -129,7 +129,7 @@ namespace fs } } - void Explorer::CopyFileProgress(pu::String Path, pu::String NewPath, std::function Callback) + void Explorer::CopyFileProgress(pu::String Path, pu::String NewPath, std::function Callback) { pu::String path = this->MakeFull(Path); auto ex = GetExplorerForMountName(GetPathRoot(NewPath)); @@ -144,8 +144,7 @@ namespace fs szrem -= rbytes; off += rbytes; ex->WriteFileBlock(NewPath, data, rbytes); - u8 perc = (u8)((double)((double)off / (double)fsize) * 100.0); - Callback(perc); + Callback((double)off, (double)fsize); } } @@ -170,7 +169,7 @@ namespace fs } } - void Explorer::CopyDirectoryProgress(pu::String Dir, pu::String NewDir, std::function Callback) + void Explorer::CopyDirectoryProgress(pu::String Dir, pu::String NewDir, std::function Callback) { pu::String dir = this->MakeFull(Dir); pu::String ndir = this->MakeFull(NewDir); diff --git a/Goldleaf/Source/ui/ui_AccountLayout.cpp b/Goldleaf/Source/ui/ui_AccountLayout.cpp index a03e30b7..c313cc8a 100644 --- a/Goldleaf/Source/ui/ui_AccountLayout.cpp +++ b/Goldleaf/Source/ui/ui_AccountLayout.cpp @@ -133,12 +133,14 @@ namespace ui auto linkedinfo = acc::GetUserLinkedInfo(); pu::String str = set::GetDictionaryEntry(328) + " " + hos::FormatHex(linkedinfo.AccountId); str += "\n" + set::GetDictionaryEntry(329) + " " + hos::FormatHex(linkedinfo.NintendoAccountId); - auto sopt = mainapp->CreateShowDialog(set::GetDictionaryEntry(330), str, { set::GetDictionaryEntry(331), set::GetDictionaryEntry(234) }, true); + auto sopt = mainapp->CreateShowDialog(set::GetDictionaryEntry(330), str, { set::GetDictionaryEntry(331), set::GetDictionaryEntry(18) }, true); if(sopt != 0) return; sopt = mainapp->CreateShowDialog(set::GetDictionaryEntry(332), set::GetDictionaryEntry(333), { set::GetDictionaryEntry(111), set::GetDictionaryEntry(18) }, true); - if(sopt < 0) return; - auto res = acc::UnlinkLocally(); - if(res == 0) mainapp->ShowNotification(set::GetDictionaryEntry(334)); - else HandleResult(res, set::GetDictionaryEntry(335)); + if(sopt == 0) + { + auto res = acc::UnlinkLocally(); + if(res == 0) mainapp->ShowNotification(set::GetDictionaryEntry(334)); + else HandleResult(res, set::GetDictionaryEntry(335)); + } } } \ No newline at end of file diff --git a/Goldleaf/Source/ui/ui_CopyLayout.cpp b/Goldleaf/Source/ui/ui_CopyLayout.cpp index 4977952e..ab839cc5 100644 --- a/Goldleaf/Source/ui/ui_CopyLayout.cpp +++ b/Goldleaf/Source/ui/ui_CopyLayout.cpp @@ -22,9 +22,10 @@ namespace ui { if(Directory) { - fs::CopyDirectoryProgress(Path, NewPath, [&](u8 p) + fs::CopyDirectoryProgress(Path, NewPath, [&](double done, double total) { - this->copyBar->SetProgress(p); + this->copyBar->SetMaxValue(total); + this->copyBar->SetProgress(done); mainapp->CallForRender(); }); mainapp->ShowNotification(set::GetDictionaryEntry(141)); @@ -36,9 +37,11 @@ namespace ui int sopt = mainapp->CreateShowDialog(set::GetDictionaryEntry(153), set::GetDictionaryEntry(143), { set::GetDictionaryEntry(239), set::GetDictionaryEntry(18) }, true); if(sopt < 0) return; } - fs::CopyFileProgress(Path, NewPath, [&](u8 p) + fs::DeleteFile(NewPath); + fs::CopyFileProgress(Path, NewPath, [&](double done, double total) { - this->copyBar->SetProgress(p); + this->copyBar->SetMaxValue(total); + this->copyBar->SetProgress(done); mainapp->CallForRender(); }); mainapp->ShowNotification(set::GetDictionaryEntry(240)); diff --git a/Goldleaf/Source/ui/ui_MainApplication.cpp b/Goldleaf/Source/ui/ui_MainApplication.cpp index 1db3b973..2b227c7c 100644 --- a/Goldleaf/Source/ui/ui_MainApplication.cpp +++ b/Goldleaf/Source/ui/ui_MainApplication.cpp @@ -671,8 +671,9 @@ namespace ui void MainApplication::OnInput(u64 Down, u64 Up, u64 Held) { - if((Down & KEY_MINUS) && (GetLaunchMode() == LaunchMode::Applet)) + if((Down & KEY_MINUS) && (GetCurrentApplicationId() != GOLDLEAF_APPID)) { + // Don't allow closing if Goldleaf forwarder! this->CloseWithFadeOut(); } else if((Down & KEY_ZL) || (Down & KEY_ZR)) ShowPowerTasksDialog(set::GetDictionaryEntry(229), set::GetDictionaryEntry(230)); diff --git a/Goldleaf/Source/ui/ui_MainMenuLayout.cpp b/Goldleaf/Source/ui/ui_MainMenuLayout.cpp index 1a26d30f..536a84f1 100644 --- a/Goldleaf/Source/ui/ui_MainMenuLayout.cpp +++ b/Goldleaf/Source/ui/ui_MainMenuLayout.cpp @@ -100,7 +100,11 @@ namespace ui int sopt = mainapp->CreateShowDialog(set::GetDictionaryEntry(348), set::GetDictionaryEntry(349), {set::GetDictionaryEntry(111), set::GetDictionaryEntry(18)}, true); if(sopt != 0) return; if(acc::SelectUser()) mainapp->ShowNotification(set::GetDictionaryEntry(324)); - else mainapp->ShowNotification(set::GetDictionaryEntry(350)); + else + { + mainapp->ShowNotification(set::GetDictionaryEntry(350)); + return; + } } mainapp->LoadMenuData(set::GetDictionaryEntry(41), "Accounts", set::GetDictionaryEntry(42)); mainapp->GetAccountLayout()->Load(); diff --git a/Goldleaf/Source/ui/ui_TitleDumperLayout.cpp b/Goldleaf/Source/ui/ui_TitleDumperLayout.cpp index eea2b3ca..9f73bd30 100644 --- a/Goldleaf/Source/ui/ui_TitleDumperLayout.cpp +++ b/Goldleaf/Source/ui/ui_TitleDumperLayout.cpp @@ -209,9 +209,10 @@ namespace ui pu::String txmeta = outdir + "/" + hos::ContentIdAsString(meta) + ".cnmt.nca"; fs::CreateConcatenationFile(txmeta); this->ncaBar->SetVisible(true); - fs::CopyFileProgress(xmeta, txmeta, [&](u8 p) + fs::CopyFileProgress(xmeta, txmeta, [&](double done, double total) { - this->ncaBar->SetProgress(p); + this->ncaBar->SetMaxValue(total); + this->ncaBar->SetProgress(done); mainapp->CallForRender(); }); this->ncaBar->SetVisible(false); @@ -222,9 +223,10 @@ namespace ui pu::String txprogram = outdir + "/" + hos::ContentIdAsString(program) + ".nca"; fs::CreateConcatenationFile(txprogram); this->ncaBar->SetVisible(true); - fs::CopyFileProgress(xprogram, txprogram, [&](u8 p) + fs::CopyFileProgress(xprogram, txprogram, [&](double done, double total) { - this->ncaBar->SetProgress(p); + this->ncaBar->SetMaxValue(total); + this->ncaBar->SetProgress(done); mainapp->CallForRender(); }); this->ncaBar->SetVisible(false); @@ -236,9 +238,10 @@ namespace ui pu::String txcontrol = outdir + "/" + hos::ContentIdAsString(control) + ".nca"; fs::CreateConcatenationFile(txcontrol); this->ncaBar->SetVisible(true); - fs::CopyFileProgress(xcontrol, txcontrol, [&](u8 p) + fs::CopyFileProgress(xcontrol, txcontrol, [&](double done, double total) { - this->ncaBar->SetProgress(p); + this->ncaBar->SetMaxValue(total); + this->ncaBar->SetProgress(done); mainapp->CallForRender(); }); this->ncaBar->SetVisible(false); @@ -250,9 +253,10 @@ namespace ui pu::String txlinfo = outdir + "/" + hos::ContentIdAsString(linfo) + ".nca"; fs::CreateConcatenationFile(txlinfo); this->ncaBar->SetVisible(true); - fs::CopyFileProgress(xlinfo, txlinfo, [&](u8 p) + fs::CopyFileProgress(xlinfo, txlinfo, [&](double done, double total) { - this->ncaBar->SetProgress(p); + this->ncaBar->SetMaxValue(total); + this->ncaBar->SetProgress(done); mainapp->CallForRender(); }); this->ncaBar->SetVisible(false); @@ -264,9 +268,10 @@ namespace ui pu::String txhoff = outdir + "/" + hos::ContentIdAsString(hoff) + ".nca"; fs::CreateConcatenationFile(txhoff); this->ncaBar->SetVisible(true); - fs::CopyFileProgress(xhoff, txhoff, [&](u8 p) + fs::CopyFileProgress(xhoff, txhoff, [&](double done, double total) { - this->ncaBar->SetProgress(p); + this->ncaBar->SetMaxValue(total); + this->ncaBar->SetProgress(done); mainapp->CallForRender(); }); this->ncaBar->SetVisible(false); @@ -278,9 +283,10 @@ namespace ui pu::String txdata = outdir + "/" + hos::ContentIdAsString(data) + ".nca"; fs::CreateConcatenationFile(txdata); this->ncaBar->SetVisible(true); - fs::CopyFileProgress(xdata, txdata, [&](u8 p) + fs::CopyFileProgress(xdata, txdata, [&](double done, double total) { - this->ncaBar->SetProgress(p); + this->ncaBar->SetMaxValue(total); + this->ncaBar->SetProgress(done); mainapp->CallForRender(); }); this->ncaBar->SetVisible(false); diff --git a/Goldtree/Goldtree/Goldtree.csproj b/Goldtree/Goldtree/Goldtree.csproj index 3a867fbf..e9e2f319 100644 --- a/Goldtree/Goldtree/Goldtree.csproj +++ b/Goldtree/Goldtree/Goldtree.csproj @@ -9,8 +9,8 @@ Goldleaf's USB client for PC XorTroll Copyright 2018 - 2019 Goldleaf project, by XorTroll - 0.6.1.0 - 0.6.1.0 + 0.7.0.0 + 0.7.0.0 en false 0.7 diff --git a/Goldtree/Goldtree/Program.cs b/Goldtree/Goldtree/Program.cs index 8433025f..aac349af 100644 --- a/Goldtree/Goldtree/Program.cs +++ b/Goldtree/Goldtree/Program.cs @@ -1,6 +1,6 @@ using System; -using System.IO; -using System.Text; +using System.Diagnostics; +using System.Reflection; using libusbK; namespace gtree @@ -65,7 +65,6 @@ public void LLogL(string Text) public class Program { - public static readonly string Name = "Goldtree"; public static readonly string Description = "Goldleaf's USB client for PC"; public static readonly LogMode Log = new LogMode("Log", ConsoleColor.Cyan); @@ -77,11 +76,13 @@ public class Program public static void Initialize() { - Console.Title = Name + " - " + Description; + var name = Assembly.GetExecutingAssembly().GetName().Name; + var ver = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion; + Console.Title = name + " v" + ver + " - " + Description; Console.WriteLine(); Console.Write(" "); Console.ForegroundColor = ConsoleColor.DarkYellow; - Console.Write(Name); + Console.Write(name + " v" + ver); Console.ForegroundColor = ConsoleColor.Gray; Console.Write(" - "); Console.ForegroundColor = ConsoleColor.White;