From 0d7cbe8868d65c317cd2661c1f4b3dddbc76692e Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Thu, 11 Oct 2018 18:07:49 -0600 Subject: [PATCH] Fix for DSi-mode flashcards (CycloDS iEvo) --- arm9/source/driveMenu.cpp | 4 ++-- arm9/source/driveOperations.cpp | 4 +++- arm9/source/driveOperations.h | 1 + arm9/source/main.cpp | 6 ++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arm9/source/driveMenu.cpp b/arm9/source/driveMenu.cpp index 85c305d..89e84d9 100644 --- a/arm9/source/driveMenu.cpp +++ b/arm9/source/driveMenu.cpp @@ -174,7 +174,7 @@ void driveMenu (void) { printf ("[nitro:] NDS GAME IMAGE\n"); printf ("(Game Virtual)"); } - if (isDSiMode()) { + if (isDSiMode() && sdMountedDone) { if (sdMounted) { printf ("\x1b[21;0H"); printf (titleName); @@ -312,7 +312,7 @@ void driveMenu (void) { // Unmount/Remount SD card if ((held & KEY_R) && (pressed & KEY_B)) { dmTextPrinted = false; - if (isDSiMode()) { + if (isDSiMode() && sdMountedDone) { if (sdMounted) { sdUnmount(); } diff --git a/arm9/source/driveOperations.cpp b/arm9/source/driveOperations.cpp index efffafe..bb3d40b 100644 --- a/arm9/source/driveOperations.cpp +++ b/arm9/source/driveOperations.cpp @@ -11,6 +11,7 @@ static sNDSHeader nds; u8 stored_SCFG_MC = 0; bool sdMounted = false; +bool sdMountedDone = false; // true if SD mount is successful once bool flashcardMounted = false; bool nitroMounted = false; @@ -69,6 +70,7 @@ bool bothSDandFlashcard(void) { TWL_CODE bool sdMount(void) { fatMountSimple("sd", get_io_dsisd()); if (sdFound()) { + sdMountedDone = true; fatGetVolumeLabel("sd", sdLabel); fixLabel(false); return true; @@ -198,7 +200,7 @@ bool flashcardMount(void) { fatGetVolumeLabel("fat", fatLabel); fixLabel(true); return true; - } else if (!isDSiMode()) { + } else if (!sdMountedDone) { fatInitDefault(); if (flashcardFound()) { fatGetVolumeLabel("fat", fatLabel); diff --git a/arm9/source/driveOperations.h b/arm9/source/driveOperations.h index 5c9a39f..acc0236 100644 --- a/arm9/source/driveOperations.h +++ b/arm9/source/driveOperations.h @@ -4,6 +4,7 @@ extern u8 stored_SCFG_MC; extern bool sdMounted; +extern bool sdMountedDone; // true if SD mount is successful once extern bool flashcardMounted; extern bool nitroMounted; diff --git a/arm9/source/main.cpp b/arm9/source/main.cpp index ddcef2a..28e35aa 100644 --- a/arm9/source/main.cpp +++ b/arm9/source/main.cpp @@ -133,10 +133,8 @@ int main(int argc, char **argv) { yHeld = true; } sdMounted = sdMount(); - if (access("sd:/Nintendo 3DS", F_OK) != 0) { - is3DS = false; - } - } else { + } + if (!sdMounted || (access("sd:/Nintendo 3DS", F_OK) != 0)) { is3DS = false; } if (!isDSiMode() || !yHeld) {