Skip to content

Commit

Permalink
Add support for /roms/snes/ path in SNEmulDS legacy build on flashc…
Browse files Browse the repository at this point in the history
…ards
  • Loading branch information
RocketRobz committed Oct 6, 2024
1 parent bcc319f commit 1e75c24
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 18 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion 7zfile/snemul.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Those settings are default and overriden by games' settings

# ROM Directory
ROMPath = /roms/snes
ROMPath = snes

# SPC Directory
SPCPath = spc
Expand Down
7 changes: 4 additions & 3 deletions quickmenu/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3297,7 +3297,7 @@ int dsClassicMenu(void) {
bootstrapini.SaveIniFile(BOOTSTRAP_INI);
}
} else if (extension(filename[ms().secondaryDevice], {".smc", ".sfc"})) {
ms().launchType[ms().secondaryDevice] = (ms().newSnesEmuVer ? TWLSettings::ESNEmulDSLaunch : TWLSettings::ESDFlashcardLaunch);
ms().launchType[ms().secondaryDevice] = ((ms().newSnesEmuVer || ms().secondaryDevice) ? TWLSettings::ESNEmulDSLaunch : TWLSettings::ESDFlashcardLaunch);
if (ms().newSnesEmuVer) {
tgdsMode = true;
tscTgds = true;
Expand All @@ -3312,9 +3312,10 @@ int dsClassicMenu(void) {
}
}
} else if (ms().secondaryDevice) {
ndsToBoot = "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
const bool twlmPath = (romfolderNoSlash == "fat:/roms/snes");
ndsToBoot = twlmPath ? "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy-twlm-path.nds" : "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
if (!isDSiMode() || access(ndsToBoot, F_OK) != 0) {
ndsToBoot = "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
ndsToBoot = twlmPath ? "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy-twlm-path.nds" : "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
}
boostCpu = false;
dsModeSwitch = true;
Expand Down
7 changes: 4 additions & 3 deletions romsel_aktheme/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2375,7 +2375,7 @@ int akTheme(void) {
bootstrapini.SaveIniFile(BOOTSTRAP_INI);
}
} else if (extension(filename, {".smc", ".sfc"})) {
ms().launchType[ms().secondaryDevice] = (ms().newSnesEmuVer ? TWLSettings::ESNEmulDSLaunch : TWLSettings::ESDFlashcardLaunch);
ms().launchType[ms().secondaryDevice] = ((ms().newSnesEmuVer || ms().secondaryDevice) ? TWLSettings::ESNEmulDSLaunch : TWLSettings::ESDFlashcardLaunch);
if (ms().newSnesEmuVer) {
tgdsMode = true;
tscTgds = true;
Expand All @@ -2390,9 +2390,10 @@ int akTheme(void) {
}
}
} else if (ms().secondaryDevice) {
ndsToBoot = "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
const bool twlmPath = (romfolderNoSlash == "fat:/roms/snes");
ndsToBoot = twlmPath ? "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy-twlm-path.nds" : "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
if (!isDSiMode() || access(ndsToBoot, F_OK) != 0) {
ndsToBoot = "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
ndsToBoot = twlmPath ? "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy-twlm-path.nds" : "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
}
boostCpu = false;
dsModeSwitch = true;
Expand Down
7 changes: 4 additions & 3 deletions romsel_dsimenutheme/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2410,7 +2410,7 @@ int dsiMenuTheme(void) {
bootstrapini.SaveIniFile(BOOTSTRAP_INI);
}
} else if (extension(filename, {".smc", ".sfc"})) {
ms().launchType[ms().secondaryDevice] = (ms().newSnesEmuVer ? Launch::ESNEmulDSLaunch : Launch::ESDFlashcardLaunch);
ms().launchType[ms().secondaryDevice] = ((ms().newSnesEmuVer || ms().secondaryDevice) ? Launch::ESNEmulDSLaunch : Launch::ESDFlashcardLaunch);
if (ms().newSnesEmuVer) {
tgdsMode = true;
tscTgds = true;
Expand All @@ -2425,9 +2425,10 @@ int dsiMenuTheme(void) {
}
}
} else if (ms().secondaryDevice) {
ndsToBoot = "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
const bool twlmPath = (romfolderNoSlash == "fat:/roms/snes");
ndsToBoot = twlmPath ? "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy-twlm-path.nds" : "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
if (!isDSiMode() || access(ndsToBoot, F_OK) != 0) {
ndsToBoot = "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
ndsToBoot = twlmPath ? "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy-twlm-path.nds" : "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
}
boostCpu = false;
dsModeSwitch = true;
Expand Down
7 changes: 4 additions & 3 deletions romsel_r4theme/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2518,7 +2518,7 @@ int r4Theme(void) {
bootstrapini.SaveIniFile(BOOTSTRAP_INI);
}
} else if (extension(filename, {".smc", ".sfc"})) {
ms().launchType[ms().secondaryDevice] = (ms().newSnesEmuVer ? TWLSettings::ESNEmulDSLaunch : TWLSettings::ESDFlashcardLaunch);
ms().launchType[ms().secondaryDevice] = ((ms().newSnesEmuVer || ms().secondaryDevice) ? TWLSettings::ESNEmulDSLaunch : TWLSettings::ESDFlashcardLaunch);
if (ms().newSnesEmuVer) {
tgdsMode = true;
tscTgds = true;
Expand All @@ -2533,9 +2533,10 @@ int r4Theme(void) {
}
}
} else if (ms().secondaryDevice) {
ndsToBoot = "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
const bool twlmPath = (romfolderNoSlash == "fat:/roms/snes");
ndsToBoot = twlmPath ? "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy-twlm-path.nds" : "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
if (!isDSiMode() || access(ndsToBoot, F_OK) != 0) {
ndsToBoot = "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
ndsToBoot = twlmPath ? "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy-twlm-path.nds" : "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
}
boostCpu = false;
dsModeSwitch = true;
Expand Down
23 changes: 18 additions & 5 deletions title/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,12 +1274,25 @@ void lastRunROM()
} 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++

