From 59c970d540006262464904f4801b4463a4966f2a Mon Sep 17 00:00:00 2001 From: lifehackerhansol Date: Sun, 29 Sep 2024 01:10:10 -0700 Subject: [PATCH] treewide: simplify M3 DLDI detection A new M3 DLDI uses `M3DS Real` as its name, which doesn't match the others currently listed. Shrink the memcmp to `M3DS` specifically to get around the problem. Resolves #2391, resolves #2473 --- archived/rungame/arm9/source/main.cpp | 2 +- quickmenu/arm9/source/main.cpp | 2 +- romsel_aktheme/arm9/source/main.cpp | 2 +- romsel_dsimenutheme/arm9/source/main.cpp | 2 +- romsel_r4theme/arm9/source/main.cpp | 2 +- title/arm9/source/main.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/archived/rungame/arm9/source/main.cpp b/archived/rungame/arm9/source/main.cpp index 3469dd0bed..06843630eb 100644 --- a/archived/rungame/arm9/source/main.cpp +++ b/archived/rungame/arm9/source/main.cpp @@ -359,7 +359,7 @@ int lastRunROM() { || (memcmp(io_dldi_data->friendlyName, "DSTT", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "DEMON", 5) == 0) || (memcmp(io_dldi_data->friendlyName, "DSONE", 5) == 0) - || (memcmp(io_dldi_data->friendlyName, "M3DS DLDI", 9) == 0) + || (memcmp(io_dldi_data->friendlyName, "M3DS", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "M3-DS", 5) == 0)) { CIniFile fcrompathini("fat:/TTMenu/YSMenu.ini"); path = ReplaceAll(ms().romPath[1], "fat:/", slashchar); diff --git a/quickmenu/arm9/source/main.cpp b/quickmenu/arm9/source/main.cpp index 395c6a8624..3fbf3318dd 100644 --- a/quickmenu/arm9/source/main.cpp +++ b/quickmenu/arm9/source/main.cpp @@ -819,7 +819,7 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { || (memcmp(io_dldi_data->friendlyName, "DSTT", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "DEMON", 5) == 0) || (memcmp(io_dldi_data->friendlyName, "DSONE", 5) == 0) - || (memcmp(io_dldi_data->friendlyName, "M3DS DLDI", 9) == 0) + || (memcmp(io_dldi_data->friendlyName, "M3DS", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "M3-DS", 5) == 0)) { CIniFile fcrompathini("fat:/TTMenu/YSMenu.ini"); fcPath = replaceAll(ndsPath, "fat:/", slashchar); diff --git a/romsel_aktheme/arm9/source/main.cpp b/romsel_aktheme/arm9/source/main.cpp index 94fb483377..71258ddc6b 100644 --- a/romsel_aktheme/arm9/source/main.cpp +++ b/romsel_aktheme/arm9/source/main.cpp @@ -821,7 +821,7 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { || (memcmp(io_dldi_data->friendlyName, "DSTT", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "DEMON", 5) == 0) || (memcmp(io_dldi_data->friendlyName, "DSONE", 5) == 0) - || (memcmp(io_dldi_data->friendlyName, "M3DS DLDI", 9) == 0) + || (memcmp(io_dldi_data->friendlyName, "M3DS", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "M3-DS", 5) == 0)) { CIniFile fcrompathini("fat:/TTMenu/YSMenu.ini"); fcPath = replaceAll(ndsPath, "fat:/", slashchar); diff --git a/romsel_dsimenutheme/arm9/source/main.cpp b/romsel_dsimenutheme/arm9/source/main.cpp index ceb83ac817..996af9da16 100644 --- a/romsel_dsimenutheme/arm9/source/main.cpp +++ b/romsel_dsimenutheme/arm9/source/main.cpp @@ -710,7 +710,7 @@ void loadGameOnFlashcard(const char *ndsPath, bool dsGame) { || (memcmp(io_dldi_data->friendlyName, "DSTT", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "DEMON", 5) == 0) || (memcmp(io_dldi_data->friendlyName, "DSONE", 5) == 0) - || (memcmp(io_dldi_data->friendlyName, "M3DS DLDI", 9) == 0) + || (memcmp(io_dldi_data->friendlyName, "M3DS", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "M3-DS", 5) == 0)) { CIniFile fcrompathini("fat:/TTMenu/YSMenu.ini"); fcPath = replaceAll(ndsPath, "fat:/", slashchar); diff --git a/romsel_r4theme/arm9/source/main.cpp b/romsel_r4theme/arm9/source/main.cpp index 17efe86fc0..a9ff0b239d 100644 --- a/romsel_r4theme/arm9/source/main.cpp +++ b/romsel_r4theme/arm9/source/main.cpp @@ -788,7 +788,7 @@ void loadGameOnFlashcard(const char* ndsPath, bool dsGame) { || (memcmp(io_dldi_data->friendlyName, "DSTT", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "DEMON", 5) == 0) || (memcmp(io_dldi_data->friendlyName, "DSONE", 5) == 0) - || (memcmp(io_dldi_data->friendlyName, "M3DS DLDI", 9) == 0) + || (memcmp(io_dldi_data->friendlyName, "M3DS", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "M3-DS", 5) == 0)) { CIniFile fcrompathini("fat:/TTMenu/YSMenu.ini"); fcPath = replaceAll(ndsPath, "fat:/", slashchar); diff --git a/title/arm9/source/main.cpp b/title/arm9/source/main.cpp index 80a6abf1a8..c9c65ad736 100644 --- a/title/arm9/source/main.cpp +++ b/title/arm9/source/main.cpp @@ -693,7 +693,7 @@ void lastRunROM() || (memcmp(io_dldi_data->friendlyName, "DSTT", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "DEMON", 5) == 0) || (memcmp(io_dldi_data->friendlyName, "DSONE", 5) == 0) - || (memcmp(io_dldi_data->friendlyName, "M3DS DLDI", 9) == 0) + || (memcmp(io_dldi_data->friendlyName, "M3DS", 4) == 0) || (memcmp(io_dldi_data->friendlyName, "M3-DS", 5) == 0)) { CIniFile fcrompathini("fat:/TTMenu/YSMenu.ini"); fcPath = replaceAll(ms().romPath[ms().previousUsedDevice], "fat:/", slashchar);