From 8a9af4988230467ecf69554230c56c06a9c1cd49 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Sun, 7 Oct 2018 15:32:24 -0600 Subject: [PATCH] Bug fix: Do not run GBA-related code in DSi mode --- arm9/source/driveMenu.cpp | 20 ++++++++++++++------ arm9/source/main.cpp | 9 +++++++-- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/arm9/source/driveMenu.cpp b/arm9/source/driveMenu.cpp index d137d04..fef7547 100644 --- a/arm9/source/driveMenu.cpp +++ b/arm9/source/driveMenu.cpp @@ -133,7 +133,9 @@ void driveMenu (void) { flashcardMountRan = false; } - gbaFixedValue = *(u8*)(0x080000B2); + if (!isDSiMode() && isRegularDS) { + gbaFixedValue = *(u8*)(0x080000B2); + } if (!dmTextPrinted) { consoleInit(NULL, 1, BgType_Text4bpp, BgSize_T_256x256, 15, 0, false, true); @@ -216,11 +218,17 @@ void driveMenu (void) { pressed = keysDownRepeat(); held = keysHeld(); swiWaitForVBlank(); - - if ((REG_SCFG_MC != stored_SCFG_MC) - || (*(u8*)(0x080000B2) != gbaFixedValue)) { - dmTextPrinted = false; - break; + + if (!isDSiMode() && isRegularDS) { + if (*(u8*)(0x080000B2) != gbaFixedValue) { + dmTextPrinted = false; + break; + } + } else if (isDSiMode()) { + if (REG_SCFG_MC != stored_SCFG_MC) { + dmTextPrinted = false; + break; + } } } while (!(pressed & KEY_UP) && !(pressed & KEY_DOWN) && !(pressed & KEY_A) && !(held & KEY_R)); diff --git a/arm9/source/main.cpp b/arm9/source/main.cpp index 549db0a..ef5827e 100644 --- a/arm9/source/main.cpp +++ b/arm9/source/main.cpp @@ -70,6 +70,8 @@ int main(int argc, char **argv) { int pathLen; std::string filename; + + bool yHeld = false; snprintf(titleName, sizeof(titleName), "GodMode9i v%i.%i.%i", 1, 1, 0); @@ -125,10 +127,13 @@ int main(int argc, char **argv) { sysSetCartOwner (BUS_OWNER_ARM9); // Allow arm9 to access GBA ROM if (isDSiMode()) { + scanKeys(); + if (keysHeld() & KEY_Y) { + yHeld = true; + } sdMounted = sdMount(); } - scanKeys(); - if (!isDSiMode() || !(keysHeld() & KEY_Y)) { + if (!isDSiMode() || !yHeld) { flashcardMounted = flashcardMount(); flashcardMountSkipped = false; }