const char* ndsToBoot = (char*)"sd:/_nds/TWiLightMenu/emulators/SNEmulDS.srl";
if (!isDSiMode() || access(ndsToBoot, F_OK) != 0) {
ndsToBoot = (char*)"fat:/_nds/TWiLightMenu/emulators/SNEmulDS.nds";
const char* ndsToBoot;
if (ms().newSnesEmuVer) {
const char* ndsToBoot = (char*)"sd:/_nds/TWiLightMenu/emulators/SNEmulDS.srl";
if (!isDSiMode() || access(ndsToBoot, F_OK) != 0) {
ndsToBoot = (char*)"fat:/_nds/TWiLightMenu/emulators/SNEmulDS.nds";
}
argarray.at(0) = (char*)"fat:/SNEmulDS.srl";
} else {
std::string romFolderNoSlash = romfolder;
RemoveTrailingSlashes(romFolderNoSlash);

const bool twlmPath = (romFolderNoSlash == "fat:/roms/snes");
ndsToBoot = twlmPath ? "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy-twlm-path.nds" : "sd:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
if (!isDSiMode() || access(ndsToBoot, F_OK) != 0) {
ndsToBoot = twlmPath ? "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy-twlm-path.nds" : "fat:/_nds/TWiLightMenu/emulators/SNEmulDS-legacy.nds";
}
argarray.at(0) = (char*)ndsToBoot;
}
argarray.at(0) = (char*)"fat:/SNEmulDS.srl";
err = runNdsFile(ndsToBoot, argarray.size(), (const char **)&argarray[0], true, true, false, true, true, true, -1); // Pass ROM to SNEmulDS as argument
err = runNdsFile(ndsToBoot, argarray.size(), (const char **)&argarray[0], 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++

Expand Down

0 comments on commit 1e75c24

Please sign in to comment.