From c7fefecdcc2b097314ccff3f62c8f88436d50de8 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Sun, 2 Jan 2022 23:16:20 -0700 Subject: [PATCH] Do not read NDS cart info if Slot-1 flashcard is mounted Fixes lockup when highlighting Slot-1 FAT --- arm9/source/driveMenu.cpp | 2 +- arm9/source/dumpOperations.cpp | 26 +++++++++++++++++++++++++ arm9/source/language.inl | 1 + nitrofiles/languages/en-US/language.ini | 1 + 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/arm9/source/driveMenu.cpp b/arm9/source/driveMenu.cpp index e54c8ee..5f17a42 100644 --- a/arm9/source/driveMenu.cpp +++ b/arm9/source/driveMenu.cpp @@ -236,7 +236,7 @@ void driveMenu (void) { if ((io_dldi_data->ioInterface.features & FEATURE_SLOT_GBA) || (isDSiMode() && !arm7SCFGLocked && !(REG_SCFG_MC & BIT(0)))) { dmOperations.push_back(DriveMenuOperation::ndsCard); - if(romTitle[0] == 0) { + if(romTitle[0] == 0 && ((io_dldi_data->ioInterface.features & FEATURE_SLOT_GBA) || !flashcardMounted)) { sNDSHeaderExt ndsHeader; cardInit(&ndsHeader); tonccpy(romTitle, ndsHeader.gameTitle, 12); diff --git a/arm9/source/dumpOperations.cpp b/arm9/source/dumpOperations.cpp index 079cabd..01a0bac 100644 --- a/arm9/source/dumpOperations.cpp +++ b/arm9/source/dumpOperations.cpp @@ -530,7 +530,33 @@ void ndsCardSaveRestore(const char *filename) { } void ndsCardDump(void) { + u16 pressed; + font->clear(false); + if ((io_dldi_data->ioInterface.features & FEATURE_SLOT_NDS) && flashcardMounted) { + font->print(0, 0, false, STR_FLASHCARD_WILL_UNMOUNT); + font->print(0, 3, false, STR_A_YES_B_NO); + font->update(false); + + while (true) { + // Print time + font->print(-1, 0, true, RetTime(), Alignment::right, Palette::blackGreen); + font->update(true); + + scanKeys(); + pressed = keysDownRepeat(); + swiWaitForVBlank(); + if (pressed & KEY_A) { + font->clear(false); + flashcardUnmount(); + break; + } + if (pressed & KEY_B) { + return; + } + } + } + font->print(0, 0, false, STR_LOADING); font->update(false); diff --git a/arm9/source/language.inl b/arm9/source/language.inl index 0035697..9a4de49 100644 --- a/arm9/source/language.inl +++ b/arm9/source/language.inl @@ -127,6 +127,7 @@ STRING(PRESS_B_TO_CANCEL, "Press \\B to cancel") STRING(EOF_NO_RESULTS, "Reached end of file\nwith no results") // Dumping +STRING(FLASHCARD_WILL_UNMOUNT, "Flashcard will be unmounted.\nIs this okay?") STRING(DUMP_TO, "Dump \"%s\" to\n\"%s:/gm9i/out\"?") STRING(DUMP_ALL, "All") STRING(DUMP_ALL_TRIMMED, "All (Trimmed ROM)") diff --git a/nitrofiles/languages/en-US/language.ini b/nitrofiles/languages/en-US/language.ini index 44e0fed..4ca0314 100644 --- a/nitrofiles/languages/en-US/language.ini +++ b/nitrofiles/languages/en-US/language.ini @@ -119,6 +119,7 @@ SEARCHING=Searching PRESS_B_TO_CANCEL=Press \B to cancel EOF_NO_RESULTS=Reached end of file\nwith no results +FLASHCARD_WILL_UNMOUNT=Flashcard will be unmounted.\nIs this okay? DUMP_TO=Dump "%s" to\n"%s:/gm9i/out"? DUMP_ALL=All DUMP_ALL_TRIMMED=All (Trimmed ROM)