mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Only offer bonus drive with enough space
... also fix remounting bonus drive after image mount.
This commit is contained in:
parent
2e8ed9e48f
commit
56aff4dd4c
@ -45,10 +45,6 @@ bool InitImgFS(const char* path) {
|
|||||||
// (re)mount image, done if path == NULL
|
// (re)mount image, done if path == NULL
|
||||||
MountImage(path);
|
MountImage(path);
|
||||||
InitVirtualImageDrive();
|
InitVirtualImageDrive();
|
||||||
if (!GetMountState()) {
|
|
||||||
fs_mounted[9] = (f_mount(fs + 9, "9:", 1) == FR_OK); // ram drive
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// reinit image filesystem
|
// reinit image filesystem
|
||||||
for (u32 i = NORM_FS - IMGN_FS; i < NORM_FS; i++) {
|
for (u32 i = NORM_FS - IMGN_FS; i < NORM_FS; i++) {
|
||||||
char fsname[8];
|
char fsname[8];
|
||||||
@ -56,7 +52,7 @@ bool InitImgFS(const char* path) {
|
|||||||
if (fs_mounted[i]) continue;
|
if (fs_mounted[i]) continue;
|
||||||
fs_mounted[i] = (f_mount(fs + i, fsname, 1) == FR_OK);
|
fs_mounted[i] = (f_mount(fs + i, fsname, 1) == FR_OK);
|
||||||
}
|
}
|
||||||
return true;
|
return GetMountState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeinitExtFS() {
|
void DeinitExtFS() {
|
||||||
|
@ -1356,8 +1356,11 @@ u32 GodMode() {
|
|||||||
break;
|
break;
|
||||||
} else if (pad_state & BUTTON_HOME) { // Home menu
|
} else if (pad_state & BUTTON_HOME) { // Home menu
|
||||||
const char* optionstr[] = { "Poweroff system", "Reboot system", "SD format menu", "Bonus drive setup", "Switch EmuNAND" };
|
const char* optionstr[] = { "Poweroff system", "Reboot system", "SD format menu", "Bonus drive setup", "Switch EmuNAND" };
|
||||||
u32 user_select = ShowSelectPrompt(CheckMultiEmuNand() ? 5 : 4, optionstr,
|
u32 n_opt = 3;
|
||||||
"HOME button pressed.\nSelect action:" );
|
int bonus = (GetNandUnusedSectors(NAND_SYSNAND) > 0x10000) ? (int) ++n_opt : -1;
|
||||||
|
int multi = (CheckMultiEmuNand()) ? (int) ++n_opt : -1;
|
||||||
|
if (bonus < 0) optionstr[3] = "Switch EmuNAND";
|
||||||
|
u32 user_select = ShowSelectPrompt(n_opt, optionstr, "HOME button pressed.\nSelect action:" );
|
||||||
if (user_select == 1) {
|
if (user_select == 1) {
|
||||||
exit_mode = GODMODE_EXIT_POWEROFF;
|
exit_mode = GODMODE_EXIT_POWEROFF;
|
||||||
break;
|
break;
|
||||||
@ -1378,13 +1381,13 @@ u32 GodMode() {
|
|||||||
InitEmuNandBase(true);
|
InitEmuNandBase(true);
|
||||||
InitExtFS();
|
InitExtFS();
|
||||||
GetDirContents(current_dir, current_path);
|
GetDirContents(current_dir, current_path);
|
||||||
} else if (user_select == 4) { // setup bonus drive
|
} else if (user_select == (u32) bonus) { // setup bonus drive
|
||||||
if (clipboard->n_entries && (DriveType(clipboard->entry[0].path) & (DRV_BONUS|DRV_IMAGE)))
|
if (clipboard->n_entries && (DriveType(clipboard->entry[0].path) & (DRV_BONUS|DRV_IMAGE)))
|
||||||
clipboard->n_entries = 0; // remove bonus drive clipboard entries
|
clipboard->n_entries = 0; // remove bonus drive clipboard entries
|
||||||
if (!SetupBonusDrive()) ShowPrompt(false, "Setup failed!");
|
if (!SetupBonusDrive()) ShowPrompt(false, "Setup failed!");
|
||||||
ClearScreenF(true, true, COLOR_STD_BG);
|
ClearScreenF(true, true, COLOR_STD_BG);
|
||||||
GetDirContents(current_dir, current_path);
|
GetDirContents(current_dir, current_path);
|
||||||
} else if (user_select == 5) { // switch EmuNAND offset
|
} else if (user_select == (u32) multi) { // switch EmuNAND offset
|
||||||
while (ShowPrompt(true, "Current EmuNAND offset is %06X.\nSwitch to next offset?", GetEmuNandBase())) {
|
while (ShowPrompt(true, "Current EmuNAND offset is %06X.\nSwitch to next offset?", GetEmuNandBase())) {
|
||||||
if (clipboard->n_entries && (DriveType(clipboard->entry[0].path) & DRV_EMUNAND))
|
if (clipboard->n_entries && (DriveType(clipboard->entry[0].path) & DRV_EMUNAND))
|
||||||
clipboard->n_entries = 0; // remove SD clipboard entries
|
clipboard->n_entries = 0; // remove SD clipboard entries
|
||||||
|
@ -411,6 +411,11 @@ u64 GetNandSizeSectors(u32 nand_src)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u64 GetNandUnusedSectors(u32 nand_src)
|
||||||
|
{
|
||||||
|
return GetNandSizeSectors(nand_src) - NAND_MIN_SECTORS;
|
||||||
|
}
|
||||||
|
|
||||||
bool CheckMultiEmuNand(void)
|
bool CheckMultiEmuNand(void)
|
||||||
{
|
{
|
||||||
// this only checks for the theoretical possibility
|
// this only checks for the theoretical possibility
|
||||||
|
@ -47,6 +47,7 @@ int ReadNandSectors(u8* buffer, u32 sector, u32 count, u32 keyslot, u32 src);
|
|||||||
int WriteNandSectors(const u8* buffer, u32 sector, u32 count, u32 keyslot, u32 dest);
|
int WriteNandSectors(const u8* buffer, u32 sector, u32 count, u32 keyslot, u32 dest);
|
||||||
|
|
||||||
u64 GetNandSizeSectors(u32 src);
|
u64 GetNandSizeSectors(u32 src);
|
||||||
|
u64 GetNandUnusedSectors(u32 src);
|
||||||
u32 CheckNandHeader(u8* header);
|
u32 CheckNandHeader(u8* header);
|
||||||
u32 CheckNandType(u32 src);
|
u32 CheckNandType(u32 src);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user