mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
parent
8c121ae1d3
commit
7bdc153ca2
@ -71,11 +71,19 @@ void SetFSSearch(const char* pattern, const char* path, bool mode) {
|
|||||||
} else *search_pattern = *search_path = '\0';
|
} else *search_pattern = *search_path = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GetFATVolumeLabel(const char* drv, char* label) {
|
||||||
|
return (f_getlabel(drv, label, NULL) == FR_OK);
|
||||||
|
}
|
||||||
|
|
||||||
bool GetRootDirContentsWorker(DirStruct* contents) {
|
bool GetRootDirContentsWorker(DirStruct* contents) {
|
||||||
static const char* drvname[] = { FS_DRVNAME };
|
static const char* drvname[] = { FS_DRVNAME };
|
||||||
static const char* drvnum[] = { FS_DRVNUM };
|
static const char* drvnum[] = { FS_DRVNUM };
|
||||||
u32 n_entries = 0;
|
u32 n_entries = 0;
|
||||||
|
|
||||||
|
char sdlabel[16];
|
||||||
|
if (!GetFATVolumeLabel("0:", sdlabel))
|
||||||
|
snprintf(sdlabel, 16, "NOLABEL");
|
||||||
|
|
||||||
// virtual root objects hacked in
|
// virtual root objects hacked in
|
||||||
for (u32 i = 0; (i < NORM_FS+VIRT_FS) && (n_entries < MAX_DIR_ENTRIES); i++) {
|
for (u32 i = 0; (i < NORM_FS+VIRT_FS) && (n_entries < MAX_DIR_ENTRIES); i++) {
|
||||||
DirEntry* entry = &(contents->entry[n_entries]);
|
DirEntry* entry = &(contents->entry[n_entries]);
|
||||||
@ -97,6 +105,8 @@ bool GetRootDirContentsWorker(DirStruct* contents) {
|
|||||||
(GetMountState() & GAME_NDS ) ? "NDS" :
|
(GetMountState() & GAME_NDS ) ? "NDS" :
|
||||||
(GetMountState() & SYS_FIRM ) ? "FIRM" :
|
(GetMountState() & SYS_FIRM ) ? "FIRM" :
|
||||||
(GetMountState() & GAME_TAD ) ? "DSIWARE" : "UNK", drvname[i]);
|
(GetMountState() & GAME_TAD ) ? "DSIWARE" : "UNK", drvname[i]);
|
||||||
|
else if (*(drvnum[i]) == '0') // SD card handling
|
||||||
|
snprintf(entry->path + 4, 32, "[%s] %s (%s)", drvnum[i], drvname[i], sdlabel);
|
||||||
else snprintf(entry->path + 4, 32, "[%s] %s", drvnum[i], drvname[i]);
|
else snprintf(entry->path + 4, 32, "[%s] %s", drvnum[i], drvname[i]);
|
||||||
entry->name = entry->path + 4;
|
entry->name = entry->path + 4;
|
||||||
entry->size = GetTotalSpace(entry->path);
|
entry->size = GetTotalSpace(entry->path);
|
||||||
|
@ -49,6 +49,9 @@ int DriveType(const char* path);
|
|||||||
/** Set search pattern / path / mode for special Z: drive **/
|
/** Set search pattern / path / mode for special Z: drive **/
|
||||||
void SetFSSearch(const char* pattern, const char* path, bool mode);
|
void SetFSSearch(const char* pattern, const char* path, bool mode);
|
||||||
|
|
||||||
|
/** Read the FAT volume label of a partition **/
|
||||||
|
bool GetFATVolumeLabel(const char* drv, char* label);
|
||||||
|
|
||||||
/** Get directory content under a given path **/
|
/** Get directory content under a given path **/
|
||||||
void GetDirContents(DirStruct* contents, const char* path);
|
void GetDirContents(DirStruct* contents, const char* path);
|
||||||
|
|
||||||
|
@ -344,13 +344,13 @@ void DrawDirContents(DirStruct* contents, u32 cursor, u32* scroll) {
|
|||||||
} else DrawRectangle(ALT_SCREEN, SCREEN_WIDTH_ALT - bar_width, start_y, bar_width, flist_height, COLOR_STD_BG);
|
} else DrawRectangle(ALT_SCREEN, SCREEN_WIDTH_ALT - bar_width, start_y, bar_width, flist_height, COLOR_STD_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 SdFormatMenu(void) {
|
u32 SdFormatMenu(const char* slabel) {
|
||||||
const u32 cluster_size_table[5] = { 0x0, 0x0, 0x4000, 0x8000, 0x10000 };
|
const u32 cluster_size_table[5] = { 0x0, 0x0, 0x4000, 0x8000, 0x10000 };
|
||||||
const char* option_emunand_size[6] = { "No EmuNAND", "RedNAND size (min)", "EmuNAND size (full)", "User input..." };
|
const char* option_emunand_size[6] = { "No EmuNAND", "RedNAND size (min)", "EmuNAND size (full)", "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" };
|
||||||
u64 sysnand_size_mb = (((u64)GetNandSizeSectors(NAND_SYSNAND) * 0x200) + 0xFFFFF) / 0x100000;
|
u64 sysnand_size_mb = (((u64)GetNandSizeSectors(NAND_SYSNAND) * 0x200) + 0xFFFFF) / 0x100000;
|
||||||
u64 sysnand_min_size_mb = (((u64)GetNandMinSizeSectors(NAND_SYSNAND) * 0x200) + 0xFFFFF) / 0x100000;
|
u64 sysnand_min_size_mb = (((u64)GetNandMinSizeSectors(NAND_SYSNAND) * 0x200) + 0xFFFFF) / 0x100000;
|
||||||
char label[16] = "0:GM9SD";
|
char label[16];
|
||||||
u32 cluster_size = 0;
|
u32 cluster_size = 0;
|
||||||
u64 sdcard_size_mb = 0;
|
u64 sdcard_size_mb = 0;
|
||||||
u64 emunand_size_mb = (u64) -1;
|
u64 emunand_size_mb = (u64) -1;
|
||||||
@ -376,6 +376,7 @@ u32 SdFormatMenu(void) {
|
|||||||
if (!user_select) return 1;
|
if (!user_select) return 1;
|
||||||
else cluster_size = cluster_size_table[user_select];
|
else cluster_size = cluster_size_table[user_select];
|
||||||
|
|
||||||
|
snprintf(label, 16, "0:%s", (slabel && *slabel) ? slabel : "GM9SD");
|
||||||
if (!ShowStringPrompt(label + 2, 11 + 1, "Format SD card (%lluMB)?\nEnter label:", sdcard_size_mb))
|
if (!ShowStringPrompt(label + 2, 11 + 1, "Format SD card (%lluMB)?\nEnter label:", sdcard_size_mb))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -1776,11 +1777,13 @@ u32 HomeMoreMenu(char* current_path) {
|
|||||||
int user_select = ShowSelectPrompt(n_opt, optionstr, promptstr);
|
int user_select = ShowSelectPrompt(n_opt, optionstr, promptstr);
|
||||||
if (user_select == sdformat) { // format SD card
|
if (user_select == sdformat) { // format SD card
|
||||||
bool sd_state = CheckSDMountState();
|
bool sd_state = CheckSDMountState();
|
||||||
|
char slabel[16] = { '\0' };
|
||||||
if (clipboard->n_entries && (DriveType(clipboard->entry[0].path) & (DRV_SDCARD|DRV_ALIAS|DRV_EMUNAND|DRV_IMAGE)))
|
if (clipboard->n_entries && (DriveType(clipboard->entry[0].path) & (DRV_SDCARD|DRV_ALIAS|DRV_EMUNAND|DRV_IMAGE)))
|
||||||
clipboard->n_entries = 0; // remove SD clipboard entries
|
clipboard->n_entries = 0; // remove SD clipboard entries
|
||||||
|
GetFATVolumeLabel("0:", slabel); // get SD volume label
|
||||||
DeinitExtFS();
|
DeinitExtFS();
|
||||||
DeinitSDCardFS();
|
DeinitSDCardFS();
|
||||||
if ((SdFormatMenu() == 0) || sd_state) {;
|
if ((SdFormatMenu(slabel) == 0) || sd_state) {;
|
||||||
while (!InitSDCardFS() &&
|
while (!InitSDCardFS() &&
|
||||||
ShowPrompt(true, "Initializing SD card failed! Retry?"));
|
ShowPrompt(true, "Initializing SD card failed! Retry?"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user