diff --git a/source/fs/fsutil.c b/source/fs/fsutil.c index 6a2a180..ff8707d 100644 --- a/source/fs/fsutil.c +++ b/source/fs/fsutil.c @@ -24,7 +24,7 @@ uint64_t GetSDCardSize() { return (u64) getMMCDevice(1)->total_size * 512; } -bool FormatSDCard(u64 hidden_mb, u32 cluster_size) { +bool FormatSDCard(u64 hidden_mb, u32 cluster_size, const char* label) { u8 mbr[0x200] = { 0 }; u8 mbrdata[0x42] = { 0x80, 0x01, 0x01, 0x00, 0x0C, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -70,7 +70,7 @@ bool FormatSDCard(u64 hidden_mb, u32 cluster_size) { // format the SD card InitSDCardFS(); UINT c_size = cluster_size; - bool ret = (f_mkfs("0:", FM_FAT32, c_size, MAIN_BUFFER, MAIN_BUFFER_SIZE) == FR_OK) && (f_setlabel("0:GM9SD") == FR_OK); + bool ret = (f_mkfs("0:", FM_FAT32, c_size, MAIN_BUFFER, MAIN_BUFFER_SIZE) == FR_OK) && (f_setlabel((label) ? label : "0:GM9SD") == FR_OK); DeinitSDCardFS(); return ret; diff --git a/source/fs/fsutil.h b/source/fs/fsutil.h index a027e83..6755a08 100644 --- a/source/fs/fsutil.h +++ b/source/fs/fsutil.h @@ -15,7 +15,7 @@ uint64_t GetSDCardSize(); /** Format the SD card **/ -bool FormatSDCard(u64 hidden_mb, u32 cluster_size); +bool FormatSDCard(u64 hidden_mb, u32 cluster_size, const char* label); /** Check for file lock, offer to unlock if possible **/ bool FileUnlock(const char* path); diff --git a/source/godmode.c b/source/godmode.c index addb51c..ffd6e3e 100644 --- a/source/godmode.c +++ b/source/godmode.c @@ -199,7 +199,8 @@ u32 SdFormatMenu(void) { const u32 emunand_size_table[6] = { 0x0, 0x0, 0x3AF, 0x4D8, 0x3FF, 0x7FF }; const u32 cluster_size_table[5] = { 0x0, 0x0, 0x4000, 0x8000, 0x10000 }; const char* option_emunand_size[6] = { "No EmuNAND", "O3DS NAND size", "N3DS NAND size", "1GB (legacy size)", "2GB (legacy size)", "User input..." }; - const char* option_cluster_size[4] = { "Auto", "16KB Clusters", "32KB Clusters", "64KB Clusters" }; + const char* option_cluster_size[4] = { "Auto", "16KB Clusters", "32KB Clusters", "64KB Clusters" }; + char label[16] = "0:GM9SD"; u32 cluster_size = 0; u64 sdcard_size_mb = 0; u64 emunand_size_mb = (u64) -1; @@ -225,7 +226,10 @@ u32 SdFormatMenu(void) { if (!user_select) return 1; else cluster_size = cluster_size_table[user_select]; - if (!FormatSDCard(emunand_size_mb, cluster_size)) { + if (!ShowStringPrompt(label + 2, 9, "Format SD card (%lluMB)?\nEnter label:", sdcard_size_mb)) + return 1; + + if (!FormatSDCard(emunand_size_mb, cluster_size, label)) { ShowPrompt(false, "Format SD: failed!"); return 1; }