From cbf784f4d8787428d4d802cf3a36633b3c3151e7 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Fri, 1 Nov 2024 21:15:34 -0600 Subject: [PATCH] Fix bootloader/bootstub install bugs --- imageview/arm9/source/main.cpp | 2 +- manual/arm9/source/main.cpp | 2 +- quickmenu/arm9/source/gbaswitch.cpp | 2 +- quickmenu/arm9/source/main.cpp | 30 +++---- romsel_aktheme/arm9/source/gbaswitch.cpp | 2 +- romsel_aktheme/arm9/source/main.cpp | 26 +++---- .../arm9/source/fileBrowse.cpp | 32 ++++---- romsel_dsimenutheme/arm9/source/gbaswitch.cpp | 2 +- romsel_dsimenutheme/arm9/source/main.cpp | 24 +++--- romsel_r4theme/arm9/source/gbaswitch.cpp | 2 +- romsel_r4theme/arm9/source/main.cpp | 36 ++++----- settings/arm9/source/main.cpp | 6 +- title/arm9/source/main.cpp | 78 +++++++++---------- universal/include/common/nds_loader_arm9.h | 4 +- universal/source/nds_loader/nds_loader_arm9.c | 29 +++---- 15 files changed, 140 insertions(+), 137 deletions(-) diff --git a/imageview/arm9/source/main.cpp b/imageview/arm9/source/main.cpp index 8717639877..cb9f8b07eb 100644 --- a/imageview/arm9/source/main.cpp +++ b/imageview/arm9/source/main.cpp @@ -68,7 +68,7 @@ void loadROMselect() { break; } - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); fadeType = true; // Fade in from white } diff --git a/manual/arm9/source/main.cpp b/manual/arm9/source/main.cpp index 0361b0e981..84c4a14bb1 100644 --- a/manual/arm9/source/main.cpp +++ b/manual/arm9/source/main.cpp @@ -203,7 +203,7 @@ void loadROMselect() { break; } - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); fadeType = true; // Fade in from white } diff --git a/quickmenu/arm9/source/gbaswitch.cpp b/quickmenu/arm9/source/gbaswitch.cpp index 156222794b..dd149995f3 100644 --- a/quickmenu/arm9/source/gbaswitch.cpp +++ b/quickmenu/arm9/source/gbaswitch.cpp @@ -96,5 +96,5 @@ void gbaSwitch(void) { loadGbaBorder((access(borderPath, F_OK)==0) ? borderPath : "nitro:/graphics/gbaborder.png"); // Switch to GBA mode - runNdsFile ("/_nds/TWiLightMenu/gbaswitch.srldr", 0, NULL, true, false, true, false, false, false, -1); + runNdsFile ("/_nds/TWiLightMenu/gbaswitch.srldr", 0, NULL, false, true, false, true, false, false, false, -1); } \ No newline at end of file diff --git a/quickmenu/arm9/source/main.cpp b/quickmenu/arm9/source/main.cpp index 3c4f920f45..3916def315 100644 --- a/quickmenu/arm9/source/main.cpp +++ b/quickmenu/arm9/source/main.cpp @@ -805,7 +805,7 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { while (!screenFadedOut()) { swiWaitForVBlank(); } - err = runNdsFile("fat:/Wfwd.dat", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/Wfwd.dat", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } else if (memcmp(io_dldi_data->friendlyName, "DSTWO(Slot-1)", 0xD) == 0) { CIniFile fcrompathini("fat:/_dstwo/autoboot.ini"); fcPath = replaceAll(ndsPath, "fat:/", dstwofat); @@ -814,7 +814,7 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { while (!screenFadedOut()) { swiWaitForVBlank(); } - err = runNdsFile("fat:/_dstwo/autoboot.nds", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/_dstwo/autoboot.nds", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } else if ((memcmp(io_dldi_data->friendlyName, "TTCARD", 6) == 0) || (memcmp(io_dldi_data->friendlyName, "DSTT", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "DEMON", 5) == 0) @@ -828,7 +828,7 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { while (!screenFadedOut()) { swiWaitForVBlank(); } - err = runNdsFile("fat:/YSMenu.nds", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/YSMenu.nds", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } else { while (!screenFadedOut()) { swiWaitForVBlank(); @@ -863,7 +863,7 @@ void loadROMselect() } else { argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); } - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } /* bool ndsPreloaded = false; @@ -1061,7 +1061,7 @@ void directCardLaunch() { if (sdFound()) { chdir("sd:/"); } - int err = runNdsFile ("/_nds/TWiLightMenu/dstwoLaunch.srldr", 0, NULL, true, true, true, DEFAULT_BOOST_CPU, DEFAULT_BOOST_VRAM, false, -1); + int err = runNdsFile ("/_nds/TWiLightMenu/dstwoLaunch.srldr", 0, NULL, sys().isRunFromSD(), true, true, true, DEFAULT_BOOST_CPU, DEFAULT_BOOST_VRAM, false, -1); char text[64]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); ClearBrightness(); @@ -1071,7 +1071,7 @@ void directCardLaunch() { }*/ SetWidescreen(NULL); chdir(sys().isRunFromSD() ? "sd:/" : "fat:/"); - int err = runNdsFile ("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, true, true, false, true, true, false, -1); + int err = runNdsFile ("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[64]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); clearText(); @@ -1919,7 +1919,7 @@ int dsClassicMenu(void) { if ((!dsiFeatures() || bs().b4dsMode) && ms().secondaryDevice) { chdir(sys().isRunFromSD() ? "sd:/" : "fat:/"); - int err = runNdsFile (pictochatPath, 0, NULL, true, true, true, false, false, false, ms().gameLanguage); + int err = runNdsFile (pictochatPath, 0, NULL, sys().isRunFromSD(), true, true, true, false, false, false, ms().gameLanguage); char text[64]; snprintf (text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); clearText(); @@ -1982,7 +1982,7 @@ int dsClassicMenu(void) { bootstrapini.SetInt("NDS-BOOTSTRAP", "BOOST_CPU", 0); bootstrapini.SetInt("NDS-BOOTSTRAP", "BOOST_VRAM", 0); bootstrapini.SaveIniFile(bootstrapinipath); - int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[64]; snprintf (text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); clearText(); @@ -2049,7 +2049,7 @@ int dsClassicMenu(void) { for (int i = 0; i < 15; i++) swiWaitForVBlank(); } else if ((!dsiFeatures() || bs().b4dsMode) && ms().secondaryDevice) { chdir(sys().isRunFromSD() ? "sd:/" : "fat:/"); - int err = runNdsFile (dlplayPath, 0, NULL, true, true, true, false, false, false, ms().gameLanguage); + int err = runNdsFile (dlplayPath, 0, NULL, sys().isRunFromSD(), true, true, true, false, false, false, ms().gameLanguage); char text[64]; snprintf (text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); clearText(); @@ -2079,7 +2079,7 @@ int dsClassicMenu(void) { bootstrapini.SetInt("NDS-BOOTSTRAP", "BOOST_CPU", 0); bootstrapini.SetInt("NDS-BOOTSTRAP", "BOOST_VRAM", 0); bootstrapini.SaveIniFile(bootstrapinipath); - int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[64]; snprintf (text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); clearText(); @@ -2192,7 +2192,7 @@ int dsClassicMenu(void) { return "fat:/_nds/TWiLightMenu/manual.srldr"; }; argarray.push_back(getLaunchArgument()); - int err = runNdsFile(argarray[0], argarray.size(), &argarray[0], true, false, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), &argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); iprintf (STR_START_FAILED_ERROR.c_str(), err); } break; @@ -2558,7 +2558,7 @@ int dsClassicMenu(void) { } argarray.at(0) = (char *)ndsToBoot; - int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[64]; snprintf (text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); clearText(); @@ -2851,7 +2851,7 @@ int dsClassicMenu(void) { } } else { argarray.at(0) = (char *)ndsToBoot; - err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], (ms().homebrewBootstrap ? false : true), true, false, true, true, false, -1); + err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), (ms().homebrewBootstrap ? false : true), true, false, true, true, false, -1); } char text[64]; snprintf (text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); @@ -2962,7 +2962,7 @@ int dsClassicMenu(void) { runNds_boostVram = perGameSettings_boostVram == -1 ? DEFAULT_BOOST_VRAM : perGameSettings_boostVram; } //iprintf ("Running %s with %d parameters\n", argarray[0], argarray.size()); - int err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], true, true, dsModeSwitch, runNds_boostCpu, runNds_boostVram, false, language); + int err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, dsModeSwitch, runNds_boostCpu, runNds_boostVram, false, language); char text[64]; snprintf (text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); clearText(); @@ -3542,7 +3542,7 @@ int dsClassicMenu(void) { err = 1; } } else { - err = runNdsFile (ndsToBoot, argarray.size(), (const char **)&argarray[0], !useNDSB, true, dsModeSwitch, boostCpu, boostVram, tscTgds, -1); // Pass ROM to emulator as argument + err = runNdsFile (ndsToBoot, argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), !useNDSB, true, dsModeSwitch, boostCpu, boostVram, tscTgds, -1); // Pass ROM to emulator as argument } whiteScreen = true; diff --git a/romsel_aktheme/arm9/source/gbaswitch.cpp b/romsel_aktheme/arm9/source/gbaswitch.cpp index 1ad7f010c8..8970bb9e8e 100644 --- a/romsel_aktheme/arm9/source/gbaswitch.cpp +++ b/romsel_aktheme/arm9/source/gbaswitch.cpp @@ -94,5 +94,5 @@ void gbaSwitch(void) { loadGbaBorder((access(borderPath, F_OK)==0) ? borderPath : "nitro:/graphics/gbaborder.png"); // Switch to GBA mode - runNdsFile ("/_nds/TWiLightMenu/gbaswitch.srldr", 0, NULL, true, false, true, false, false, false, -1); + runNdsFile ("/_nds/TWiLightMenu/gbaswitch.srldr", 0, NULL, false, true, false, true, false, false, false, -1); } \ No newline at end of file diff --git a/romsel_aktheme/arm9/source/main.cpp b/romsel_aktheme/arm9/source/main.cpp index 16bd1ec1dc..5ea33f4ee5 100644 --- a/romsel_aktheme/arm9/source/main.cpp +++ b/romsel_aktheme/arm9/source/main.cpp @@ -810,13 +810,13 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { fcPath = replaceAll(ndsPath, "fat:/", woodfat); fcrompathini.SetString("Save Info", "lastLoaded", fcPath); fcrompathini.SaveIniFile("fat:/_wfwd/lastsave.ini"); - err = runNdsFile("fat:/Wfwd.dat", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/Wfwd.dat", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } else if (memcmp(io_dldi_data->friendlyName, "DSTWO(Slot-1)", 0xD) == 0) { CIniFile fcrompathini("fat:/_dstwo/autoboot.ini"); fcPath = replaceAll(ndsPath, "fat:/", dstwofat); fcrompathini.SetString("Dir Info", "fullName", fcPath); fcrompathini.SaveIniFile("fat:/_dstwo/autoboot.ini"); - err = runNdsFile("fat:/_dstwo/autoboot.nds", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/_dstwo/autoboot.nds", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } else if ((memcmp(io_dldi_data->friendlyName, "TTCARD", 6) == 0) || (memcmp(io_dldi_data->friendlyName, "DSTT", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "DEMON", 5) == 0) @@ -827,7 +827,7 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { fcPath = replaceAll(ndsPath, "fat:/", slashchar); fcrompathini.SetString("YSMENU", "AUTO_BOOT", fcPath); fcrompathini.SaveIniFile("fat:/TTMenu/YSMenu.ini"); - err = runNdsFile("fat:/YSMenu.nds", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/YSMenu.nds", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } char text[32]; @@ -854,7 +854,7 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { } while (!(pressed & KEY_B)); vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/akmenu.srldr" : "fat:/_nds/TWiLightMenu/akmenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); stop(); } @@ -1277,7 +1277,7 @@ int akTheme(void) { vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/mainmenu.srldr" : "fat:/_nds/TWiLightMenu/mainmenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); stop(); } else { std::vector extensionList = { @@ -1668,7 +1668,7 @@ int akTheme(void) { } argarray.at(0) = (char *)ndsToBoot; - int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[32]; snprintf (text, sizeof(text), "Start failed. Error %i", err); clearText(false); @@ -1691,7 +1691,7 @@ int akTheme(void) { } while (!(pressed & KEY_B)); vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/akmenu.srldr" : "fat:/_nds/TWiLightMenu/akmenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); stop(); } @@ -1934,7 +1934,7 @@ int akTheme(void) { } argarray.at(0) = (char *)ndsToBoot; - int err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], (ms().homebrewBootstrap ? false : true), true, false, true, true, false, -1); + int err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), (ms().homebrewBootstrap ? false : true), true, false, true, true, false, -1); char text[32]; snprintf (text, sizeof(text), "Start failed. Error %i", err); clearText(false); @@ -1961,7 +1961,7 @@ int akTheme(void) { } while (!(pressed & KEY_B)); vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/akmenu.srldr" : "fat:/_nds/TWiLightMenu/akmenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } else { ms().romPath[ms().secondaryDevice] = argarray[0]; ms().launchType[ms().secondaryDevice] = TWLSettings::ESDFlashcardLaunch; @@ -2061,7 +2061,7 @@ int akTheme(void) { runNds_boostCpu = perGameSettings_boostCpu == -1 ? DEFAULT_BOOST_CPU : perGameSettings_boostCpu; runNds_boostVram = perGameSettings_boostVram == -1 ? DEFAULT_BOOST_VRAM : perGameSettings_boostVram; } - int err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], true, true, dsModeSwitch, runNds_boostCpu, runNds_boostVram, false, runNds_language); + int err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, dsModeSwitch, runNds_boostCpu, runNds_boostVram, false, runNds_language); char text[32]; snprintf (text, sizeof(text), "Start failed. Error %i", err); clearText(false); @@ -2080,7 +2080,7 @@ int akTheme(void) { } while (!(pressed & KEY_B)); vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/akmenu.srldr" : "fat:/_nds/TWiLightMenu/akmenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } } else { bool useNDSB = false; @@ -2560,7 +2560,7 @@ int akTheme(void) { argarray.push_back(ROMpath); argarray.at(0) = (char *)(tgdsMode ? tgdsNdsPath : ndsToBoot); - int err = runNdsFile (ndsToBoot, argarray.size(), (const char **)&argarray[0], !useNDSB, true, dsModeSwitch, boostCpu, boostVram, tscTgds, -1); // Pass ROM to emulator as argument + int err = runNdsFile (ndsToBoot, argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), !useNDSB, true, dsModeSwitch, boostCpu, boostVram, tscTgds, -1); // Pass ROM to emulator as argument char text[32]; snprintf (text, sizeof(text), "Start failed. Error %i", err); clearText(false); @@ -2583,7 +2583,7 @@ int akTheme(void) { } while (!(pressed & KEY_B)); vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/akmenu.srldr" : "fat:/_nds/TWiLightMenu/akmenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } while (argarray.size() !=0 ) { diff --git a/romsel_dsimenutheme/arm9/source/fileBrowse.cpp b/romsel_dsimenutheme/arm9/source/fileBrowse.cpp index 8a35637fa5..b0f12639e4 100644 --- a/romsel_dsimenutheme/arm9/source/fileBrowse.cpp +++ b/romsel_dsimenutheme/arm9/source/fileBrowse.cpp @@ -650,7 +650,7 @@ void launchDsClassicMenu(void) { // Launch DS Classic Menu vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/mainmenu.srldr" : "fat:/_nds/TWiLightMenu/mainmenu.srldr")); - int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); char text[32]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); fadeType = true; @@ -673,7 +673,7 @@ void launchSettings(void) { // Launch TWLMenu++ Settings vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/settings.srldr" : "fat:/_nds/TWiLightMenu/settings.srldr")); - int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); char text[32]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); fadeType = true; @@ -754,7 +754,7 @@ void launchPictochat(std::string filename, bool isDir) { ms().saveSettings(); // Launch Pictochat if ((!dsiFeatures() || bs().b4dsMode) && ms().secondaryDevice) { - int err = runNdsFile(pictochatPath, 0, NULL, true, true, true, false, false, false, ms().gameLanguage); + int err = runNdsFile(pictochatPath, 0, NULL, sys().isRunFromSD(), true, true, true, false, false, false, ms().gameLanguage); char text[32]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); fadeType = true; @@ -772,7 +772,7 @@ void launchPictochat(std::string filename, bool isDir) { } std::vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } else { char ndsToBoot[256]; sprintf(ndsToBoot, "%s:/_nds/nds-bootstrap-%s.nds", sys().isRunFromSD() ? "sd" : "fat", ms().bootstrapFile ? "nightly" : "release"); @@ -795,7 +795,7 @@ void launchPictochat(std::string filename, bool isDir) { bootstrapini.SetInt("NDS-BOOTSTRAP", "BOOST_CPU", 0); bootstrapini.SetInt("NDS-BOOTSTRAP", "BOOST_VRAM", 0); bootstrapini.SaveIniFile(bootstrapinipath); - int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[32]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); printLarge(false, 4, 4, text); @@ -821,7 +821,7 @@ void launchPictochat(std::string filename, bool isDir) { argarray.erase(argarray.begin()); // } argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } stop(); } @@ -932,7 +932,7 @@ void launchDownloadPlay(std::string filename, bool isDir) { fifoSendValue32(FIFO_USER_02, 1); // Reboot into DSiWare title, booted via Launcher for (int i = 0; i < 15; i++) swiWaitForVBlank(); } else if ((!dsiFeatures() || bs().b4dsMode) && ms().secondaryDevice) { - int err = runNdsFile(dlplayPath, 0, NULL, true, true, true, false, false, false, ms().gameLanguage); + int err = runNdsFile(dlplayPath, 0, NULL, sys().isRunFromSD(), true, true, true, false, false, false, ms().gameLanguage); char text[32]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); fadeType = true; @@ -950,7 +950,7 @@ void launchDownloadPlay(std::string filename, bool isDir) { } std::vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } else { char ndsToBoot[256]; sprintf(ndsToBoot, "%s:/_nds/nds-bootstrap-%s.nds", sys().isRunFromSD() ? "sd" : "fat", ms().bootstrapFile ? "nightly" : "release"); @@ -973,7 +973,7 @@ void launchDownloadPlay(std::string filename, bool isDir) { bootstrapini.SetInt("NDS-BOOTSTRAP", "BOOST_CPU", 0); bootstrapini.SetInt("NDS-BOOTSTRAP", "BOOST_VRAM", 0); bootstrapini.SaveIniFile(bootstrapinipath); - int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[32]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); printLarge(false, 4, 4, text); @@ -999,7 +999,7 @@ void launchDownloadPlay(std::string filename, bool isDir) { argarray.erase(argarray.begin()); // } argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } stop(); } @@ -1244,7 +1244,7 @@ void launchInternetBrowser(std::string filename, bool isDir) { while (!screenFadedOut()) { swiWaitForVBlank(); } - int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[32]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); printLarge(false, 4, 4, text); @@ -1270,7 +1270,7 @@ void launchInternetBrowser(std::string filename, bool isDir) { argarray.erase(argarray.begin()); // } argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } stop(); } @@ -1290,7 +1290,7 @@ void launchManual(void) { // Launch manual vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/manual.srldr" : "fat:/_nds/TWiLightMenu/manual.srldr")); - int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); char text[32]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); fadeType = true; @@ -1385,7 +1385,7 @@ void switchDevice(void) { if (directMethod) { SetWidescreen(NULL); chdir(sys().isRunFromSD() ? "sd:/" : "fat:/"); - int err = runNdsFile("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, true, true, false, true, true, false, -1); + int err = runNdsFile("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[32]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); fadeType = true; @@ -1424,7 +1424,7 @@ void launchGba(void) { gbar2Path = ms().consoleModel>0 ? "fat:/_nds/GBARunner2_arm7dldi_3ds.nds" : "fat:/_nds/GBARunner2_arm7dldi_dsi.nds"; } if (perGameSettings_useBootstrap == -1 ? ms().useBootstrap : perGameSettings_useBootstrap) { - int err = runNdsFile(gbar2Path, 0, NULL, true, true, false, true, false, -1); + int err = runNdsFile(gbar2Path, 0, NULL, sys().isRunFromSD(), true, true, false, true, false, -1); iprintf("Start failed. Error %i\n", err); } else { loadGameOnFlashcard(gbar2Path, false); @@ -1455,7 +1455,7 @@ void launchGba(void) { extern void ntrStartSdGame(); ntrStartSdGame(); } - int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], false, true, false, true, true, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), false, true, false, true, true, -1); char text[32]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); fadeType = true; diff --git a/romsel_dsimenutheme/arm9/source/gbaswitch.cpp b/romsel_dsimenutheme/arm9/source/gbaswitch.cpp index 6e7a729303..cb941b8412 100644 --- a/romsel_dsimenutheme/arm9/source/gbaswitch.cpp +++ b/romsel_dsimenutheme/arm9/source/gbaswitch.cpp @@ -93,5 +93,5 @@ void gbaSwitch(void) { loadGbaBorder((access(borderPath, F_OK)==0) ? borderPath : "nitro:/graphics/gbaborder.png"); // Switch to GBA mode - runNdsFile ("/_nds/TWiLightMenu/gbaswitch.srldr", 0, NULL, true, false, true, false, false, false, -1); + runNdsFile ("/_nds/TWiLightMenu/gbaswitch.srldr", 0, NULL, false, true, false, true, false, false, false, -1); } \ No newline at end of file diff --git a/romsel_dsimenutheme/arm9/source/main.cpp b/romsel_dsimenutheme/arm9/source/main.cpp index 9d852c585a..60fd2f2399 100644 --- a/romsel_dsimenutheme/arm9/source/main.cpp +++ b/romsel_dsimenutheme/arm9/source/main.cpp @@ -699,13 +699,13 @@ void loadGameOnFlashcard(const char *ndsPath, bool dsGame) { fcPath = replaceAll(ndsPath, "fat:/", woodfat); fcrompathini.SetString("Save Info", "lastLoaded", fcPath); fcrompathini.SaveIniFile("fat:/_wfwd/lastsave.ini"); - err = runNdsFile("fat:/Wfwd.dat", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/Wfwd.dat", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } else if (memcmp(io_dldi_data->friendlyName, "DSTWO(Slot-1)", 0xD) == 0) { CIniFile fcrompathini("fat:/_dstwo/autoboot.ini"); fcPath = replaceAll(ndsPath, "fat:/", dstwofat); fcrompathini.SetString("Dir Info", "fullName", fcPath); fcrompathini.SaveIniFile("fat:/_dstwo/autoboot.ini"); - err = runNdsFile("fat:/_dstwo/autoboot.nds", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/_dstwo/autoboot.nds", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } else if ((memcmp(io_dldi_data->friendlyName, "TTCARD", 6) == 0) || (memcmp(io_dldi_data->friendlyName, "DSTT", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "DEMON", 5) == 0) @@ -716,7 +716,7 @@ void loadGameOnFlashcard(const char *ndsPath, bool dsGame) { fcPath = replaceAll(ndsPath, "fat:/", slashchar); fcrompathini.SetString("YSMENU", "AUTO_BOOT", fcPath); fcrompathini.SaveIniFile("fat:/TTMenu/YSMenu.ini"); - err = runNdsFile("fat:/YSMenu.nds", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/YSMenu.nds", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } char text[64]; @@ -749,7 +749,7 @@ void loadGameOnFlashcard(const char *ndsPath, bool dsGame) { } vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); stop(); } @@ -1653,7 +1653,7 @@ int dsiMenuTheme(void) { } argarray.at(0) = (char *)ndsToBoot; - int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[64]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); clearText(); @@ -1677,7 +1677,7 @@ int dsiMenuTheme(void) { } vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); stop(); } @@ -1903,7 +1903,7 @@ int dsiMenuTheme(void) { } } else { argarray.at(0) = (char *)ndsToBoot; - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], (ms().homebrewBootstrap ? false : true), true, false, true, true, false, -1); + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), (ms().homebrewBootstrap ? false : true), true, false, true, true, false, -1); } char text[64]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); @@ -1941,7 +1941,7 @@ int dsiMenuTheme(void) { } vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); stop(); } else { ms().romPath[ms().secondaryDevice] = std::string(argarray[0]); @@ -2055,7 +2055,7 @@ int dsiMenuTheme(void) { runNds_boostCpu = perGameSettings_boostCpu == -1 ? DEFAULT_BOOST_CPU : perGameSettings_boostCpu; runNds_boostVram = perGameSettings_boostVram == -1 ? DEFAULT_BOOST_VRAM : perGameSettings_boostVram; } - int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, dsModeSwitch, runNds_boostCpu, runNds_boostVram, false, language); + int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, dsModeSwitch, runNds_boostCpu, runNds_boostVram, false, language); char text[64]; snprintf(text, sizeof(text), STR_START_FAILED_ERROR.c_str(), err); printLarge(false, 4, 4, text); @@ -2080,7 +2080,7 @@ int dsiMenuTheme(void) { } vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); stop(); } } else { @@ -2661,7 +2661,7 @@ int dsiMenuTheme(void) { err = 1; } } else { - err = runNdsFile (ndsToBoot, argarray.size(), (const char **)&argarray[0], !useNDSB, true, dsModeSwitch, boostCpu, boostVram, tscTgds, -1); // Pass ROM to emulator as argument + err = runNdsFile (ndsToBoot, argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), !useNDSB, true, dsModeSwitch, boostCpu, boostVram, tscTgds, -1); // Pass ROM to emulator as argument } char text[64]; @@ -2692,7 +2692,7 @@ int dsiMenuTheme(void) { } vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); stop(); } diff --git a/romsel_r4theme/arm9/source/gbaswitch.cpp b/romsel_r4theme/arm9/source/gbaswitch.cpp index 1ad7f010c8..8970bb9e8e 100644 --- a/romsel_r4theme/arm9/source/gbaswitch.cpp +++ b/romsel_r4theme/arm9/source/gbaswitch.cpp @@ -94,5 +94,5 @@ void gbaSwitch(void) { loadGbaBorder((access(borderPath, F_OK)==0) ? borderPath : "nitro:/graphics/gbaborder.png"); // Switch to GBA mode - runNdsFile ("/_nds/TWiLightMenu/gbaswitch.srldr", 0, NULL, true, false, true, false, false, false, -1); + runNdsFile ("/_nds/TWiLightMenu/gbaswitch.srldr", 0, NULL, false, true, false, true, false, false, false, -1); } \ No newline at end of file diff --git a/romsel_r4theme/arm9/source/main.cpp b/romsel_r4theme/arm9/source/main.cpp index 2b7b9bbb1e..4d4d31b24a 100644 --- a/romsel_r4theme/arm9/source/main.cpp +++ b/romsel_r4theme/arm9/source/main.cpp @@ -777,13 +777,13 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { fcPath = replaceAll(ndsPath, "fat:/", woodfat); fcrompathini.SetString("Save Info", "lastLoaded", fcPath); fcrompathini.SaveIniFile("fat:/_wfwd/lastsave.ini"); - err = runNdsFile("fat:/Wfwd.dat", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/Wfwd.dat", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } else if (memcmp(io_dldi_data->friendlyName, "DSTWO(Slot-1)", 0xD) == 0) { CIniFile fcrompathini("fat:/_dstwo/autoboot.ini"); fcPath = replaceAll(ndsPath, "fat:/", dstwofat); fcrompathini.SetString("Dir Info", "fullName", fcPath); fcrompathini.SaveIniFile("fat:/_dstwo/autoboot.ini"); - err = runNdsFile("fat:/_dstwo/autoboot.nds", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/_dstwo/autoboot.nds", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } else if ((memcmp(io_dldi_data->friendlyName, "TTCARD", 6) == 0) || (memcmp(io_dldi_data->friendlyName, "DSTT", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "DEMON", 5) == 0) @@ -794,7 +794,7 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { fcPath = replaceAll(ndsPath, "fat:/", slashchar); fcrompathini.SetString("YSMENU", "AUTO_BOOT", fcPath); fcrompathini.SaveIniFile("fat:/TTMenu/YSMenu.ini"); - err = runNdsFile("fat:/YSMenu.nds", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/YSMenu.nds", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } char text[32]; @@ -821,7 +821,7 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { } while (!(pressed & KEY_B)); vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/r4menu.srldr" : "fat:/_nds/TWiLightMenu/r4menu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); stop(); } @@ -1160,7 +1160,7 @@ int r4Theme(void) { if (ms().theme == TWLSettings::EThemeGBC) { vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/settings.srldr" : "fat:/_nds/TWiLightMenu/settings.srldr")); - int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); iprintf ("Start failed. Error %i\n", err); } else { lcdMainOnBottom(); @@ -1231,7 +1231,7 @@ int r4Theme(void) { } vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/manual.srldr" : "fat:/_nds/TWiLightMenu/manual.srldr")); - int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); char text[32]; snprintf (text, sizeof(text), "Start failed. Error %i", err); dialogboxHeight = 0; @@ -1282,7 +1282,7 @@ int r4Theme(void) { int err; chdir(sys().isRunFromSD() ? "sd:/" : "fat:/"); if (!sys().isRunFromSD()) { - err = runNdsFile (moonshlPath, 0, NULL, true, true, true, true, false, false, -1); + err = runNdsFile (moonshlPath, 0, NULL, sys().isRunFromSD(), true, true, true, true, false, false, -1); useNDSB = false; } else { if (access("sd:/moonshl2/logbuf.txt", F_OK) == 0) { @@ -1305,7 +1305,7 @@ int r4Theme(void) { bootstrapini.SetInt("NDS-BOOTSTRAP", "BOOST_CPU", 1); bootstrapini.SetInt("NDS-BOOTSTRAP", "BOOST_VRAM", 0); bootstrapini.SaveIniFile( BOOTSTRAP_INI ); - err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], false, true, false, true, true, false, -1); + err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), false, true, false, true, true, false, -1); } char text[32]; snprintf (text, sizeof(text), "Start failed. Error %i", err); @@ -1362,7 +1362,7 @@ int r4Theme(void) { if (directMethod) { SetWidescreen(NULL); chdir(sys().isRunFromSD() ? "sd:/" : "fat:/"); - int err = runNdsFile ("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, true, true, false, true, true, false, -1); + int err = runNdsFile ("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[32]; snprintf (text, sizeof(text), "Start failed. Error %i", err); dialogboxHeight = 0; @@ -1427,7 +1427,7 @@ int r4Theme(void) { ms().saveSettings(); vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/settings.srldr" : "fat:/_nds/TWiLightMenu/settings.srldr")); - int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); iprintf ("Start failed. Error %i\n", err); } } else { @@ -1826,7 +1826,7 @@ int r4Theme(void) { } argarray.at(0) = (char *)ndsToBoot; - int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); + int err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); char text[32]; snprintf (text, sizeof(text), "Start failed. Error %i", err); clearText(false); @@ -1849,7 +1849,7 @@ int r4Theme(void) { } while (!(pressed & KEY_B)); vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/r4menu.srldr" : "fat:/_nds/TWiLightMenu/r4menu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); stop(); } @@ -2084,7 +2084,7 @@ int r4Theme(void) { } argarray.at(0) = (char *)ndsToBoot; - int err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], (ms().homebrewBootstrap ? false : true), true, false, true, true, false, -1); + int err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), (ms().homebrewBootstrap ? false : true), true, false, true, true, false, -1); char text[32]; snprintf (text, sizeof(text), "Start failed. Error %i", err); clearText(false); @@ -2112,7 +2112,7 @@ int r4Theme(void) { } while (!(pressed & KEY_B)); vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/r4menu.srldr" : "fat:/_nds/TWiLightMenu/r4menu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } else { ms().romPath[ms().secondaryDevice] = argarray[0]; ms().launchType[ms().secondaryDevice] = TWLSettings::ESDFlashcardLaunch; @@ -2208,7 +2208,7 @@ int r4Theme(void) { runNds_boostCpu = perGameSettings_boostCpu == -1 ? DEFAULT_BOOST_CPU : perGameSettings_boostCpu; runNds_boostVram = perGameSettings_boostVram == -1 ? DEFAULT_BOOST_VRAM : perGameSettings_boostVram; } - int err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], true, true, dsModeSwitch, runNds_boostCpu, runNds_boostVram, false, runNds_language); + int err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, dsModeSwitch, runNds_boostCpu, runNds_boostVram, false, runNds_language); char text[32]; snprintf (text, sizeof(text), "Start failed. Error %i", err); clearText(false); @@ -2227,7 +2227,7 @@ int r4Theme(void) { } while (!(pressed & KEY_B)); vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/r4menu.srldr" : "fat:/_nds/TWiLightMenu/r4menu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } } else { bool useNDSB = false; @@ -2701,7 +2701,7 @@ int r4Theme(void) { argarray.push_back(ROMpath); argarray.at(0) = (char *)(tgdsMode ? tgdsNdsPath : ndsToBoot); - int err = runNdsFile (ndsToBoot, argarray.size(), (const char **)&argarray[0], !useNDSB, true, dsModeSwitch, boostCpu, boostVram, tscTgds, -1); // Pass ROM to emulator as argument + int err = runNdsFile (ndsToBoot, argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), !useNDSB, true, dsModeSwitch, boostCpu, boostVram, tscTgds, -1); // Pass ROM to emulator as argument char text[32]; snprintf (text, sizeof(text), "Start failed. Error %i", err); clearText(false); @@ -2724,7 +2724,7 @@ int r4Theme(void) { } while (!(pressed & KEY_B)); vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/r4menu.srldr" : "fat:/_nds/TWiLightMenu/r4menu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } while (argarray.size() !=0 ) { diff --git a/settings/arm9/source/main.cpp b/settings/arm9/source/main.cpp index c7c6e07f09..7210d757d9 100644 --- a/settings/arm9/source/main.cpp +++ b/settings/arm9/source/main.cpp @@ -179,7 +179,7 @@ void loadMainMenu() vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/mainmenu.srldr" : "fat:/_nds/TWiLightMenu/mainmenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); fadeType = true; // Fade in from white } @@ -194,7 +194,7 @@ void loadROMselect() } else { argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); } - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); fadeType = true; // Fade in from white } @@ -631,7 +631,7 @@ void begin_update(int opt) for (int i = 0; i < 25; i++) swiWaitForVBlank(); - runNdsFile("/_nds/TWiLightMenu/settings.srldr", 0, NULL, true, false, false, true, true, false, -1); + runNdsFile("/_nds/TWiLightMenu/settings.srldr", 0, NULL, sys().isRunFromSD(), true, false, false, true, true, false, -1); stop(); } diff --git a/title/arm9/source/main.cpp b/title/arm9/source/main.cpp index e5c97fe8e7..e14878be2f 100644 --- a/title/arm9/source/main.cpp +++ b/title/arm9/source/main.cpp @@ -131,7 +131,7 @@ void loadMainMenu() vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/mainmenu.srldr" : "fat:/_nds/TWiLightMenu/mainmenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } void loadROMselect(void) @@ -151,18 +151,18 @@ void loadROMselect(void) case 3: logPrint("Opening Wood theme...\n"); argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/akmenu.srldr" : "fat:/_nds/TWiLightMenu/akmenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); break; case 2: case 6: logPrint("Opening R4 Original or GameBoy Color theme...\n"); argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/r4menu.srldr" : "fat:/_nds/TWiLightMenu/r4menu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); break; default: logPrint("Opening DSi, 3DS, Saturn, or HBL theme...\n"); argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/dsimenu.srldr" : "fat:/_nds/TWiLightMenu/dsimenu.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); break; } stop(); @@ -479,14 +479,14 @@ void lastRunROM() int err = 0; if (!runTempDSiWare && ms().slot1Launched && (!flashcardFound() || (io_dldi_data->ioInterface.features & FEATURE_SLOT_GBA))) { if (io_dldi_data->ioInterface.features & FEATURE_SLOT_GBA) { - err = runNdsFile("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, true, true, false, true, true, false, -1); + err = runNdsFile("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, sys().isRunFromSD(), true, true, false, true, true, false, -1); } else if (ms().slot1LaunchMethod==0 || sys().arm7SCFGLocked()) { dsCardLaunch(); } else if (ms().slot1LaunchMethod==2) { unlaunchRomBoot("cart:"); } else { wideCheck(ms().wideScreen, true); - err = runNdsFile("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, true, true, false, true, true, false, -1); + err = runNdsFile("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, sys().isRunFromSD(), true, true, false, true, true, false, -1); } } if (!runTempDSiWare && ms().launchType[ms().previousUsedDevice] == Launch::ESDFlashcardLaunch) { @@ -636,7 +636,7 @@ void lastRunROM() ); bootstrapini.SaveIniFile( sys().isRunFromSD() ? BOOTSTRAP_INI : BOOTSTRAP_INI_FC ); } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], (ms().homebrewBootstrap ? false : true), true, false, true, true, false, -1); + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), (ms().homebrewBootstrap ? false : true), true, false, true, true, false, -1); } else { bool runNds_boostCpu = false; bool runNds_boostVram = false; @@ -682,13 +682,13 @@ void lastRunROM() fcPath = replaceAll(ms().romPath[ms().previousUsedDevice], "fat:/", woodfat); fcrompathini.SetString("Save Info", "lastLoaded", fcPath); fcrompathini.SaveIniFile("fat:/_wfwd/lastsave.ini"); - err = runNdsFile("fat:/Wfwd.dat", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/Wfwd.dat", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } else if (memcmp(io_dldi_data->friendlyName, "DSTWO(Slot-1)", 0xD) == 0) { CIniFile fcrompathini("fat:/_dstwo/autoboot.ini"); fcPath = replaceAll(ms().romPath[ms().previousUsedDevice], "fat:/", dstwofat); fcrompathini.SetString("Dir Info", "fullName", fcPath); fcrompathini.SaveIniFile("fat:/_dstwo/autoboot.ini"); - err = runNdsFile("fat:/_dstwo/autoboot.nds", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/_dstwo/autoboot.nds", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } else if ((memcmp(io_dldi_data->friendlyName, "TTCARD", 6) == 0) || (memcmp(io_dldi_data->friendlyName, "DSTT", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "DEMON", 5) == 0) @@ -699,7 +699,7 @@ void lastRunROM() fcPath = replaceAll(ms().romPath[ms().previousUsedDevice], "fat:/", slashchar); fcrompathini.SetString("YSMENU", "AUTO_BOOT", fcPath); fcrompathini.SaveIniFile("fat:/TTMenu/YSMenu.ini"); - err = runNdsFile("fat:/YSMenu.nds", 0, NULL, true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); + err = runNdsFile("fat:/YSMenu.nds", 0, NULL, sys().isRunFromSD(), true, true, true, runNds_boostCpu, runNds_boostVram, false, -1); } } } else if (!runTempDSiWare && ms().launchType[ms().previousUsedDevice] == Launch::ESDFlashcardDirectLaunch) { @@ -790,7 +790,7 @@ void lastRunROM() runNds_boostCpu = perGameSettings_boostCpu == -1 ? DEFAULT_BOOST_CPU : perGameSettings_boostCpu; runNds_boostVram = perGameSettings_boostVram == -1 ? DEFAULT_BOOST_VRAM : perGameSettings_boostVram; - err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], true, true, (!perGameSettings_dsiMode ? true : false), runNds_boostCpu, runNds_boostVram, false, language); + err = runNdsFile (argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, (!perGameSettings_dsiMode ? true : false), runNds_boostCpu, runNds_boostVram, false, language); } else if (runTempDSiWare || ms().launchType[ms().previousUsedDevice] == Launch::EDSiWareLaunch) { if (!runTempDSiWare && access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -987,7 +987,7 @@ void lastRunROM() ntrStartSdGame(); } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); } } else { if (ms().saveLocation != TWLSettings::EGamesFolder) { @@ -1033,7 +1033,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/nesds.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to nesDS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to nesDS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::EGameYobLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1041,7 +1041,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/gameyob.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to GameYob as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to GameYob as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::ES8DSLaunch) { if ((extension(ms().romPath[ms().previousUsedDevice], {".col"}) && ms().colEmulator != 1) || ((extension(ms().romPath[ms().previousUsedDevice], {".sg"}) || extension(ms().romPath[ms().previousUsedDevice], {".sc"})) && ms().sgEmulator != 1) @@ -1054,7 +1054,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/S8DS.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to S8DS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to S8DS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::ERVideoLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1062,7 +1062,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/apps/RocketVideoPlayer.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass video to Rocket Video Player as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass video to Rocket Video Player as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::EFastVideoLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1070,7 +1070,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/apps/FastVideoDS.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass video to FastVideoDS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass video to FastVideoDS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::EStellaDSLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1078,7 +1078,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/StellaDS.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to StellaDS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to StellaDS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::EPicoDriveTWLLaunch) { if (ms().mdEmulator >= 2 || access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1086,7 +1086,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/PicoDriveTWL.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to PicoDrive TWL as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to PicoDrive TWL as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::EGBANativeLaunch) { if (*(u16*)(0x020000C0) == 0 || ms().gbaBooter != TWLSettings::EGbaNativeGbar2 || access(ms().romPath[true].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1160,7 +1160,7 @@ void lastRunROM() } argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/gbapatcher.srldr"; - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); } else if (ms().launchType[ms().previousUsedDevice] == Launch::EA7800DSLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1168,7 +1168,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/A7800DS.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to A7800DS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to A7800DS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::EA5200DSLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1176,7 +1176,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/A5200DS.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to A5200DS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to A5200DS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::ENitroGrafxLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1187,7 +1187,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/NitroGrafx.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to NitroGrafx as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to NitroGrafx as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::EXEGSDSLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1195,7 +1195,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/A8DS.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to A8DS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to A8DS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::ENINTVDSLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1203,7 +1203,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/NINTV-DS.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to NINTV-DS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to NINTV-DS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::EGBARunner2Launch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1238,7 +1238,7 @@ void lastRunROM() } } } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to GBARunner2 as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to GBARunner2 as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::EColecoDSLaunch) { if ((extension(ms().romPath[ms().previousUsedDevice], {".col"}) && ms().colEmulator != 2) || ((extension(ms().romPath[ms().previousUsedDevice], {".sg"}) || extension(ms().romPath[ms().previousUsedDevice], {".sc"})) && ms().sgEmulator != 2) @@ -1248,7 +1248,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/ColecoDS.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to ColecoDS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to ColecoDS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::ENitroSwanLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1259,7 +1259,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/NitroSwan.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to NINTV-DS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to NINTV-DS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::ENGPDSLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1270,7 +1270,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/NGPDS.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to NGPDS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to NGPDS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::ESNEmulDSLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1292,7 +1292,7 @@ void lastRunROM() } argarray.at(0) = (char*)ndsToBoot; } - err = runNdsFile(ndsToBoot, argarray.size(), (const char **)&argarray[0], true, true, !isDSiMode(), ms().newSnesEmuVer, true, ms().newSnesEmuVer, -1); // Pass ROM to SNEmulDS as argument + err = runNdsFile(ndsToBoot, argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, !isDSiMode(), ms().newSnesEmuVer, true, ms().newSnesEmuVer, -1); // Pass ROM to SNEmulDS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::EAmEDSLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1300,7 +1300,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/AmEDS.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to AmEDS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to AmEDS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::ECrocoDSLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1308,7 +1308,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/CrocoDS.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to CrocoDS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to CrocoDS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::ETunaViDSLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1316,7 +1316,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/apps/tuna-vids.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass video to tuna-viDS as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass video to tuna-viDS as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::EImageLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1324,7 +1324,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/imageview.srldr"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass image to image viewer as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass image to image viewer as argument } else if (ms().launchType[ms().previousUsedDevice] == Launch::E3DSLaunch) { if (!dsiFeatures() || access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1332,7 +1332,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/3dssplash.srldr"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to 3DS Splash as argument (Does nothing) + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to 3DS Splash as argument (Does nothing) } else if (ms().launchType[ms().previousUsedDevice] == Launch::EPokeMiniLaunch) { if (access(ms().romPath[ms().previousUsedDevice].c_str(), F_OK) != 0) return; // Skip to running TWiLight Menu++ @@ -1340,7 +1340,7 @@ void lastRunROM() if (!isDSiMode() || access(argarray[0], F_OK) != 0) { argarray.at(0) = (char*)"fat:/_nds/TWiLightMenu/emulators/PokeMini.nds"; } - err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], true, true, false, true, true, false, -1); // Pass ROM to PokeMini as argument + err = runNdsFile(argarray[0], argarray.size(), (const char **)&argarray[0], sys().isRunFromSD(), true, true, false, true, true, false, -1); // Pass ROM to PokeMini as argument } if (err > 0) { consoleDemoInit(); @@ -2113,7 +2113,7 @@ int titleMode(void) } #ifndef _NO_BOOTSTUB_ - installBootStub(sdFound()); + installBootStub(sdFound(), sys().isRunFromSD(), false); #endif ms().loadSettings(); @@ -2752,7 +2752,7 @@ int titleMode(void) } else if (ms().slot1LaunchMethod==2) { unlaunchRomBoot("cart:"); } else { - runNdsFile("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, true, true, false, true, true, false, -1); + runNdsFile("/_nds/TWiLightMenu/slot1launch.srldr", 0, NULL, sys().isRunFromSD(), true, true, false, true, true, false, -1); } } @@ -2791,7 +2791,7 @@ int titleMode(void) vector argarray; argarray.push_back((char*)(sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/settings.srldr" : "fat:/_nds/TWiLightMenu/settings.srldr")); - runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1); + runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], sys().isRunFromSD(), true, false, false, true, true, false, -1); } else { if (isDSiMode() && sdFound() && !fcFound && !sys().arm7SCFGLocked() && ms().limitedMode > 0) { *(u32*)0x02FFFD0C = ms().limitedMode == 2 ? 0x4E44544C : ms().limitedMode == 3 ? 0x6D44544C : 0x4D44544C; diff --git a/universal/include/common/nds_loader_arm9.h b/universal/include/common/nds_loader_arm9.h index 05f7ea1b19..d12375fee2 100644 --- a/universal/include/common/nds_loader_arm9.h +++ b/universal/include/common/nds_loader_arm9.h @@ -32,9 +32,9 @@ extern "C" { int runNds (const void* loader, u32 loaderSize, u32 cluster, bool initDisc, bool dldiPatchNds, bool loadFromRam, const char* filename, int argc, const char** argv, bool clearMasterBright, bool dsModeSwitch, bool lockScfg, bool boostCpu, bool boostVram, bool tscTgds, int language); -int runNdsFile (const char* filename, int argc, const char** argv, bool dldiPatchNds, bool clearMasterBright, bool dsModeSwitch, bool boostCpu, bool boostVram, bool tscTgds, int language); +int runNdsFile (const char* filename, int argc, const char** argv, bool isRunFromSD, bool dldiPatchNds, bool clearMasterBright, bool dsModeSwitch, bool boostCpu, bool boostVram, bool tscTgds, int language); -void installBootStub(bool havedsiSD); +void installBootStub(const bool havedsiSD, const bool isRunFromSD, const bool dsModeSwitch); #ifdef __cplusplus } diff --git a/universal/source/nds_loader/nds_loader_arm9.c b/universal/source/nds_loader/nds_loader_arm9.c index 3294d02456..ac37c77e17 100644 --- a/universal/source/nds_loader/nds_loader_arm9.c +++ b/universal/source/nds_loader/nds_loader_arm9.c @@ -324,6 +324,8 @@ int runNds (const void* loader, u32 loaderSize, u32 cluster, bool initDisc, bool irqDisable(IRQ_ALL); if (REG_SCFG_EXT != 0 && dsModeSwitch) { + tonccpy((u32*)0x023F4000, (u32*)0x02FF4000, 0x8000); // Relocate data to 4MB RAM area + if (!boostCpu) { REG_SCFG_CLK = 0x80; } @@ -469,7 +471,7 @@ int runUnlaunchDsi (const char* filename, u32 sector) { return runNds (load_bin, load_bin_size, sector, true, false, true, filename, 0, NULL, true, false, false, true, true, false, -1); } -int runNdsFile (const char* filename, int argc, const char** argv, bool dldiPatchNds, bool clearMasterBright, bool dsModeSwitch, bool boostCpu, bool boostVram, bool tscTgds, int language) { +int runNdsFile (const char* filename, int argc, const char** argv, bool isRunFromSD, bool dldiPatchNds, bool clearMasterBright, bool dsModeSwitch, bool boostCpu, bool boostVram, bool tscTgds, int language) { struct stat st; char filePath[PATH_MAX]; int pathLen; @@ -515,7 +517,7 @@ int runNdsFile (const char* filename, int argc, const char** argv, bool dldiPatc bool loadFromRam = runNds9(filename, dsModeSwitch); #ifndef _NO_BOOTSTUB_ - installBootStub(havedsiSD); + installBootStub(havedsiSD, isRunFromSD, dsModeSwitch); #endif return runNds (load_bin, load_bin_size, st.st_ino, true, (dldiPatchNds && memcmp(io_dldi_data->friendlyName, "Default", 7) != 0), loadFromRam, filename, argc, argv, clearMasterBright, dsModeSwitch, lockScfg, boostCpu, boostVram, tscTgds, language); @@ -542,10 +544,7 @@ int runNdsFile (const char* filename, int argc, const char** argv, bool dldiPatc */ #ifndef _NO_BOOTSTUB_ -void installBootStub(bool havedsiSD) { - static bool installed = false; - if (installed) return; - +void installBootStub(const bool havedsiSD, const bool isRunFromSD, const bool dsModeSwitch) { extern char *fake_heap_end; struct __bootstub *bootstub = (struct __bootstub *)fake_heap_end; u32 *bootloader = (u32*)(fake_heap_end+bootstub_bin_size); @@ -553,12 +552,17 @@ void installBootStub(bool havedsiSD) { tonccpy(bootstub,bootstub_bin,bootstub_bin_size); tonccpy(bootloader,load_bin,load_bin_size); - bootloader[8] = isDSiMode(); - if (havedsiSD) { - bootloader[3] = 0; // don't dldi patch - bootloader[7] = 1; // use internal dsi SD code - } - if (memcmp(io_dldi_data->friendlyName, "Default", 7) != 0) { + bootloader[8] = dsModeSwitch ? 0 : isDSiMode(); + if (havedsiSD && !dsModeSwitch) { + if (memcmp(io_dldi_data->friendlyName, "Default", 7) != 0) { + dldiPatchLoader (); + } else { + bootloader[3] = 0; // don't dldi patch + } + if (isRunFromSD) { + bootloader[7] = 1; // use internal dsi SD code + } + } else { dldiPatchLoader (); } bootstub->arm9reboot = (VoidFn)(((u32)bootstub->arm9reboot)+fake_heap_end); @@ -566,7 +570,6 @@ void installBootStub(bool havedsiSD) { bootstub->bootsize = load_bin_size; DC_FlushAll(); - installed = true; } #endif