From b5bcd20908bf82263faf7c4edf8cde6be61fdb2b Mon Sep 17 00:00:00 2001 From: blawar Date: Fri, 25 Oct 2019 01:54:56 -0400 Subject: [PATCH] enforce high memory install mode, map nsz file types --- Goldleaf/Source/nsp/nsp_Installer.cpp | 2 ++ Goldleaf/Source/ui/ui_InstallLayout.cpp | 6 ++++++ Goldleaf/Source/ui/ui_PartitionBrowserLayout.cpp | 10 +++++----- README.md | 4 ++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Goldleaf/Source/nsp/nsp_Installer.cpp b/Goldleaf/Source/nsp/nsp_Installer.cpp index 686fb4e..d3f8131 100644 --- a/Goldleaf/Source/nsp/nsp_Installer.cpp +++ b/Goldleaf/Source/nsp/nsp_Installer.cpp @@ -32,6 +32,7 @@ extern set::Settings gsets; + namespace nsp { Installer::Installer(pu::String Path, fs::Explorer *Exp, Storage Location) : nspentry(Exp, Path), storage(static_cast(Location)) @@ -46,6 +47,7 @@ namespace nsp Result Installer::PrepareInstallation() { Result rc = err::Make(err::ErrorDescription::InvalidNSP); + if(nspentry.IsOk()) { rc = 0; diff --git a/Goldleaf/Source/ui/ui_InstallLayout.cpp b/Goldleaf/Source/ui/ui_InstallLayout.cpp index 7a4b5d1..07d8b2e 100644 --- a/Goldleaf/Source/ui/ui_InstallLayout.cpp +++ b/Goldleaf/Source/ui/ui_InstallLayout.cpp @@ -42,6 +42,12 @@ namespace ui void InstallLayout::StartInstall(pu::String Path, fs::Explorer *Exp, Storage Location, bool OmitConfirmation) { + if(envGetHeapOverrideSize() < 900 * 1000 * 1000) + { + mainapp->CreateShowDialog("Insufficient Memory", "Due to unoptimized code, GoldBricks requires more memory to run. Please run this application using title override or a NSP forwarder.", { set::GetDictionaryEntry(234) }, true); + return; + } + nsp::Installer inst(Path, Exp, Location); auto rc = inst.PrepareInstallation(); diff --git a/Goldleaf/Source/ui/ui_PartitionBrowserLayout.cpp b/Goldleaf/Source/ui/ui_PartitionBrowserLayout.cpp index 53cf3a1..e37ba96 100644 --- a/Goldleaf/Source/ui/ui_PartitionBrowserLayout.cpp +++ b/Goldleaf/Source/ui/ui_PartitionBrowserLayout.cpp @@ -102,7 +102,7 @@ namespace ui else { pu::String ext = fs::GetExtension(itm); - if(ext == "nsp") mitm->SetIcon(gsets.PathForResource("/FileSystem/NSP.png")); + if(ext == "nsp" || ext == "nsz") mitm->SetIcon(gsets.PathForResource("/FileSystem/NSP.png")); else if(ext == "nro") mitm->SetIcon(gsets.PathForResource("/FileSystem/NRO.png")); else if(ext == "tik") mitm->SetIcon(gsets.PathForResource("/FileSystem/TIK.png")); else if(ext == "cert") mitm->SetIcon(gsets.PathForResource("/FileSystem/CERT.png")); @@ -178,7 +178,7 @@ namespace ui { pu::String ext = fs::GetExtension(itm); pu::String msg = set::GetDictionaryEntry(52) + " "; - if(ext == "nsp") msg += set::GetDictionaryEntry(53); + if(ext == "nsp" || ext == "nsz") msg += set::GetDictionaryEntry(53); else if(ext == "nro") msg += set::GetDictionaryEntry(54); else if(ext == "tik") msg += set::GetDictionaryEntry(55); else if(ext == "nxtheme") msg += set::GetDictionaryEntry(56); @@ -190,7 +190,7 @@ namespace ui std::vector vopts; u32 copt = 5; bool ibin = this->gexp->IsFileBinary(fullitm); - if(ext == "nsp") + if(ext == "nsp" || ext == "nsz") { vopts.push_back(set::GetDictionaryEntry(65)); copt = 6; @@ -241,7 +241,7 @@ namespace ui int sopt = mainapp->CreateShowDialog(set::GetDictionaryEntry(76), msg, vopts, true); if(sopt < 0) return; int osopt = sopt; - if(ext == "nsp") + if(ext == "nsp" || ext == "nsz") { switch(sopt) { @@ -485,7 +485,7 @@ namespace ui for(u32 i = 0; i < files.size(); i++) { auto path = fullitm + "/" + files[i]; - if(fs::GetExtension(path) == "nsp") nsps.push_back(files[i]); + if(fs::GetExtension(path) == "nsp" || fs::GetExtension(path) == "nsz") nsps.push_back(files[i]); } std::vector extraopts = { set::GetDictionaryEntry(281) }; if(!nsps.empty()) extraopts.push_back(set::GetDictionaryEntry(282)); diff --git a/README.md b/README.md index 501c57d..98aba6f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ Unfortunately this code might contain brick code, as the original author--XorTro bricked +# High Memory Requirement + +Due to unoptimized code, there is not much memory left to add NSZ support. Therefore title installs will require that GoldBricks be ran in high memory more via title override or a piracy NSP forwarder. + drawing drawing > Having any issues? Check [this help document](docs/FAQ.md) for help!