TopToyLauncher: simplify ifdefs for loader path, error if not found

This commit is contained in:
lifehackerhansol 2024-11-03 10:43:54 -08:00
parent fcdca80478
commit 179c309b19
No known key found for this signature in database
GPG Key ID: 80FB184AFC0B3B0E

View File

@ -158,12 +158,18 @@ bool TopToyLauncher::prepareTTSYS(void) {
bool TopToyLauncher::launchRom(std::string romPath, std::string savePath, u32 flags, bool TopToyLauncher::launchRom(std::string romPath, std::string savePath, u32 flags,
u32 cheatOffset, u32 cheatSize) { u32 cheatOffset, u32 cheatSize) {
std::string loaderPath =
#ifdef __TTLAUNCHER_M3__ #ifdef __TTLAUNCHER_M3__
if (access("fat:/TTMenu/m3patch.dat", F_OK) != 0) "fat:/TTMenu/m3patch.dat"
#else #else // __TTLAUNCHER_M3__
if (access("fat:/TTMenu/ttpatch.dat", F_OK) != 0) "fat:/TTMenu/ttpatch.dat"
#endif #endif // __TTLAUNCHER_M3__
;
if (access(loaderPath.c_str(), F_OK) != 0) {
printLoaderNotFound(loaderPath);
return false; return false;
}
mRomPath = romPath; mRomPath = romPath;
mSavePath = savePath; mSavePath = savePath;
@ -192,11 +198,7 @@ bool TopToyLauncher::launchRom(std::string romPath, std::string savePath, u32 fl
// Setup TTMenu system parameters // Setup TTMenu system parameters
if (!prepareTTSYS()) return false; if (!prepareTTSYS()) return false;
#ifdef __TTLAUNCHER_M3__ FILE* loader = fopen(loaderPath.c_str(), "rb");
FILE* loader = fopen("fat:/TTMenu/m3patch.dat", "rb");
#else
FILE* loader = fopen("fat:/TTMenu/ttpatch.dat", "rb");
#endif
tNDSHeader* header = (tNDSHeader*)malloc(sizeof(tNDSHeader)); tNDSHeader* header = (tNDSHeader*)malloc(sizeof(tNDSHeader));
u8* loader_arm7 = NULL; u8* loader_arm7 = NULL;
fseek(loader, 0, SEEK_SET); fseek(loader, 0, SEEK_SET);