Skip to content

Commit

Permalink
enforce high memory install mode, map nsz file types
Browse files Browse the repository at this point in the history
  • Loading branch information
blawar committed Oct 25, 2019
1 parent 6c7b26c commit b5bcd20
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Goldleaf/Source/nsp/nsp_Installer.cpp
Expand Up @@ -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<FsStorageId>(Location))
Expand All @@ -46,6 +47,7 @@ namespace nsp
Result Installer::PrepareInstallation()
{
Result rc = err::Make(err::ErrorDescription::InvalidNSP);

if(nspentry.IsOk())
{
rc = 0;
Expand Down
6 changes: 6 additions & 0 deletions Goldleaf/Source/ui/ui_InstallLayout.cpp
Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions Goldleaf/Source/ui/ui_PartitionBrowserLayout.cpp
Expand Up @@ -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"));
Expand Down Expand Up @@ -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);
Expand All @@ -190,7 +190,7 @@ namespace ui
std::vector<pu::String> 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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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<pu::String> extraopts = { set::GetDictionaryEntry(281) };
if(!nsps.empty()) extraopts.push_back(set::GetDictionaryEntry(282));
Expand Down
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -10,6 +10,10 @@ Unfortunately this code might contain brick code, as the original author--XorTro

<img src="brick.png" alt="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.

<img src="Screenshot-gleaf.jpg" alt="drawing" width="400"/> <img src="Screenshot-quark.png" alt="drawing" width="300"/>

> Having any issues? Check [this help document](docs/FAQ.md) for help!
Expand Down

0 comments on commit b5bcd20

Please sign in to comment.