nds-bootstrap version switch

nds-bootstrap version switch
- Allow user to switch between release or nightly version in settings (will show an error upon loading a game if the loader is missing)
This commit is contained in:
Kei 2025-01-27 18:55:02 +00:00
parent 30856a9c2a
commit 307d11777a
4 changed files with 31 additions and 13 deletions

View File

@ -39,6 +39,7 @@ cGlobalSettings::cGlobalSettings() {
slot2mode = ESlot2Ask; slot2mode = ESlot2Ask;
saveExt = true; saveExt = true;
saveDir = false; saveDir = false;
nightly = false;
safeMode = false; safeMode = false;
show12hrClock = false; show12hrClock = false;
autorunWithLastRom = false; autorunWithLastRom = false;
@ -68,6 +69,7 @@ void cGlobalSettings::loadSettings() {
cheats = ini.GetInt("system", "cheats", cheats); cheats = ini.GetInt("system", "cheats", cheats);
softreset = ini.GetInt("system", "softreset", softreset); softreset = ini.GetInt("system", "softreset", softreset);
saveDir = ini.GetInt("system", "savedir", saveDir); saveDir = ini.GetInt("system", "savedir", saveDir);
nightly = ini.GetInt("system", "nightly", nightly);
dma = ini.GetInt("system", "dma", dma); dma = ini.GetInt("system", "dma", dma);
sdsave = ini.GetInt("system", "sdsave", sdsave); sdsave = ini.GetInt("system", "sdsave", sdsave);
safeMode = ini.GetInt("system", "safemode", safeMode); safeMode = ini.GetInt("system", "safemode", safeMode);
@ -120,6 +122,7 @@ void cGlobalSettings::saveSettings() {
ini.SetInt("system", "sdsave", sdsave); ini.SetInt("system", "sdsave", sdsave);
ini.SetInt("system", "safemode", safeMode); ini.SetInt("system", "safemode", safeMode);
ini.SetInt("system", "savedir", saveDir); ini.SetInt("system", "savedir", saveDir);
ini.SetInt("system", "nightly", nightly);
ini.SetInt("system", "Show12hrClock", show12hrClock); ini.SetInt("system", "Show12hrClock", show12hrClock);
ini.SetInt("system", "homebrewreset", homebrewreset); ini.SetInt("system", "homebrewreset", homebrewreset);

View File

@ -59,6 +59,7 @@ class cGlobalSettings {
int slot2mode; int slot2mode;
bool saveExt; bool saveExt;
bool saveDir; bool saveDir;
bool nightly;
bool safeMode; bool safeMode;
bool show12hrClock; bool show12hrClock;
bool autorunWithLastRom; bool autorunWithLastRom;

View File

@ -78,19 +78,31 @@ bool NdsBootstrapLauncher::launchRom(std::string romPath, std::string savePath,
u32 cheatOffset, u32 cheatSize) { u32 cheatOffset, u32 cheatSize) {
const char ndsBootstrapPath[] = SD_ROOT_0 "/_nds/nds-bootstrap-release.nds"; const char ndsBootstrapPath[] = SD_ROOT_0 "/_nds/nds-bootstrap-release.nds";
const char ndsBootstrapPathNightly[] = SD_ROOT_0 "/_nds/nds-bootstrap-nightly.nds"; const char ndsBootstrapPathNightly[] = SD_ROOT_0 "/_nds/nds-bootstrap-nightly.nds";
bool useNightly = false;
progressWnd().setTipText("Initializing nds-bootstrap..."); progressWnd().setTipText("Initializing nds-bootstrap...");
progressWnd().show(); progressWnd().show();
progressWnd().setPercent(0); progressWnd().setPercent(0);
if (access(ndsBootstrapPath, F_OK) != 0) { //Check which nds-bootstrap version has been selected
progressWnd().hide(); if(gs().nightly){
printLoaderNotFound(ndsBootstrapPath); if(access(ndsBootstrapPathNightly, F_OK) != 0){
return false; progressWnd().hide();
printLoaderNotFound(ndsBootstrapPathNightly);
return false;
}
else{
useNightly = true;
}
} }
else if(access("/_nds/nightly.txt", F_OK) == 0 && access(ndsBootstrapPathNightly, F_OK) != 0){ else{
progressWnd().hide(); if(access(ndsBootstrapPath, F_OK) != 0){
printLoaderNotFound(ndsBootstrapPathNightly); progressWnd().hide();
return false; printLoaderNotFound(ndsBootstrapPath);
return false;
}
else{
useNightly = false;
}
} }
std::vector<const char*> argv; std::vector<const char*> argv;
@ -105,12 +117,11 @@ bool NdsBootstrapLauncher::launchRom(std::string romPath, std::string savePath,
} }
progressWnd().setPercent(25); progressWnd().setPercent(25);
// Setup argv to launch nds-bootstrap // Setup argv to launch nds-bootstrap
if(access("/_nds/nightly.txt", F_OK) != 0) { if(!useNightly){
argv.push_back(ndsBootstrapPath); argv.push_back(ndsBootstrapPath);
} }
else{ else{
//Debug use
argv.push_back(ndsBootstrapPathNightly); argv.push_back(ndsBootstrapPathNightly);
} }

View File

@ -531,7 +531,10 @@ void cMainWnd::setParam(void) {
_values.push_back(LANG("switches", "Enable")); _values.push_back(LANG("switches", "Enable"));
settingWnd.addSettingItem(LANG("file settings", "show hidden files"), _values, settingWnd.addSettingItem(LANG("file settings", "show hidden files"), _values,
gs().showHiddenFiles); gs().showHiddenFiles);
settingWnd.addSettingItem(LANG("rom trim", "text"), _values, gs().romTrim); _values.clear();
_values.push_back("release");
_values.push_back("nightly");
settingWnd.addSettingItem(LANG("nds bootstrap", "text"), _values, gs().nightly);
_values.clear(); _values.clear();
_values.push_back(".nds.sav"); _values.push_back(".nds.sav");
_values.push_back(".sav"); _values.push_back(".sav");
@ -594,7 +597,7 @@ void cMainWnd::setParam(void) {
// page 3: filesystem // page 3: filesystem
gs().showHiddenFiles = settingWnd.getItemSelection(2, 0); gs().showHiddenFiles = settingWnd.getItemSelection(2, 0);
gs().romTrim = settingWnd.getItemSelection(2, 1); gs().nightly = settingWnd.getItemSelection(2, 1);
gs().saveExt = settingWnd.getItemSelection(2, 2); gs().saveExt = settingWnd.getItemSelection(2, 2);
gs().saveDir = settingWnd.getItemSelection(2, 3); gs().saveDir = settingWnd.getItemSelection(2, 3);