diff --git a/arm9/source/driveOperations.cpp b/arm9/source/driveOperations.cpp index 9d3bd9d..4b21af0 100644 --- a/arm9/source/driveOperations.cpp +++ b/arm9/source/driveOperations.cpp @@ -11,6 +11,8 @@ static sNDSHeader nds; u8 stored_SCFG_MC = 0; +static bool slot1Enabled = true; + bool sdMounted = false; bool sdMountedDone = false; // true if SD mount is successful once bool flashcardMounted = false; @@ -137,10 +139,23 @@ TWL_CODE bool twl_flashcardMount(void) { sysSetCardOwner (BUS_OWNER_ARM9); // Reset Slot-1 to allow reading title name and ID - disableSlot1(); - for(int i = 0; i < 25; i++) { swiWaitForVBlank(); } - enableSlot1(); - for(int i = 0; i < 15; i++) { swiWaitForVBlank(); } + if (slot1Enabled) { + disableSlot1(); + for(int i = 0; i < 25; i++) { swiWaitForVBlank(); } + slot1Enabled = false; + } + if (appInited) { + for(int i = 0; i < 35; i++) { swiWaitForVBlank(); } // Make sure cart is inserted correctly + } + if (REG_SCFG_MC == 0x11) { + sysSetCardOwner (BUS_OWNER_ARM7); + return false; + } + if (!slot1Enabled) { + enableSlot1(); + for(int i = 0; i < 15; i++) { swiWaitForVBlank(); } + slot1Enabled = true; + } nds.gameCode[0] = 0; nds.gameTitle[0] = 0; diff --git a/arm9/source/main.cpp b/arm9/source/main.cpp index 4658629..ed196b6 100644 --- a/arm9/source/main.cpp +++ b/arm9/source/main.cpp @@ -40,6 +40,8 @@ char titleName[32] = {" "}; int screenMode = 0; +bool appInited = false; + bool arm7SCFGLocked = false; bool isRegularDS = true; bool is3DS = true; @@ -150,6 +152,8 @@ int main(int argc, char **argv) { keysSetRepeat(25,5); + appInited = true; + while(1) { if (screenMode == 0) { diff --git a/arm9/source/main.h b/arm9/source/main.h index 2a4a8b4..0c09503 100644 --- a/arm9/source/main.h +++ b/arm9/source/main.h @@ -8,6 +8,8 @@ extern char titleName[32]; extern int screenMode; +extern bool appInited; + extern bool arm7SCFGLocked; extern bool isRegularDS; extern bool is3DS;