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

View File

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

View File

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

View File

@ -531,7 +531,10 @@ void cMainWnd::setParam(void) {
_values.push_back(LANG("switches", "Enable"));
settingWnd.addSettingItem(LANG("file settings", "show hidden files"), _values,
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.push_back(".nds.sav");
_values.push_back(".sav");
@ -594,7 +597,7 @@ void cMainWnd::setParam(void) {
// page 3: filesystem
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().saveDir = settingWnd.getItemSelection(2, 3);