Skip to content

Commit 0012be6

Browse files
committed
Skip the games & apps settings page if no settings are added to it
1 parent dfe0351 commit 0012be6

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

settings/arm9/source/main.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,7 @@ int settingsMode(void)
14421442
}
14431443

14441444
SettingsPage gamesPage(STR_GAMESAPPS_SETTINGS);
1445+
bool gamesPageVisible = false;
14451446

14461447
using TGbaBooter = TWLSettings::TGbaBooter;
14471448
using TColSegaEmulator = TWLSettings::TColSegaEmulator;
@@ -1450,21 +1451,28 @@ int settingsMode(void)
14501451

14511452
if (flashcardFound() && ms().kernelUseable) {
14521453
gamesPage.option(sdFound() ? ("S1SD: "+STR_GAMELOADER) : STR_GAMELOADER, STR_DESCRIPTION_GAMELOADER, Option::Bool(&ms().useBootstrap), {"nds-bootstrap", STR_KERNEL}, {true, false});
1454+
gamesPageVisible = true;
14531455
}
14541456

1455-
if (emulatorsInstalled)
1457+
if (emulatorsInstalled) {
14561458
gamesPage.option(STR_COL_EMULATOR, STR_DESCRIPTION_COL_EMULATOR, Option::Int((int *)&ms().colEmulator), {"S8DS", "ColecoDS"}, {TColSegaEmulator::EColSegaS8DS, TColSegaEmulator::EColSegaColecoDS});
1457-
if (ms().consoleModel == 0 && sdFound() && !sys().arm7SCFGLocked())
1459+
gamesPageVisible = true;
1460+
}
1461+
if (ms().consoleModel == 0 && sdFound() && !sys().arm7SCFGLocked()) {
14581462
gamesPage.option(STR_DSIWAREBOOTER, STR_DESCRIPTION_DSIWAREBOOTER, Option::Bool((bool *)&ms().dsiWareBooter), {"nds-bootstrap", "Unlaunch"}, {true, false});
1463+
gamesPageVisible = true;
1464+
}
14591465
if (sys().isRegularDS()) {
14601466
gamesPage
14611467
.option(STR_GBA_BOOTER, STR_DESCRIPTION_GBA_BOOTER, Option::Int((int *)&ms().gbaBooter), {gbaR3Found ? STR_NATIVE_GBARUNNER3 : STR_NATIVE_GBARUNNER2, gbaR3Found ? STR_GBARUNNER3_ONLY : STR_GBARUNNER2_ONLY}, {TGbaBooter::EGbaNativeGbar2, TGbaBooter::EGbaGbar2})
14621468
.option(STR_GBABORDER, STR_DESCRIPTION_GBABORDER, Option::Nul(opt_gba_border_select), {STR_PRESS_A}, {0});
1469+
gamesPageVisible = true;
14631470
}
14641471
if (emulatorsInstalled) {
14651472
if (!(isDSiMode() && sdFound() && sys().arm7SCFGLocked()))
14661473
gamesPage.option(STR_MD_EMULATOR, STR_DESCRIPTION_MD_EMULATOR, Option::Int((int *)&ms().mdEmulator), {"jEnesisDS", "PicoDriveTWL", STR_HYBRID}, {TMegaDriveEmulator::EMegaDriveJenesis, TMegaDriveEmulator::EMegaDrivePico, TMegaDriveEmulator::EMegaDriveHybrid});
14671474
gamesPage.option(STR_SG_EMULATOR, STR_DESCRIPTION_SG_EMULATOR, Option::Int((int *)&ms().sgEmulator), {"S8DS", "ColecoDS"}, {TColSegaEmulator::EColSegaS8DS, TColSegaEmulator::EColSegaColecoDS});
1475+
gamesPageVisible = true;
14681476
}
14691477

14701478
if (isDSiMode() && sdFound() && !sys().arm7SCFGLocked()) {
@@ -1481,6 +1489,7 @@ int settingsMode(void)
14811489
} else {
14821490
gamesPage.option(STR_SLOT1LAUNCHMETHOD, STR_DESCRIPTION_SLOT1LAUNCHMETHOD_1, Option::Int((int *)&ms().slot1LaunchMethod), {STR_REBOOT, STR_DIRECT}, {TSlot1LaunchMethod::EReboot, TSlot1LaunchMethod::EDirect});
14831491
}
1492+
gamesPageVisible = true;
14841493
}
14851494

14861495
SettingsPage miscPage(STR_MISC_SETTINGS);
@@ -1645,9 +1654,9 @@ int settingsMode(void)
16451654
gui().addPage(gbar2Page);
16461655
if (sdFound() && ms().consoleModel == 0)
16471656
gui().addPage(unlaunchPage);
1648-
gui()
1649-
.addPage(gamesPage)
1650-
.addPage(miscPage);
1657+
if (gamesPageVisible)
1658+
gui().addPage(gamesPage);
1659+
gui().addPage(miscPage);
16511660

16521661
/*if (isDSiMode() && ms().consoleModel >= 2) {
16531662
gui().addPage(twlfirmPage);

0 commit comments

Comments
 (0)