From 999241b0a0775a1aad70d21515b5dcf101df31d1 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Fri, 21 Feb 2020 02:22:59 -0700 Subject: [PATCH] Add Nitro/IMG unmounting --- arm9/source/driveMenu.cpp | 18 ++++++++++++++++++ arm9/source/driveOperations.cpp | 5 +++++ arm9/source/driveOperations.h | 1 + arm9/source/main.h | 1 + 4 files changed, 25 insertions(+) diff --git a/arm9/source/driveMenu.cpp b/arm9/source/driveMenu.cpp index db48859..05c6dc0 100644 --- a/arm9/source/driveMenu.cpp +++ b/arm9/source/driveMenu.cpp @@ -165,6 +165,10 @@ void dm_drawBottomScreen(void) { printf ("\x1B[47m"); // Print foreground white color printf ("\x1b[23;0H"); printf (titleName); + if (nitroMounted || imgMounted) { + printf ("\n"); + printf (IMAGETEXT); + } if (isDSiMode() && sdMountedDone) { if (isRegularDS || sdMounted) { printf ("\n"); @@ -409,6 +413,20 @@ void driveMenu (void) { } } + // Unmount/Remount FAT image + if ((held & KEY_R) && (pressed & KEY_X)) { + dmTextPrinted = false; + if (nitroMounted) { + currentDrive = 5; + chdir("nitro:/"); + nitroUnmount(); + } else if (imgMounted) { + currentDrive = 6; + chdir("img:/"); + imgUnmount(); + } + } + // Unmount/Remount SD card if ((held & KEY_R) && (pressed & KEY_B)) { dmTextPrinted = false; diff --git a/arm9/source/driveOperations.cpp b/arm9/source/driveOperations.cpp index c4054f2..61087e8 100644 --- a/arm9/source/driveOperations.cpp +++ b/arm9/source/driveOperations.cpp @@ -344,6 +344,11 @@ TWL_CODE void ramdrive2Mount(void) { ramdrive2Mounted = (access("ram2:/", F_OK) == 0); } +void nitroUnmount(void) { + fatUnmount("nitro"); + nitroMounted = false; +} + bool imgMount(const char* imgName) { extern const char* currentImgName; diff --git a/arm9/source/driveOperations.h b/arm9/source/driveOperations.h index 487a007..11cd0e2 100644 --- a/arm9/source/driveOperations.h +++ b/arm9/source/driveOperations.h @@ -41,6 +41,7 @@ extern bool flashcardMount(void); extern void flashcardUnmount(void); extern void ramdrive1Mount(void); extern void ramdrive2Mount(void); +extern void nitroUnmount(void); extern bool imgMount(const char* imgName); extern void imgUnmount(void); diff --git a/arm9/source/main.h b/arm9/source/main.h index 82a44b4..094ddc5 100644 --- a/arm9/source/main.h +++ b/arm9/source/main.h @@ -5,6 +5,7 @@ #define POWERTEXT "POWER - Reboot/[+held] Poweroff" #define POWERTEXT_3DS "POWER - Sleep Mode screen" #define HOMETEXT "HOME - HOME Menu prompt" +#define IMAGETEXT "R+X - Unmount image" #define SCREENSHOTTEXT "R+L - Make a screenshot" extern char titleName[32];