forked from Mirror/GodMode9
Bootloader: Resume GodMode9 if no bootable FIRM found
This commit is contained in:
parent
0086a6bcb5
commit
7235401b2b
@ -77,7 +77,6 @@ u32 SplashInit(const char* modestr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SCRIPT_RUNNER
|
#ifndef SCRIPT_RUNNER
|
||||||
// reserve 480kB for DirStruct, 64kB for PaneData, just to be safe
|
|
||||||
static DirStruct* current_dir = NULL;
|
static DirStruct* current_dir = NULL;
|
||||||
static DirStruct* clipboard = NULL;
|
static DirStruct* clipboard = NULL;
|
||||||
static PaneData* panedata = NULL;
|
static PaneData* panedata = NULL;
|
||||||
@ -1976,23 +1975,26 @@ u32 GodMode(int entrypoint) {
|
|||||||
for (u32 i = 0; i < sizeof(bootfirm_paths) / sizeof(char*); i++) {
|
for (u32 i = 0; i < sizeof(bootfirm_paths) / sizeof(char*); i++) {
|
||||||
BootFirmHandler(bootfirm_paths[i], false, (BOOTFIRM_TEMPS >> i) & 0x1);
|
BootFirmHandler(bootfirm_paths[i], false, (BOOTFIRM_TEMPS >> i) & 0x1);
|
||||||
}
|
}
|
||||||
|
ShowPrompt(false, "No bootable FIRM found.\nNow resuming GodMode9...");
|
||||||
|
godmode9 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (godmode9) {
|
||||||
current_dir = (DirStruct*) malloc(sizeof(DirStruct));
|
current_dir = (DirStruct*) malloc(sizeof(DirStruct));
|
||||||
clipboard = (DirStruct*) malloc(sizeof(DirStruct));
|
clipboard = (DirStruct*) malloc(sizeof(DirStruct));
|
||||||
panedata = (PaneData*) malloc(N_PANES * sizeof(PaneData));
|
panedata = (PaneData*) malloc(N_PANES * sizeof(PaneData));
|
||||||
if (!current_dir || !clipboard || !panedata) {
|
if (!current_dir || !clipboard || !panedata) {
|
||||||
ShowPrompt(false, "Out of memory."); // just to be safe
|
ShowPrompt(false, "Out of memory."); // just to be safe
|
||||||
return exit_mode;
|
return exit_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetDirContents(current_dir, "");
|
||||||
|
clipboard->n_entries = 0;
|
||||||
|
memset(panedata, 0x00, N_PANES * sizeof(PaneData));
|
||||||
|
ClearScreenF(true, true, COLOR_STD_BG); // clear splash
|
||||||
}
|
}
|
||||||
|
|
||||||
PaneData* pane = panedata;
|
PaneData* pane = panedata;
|
||||||
GetDirContents(current_dir, "");
|
|
||||||
clipboard->n_entries = 0;
|
|
||||||
memset(panedata, 0x00, N_PANES * sizeof(PaneData));
|
|
||||||
ClearScreenF(true, true, COLOR_STD_BG); // clear splash
|
|
||||||
|
|
||||||
while (godmode9) { // this is the main loop
|
while (godmode9) { // this is the main loop
|
||||||
// basic sanity checking
|
// basic sanity checking
|
||||||
if (!current_dir->n_entries) { // current dir is empty -> revert to root
|
if (!current_dir->n_entries) { // current dir is empty -> revert to root
|
||||||
@ -2415,9 +2417,9 @@ u32 GodMode(int entrypoint) {
|
|||||||
DeinitExtFS();
|
DeinitExtFS();
|
||||||
DeinitSDCardFS();
|
DeinitSDCardFS();
|
||||||
|
|
||||||
free(current_dir);
|
if (current_dir) free(current_dir);
|
||||||
free(clipboard);
|
if (clipboard) free(clipboard);
|
||||||
free(panedata);
|
if (panedata) free(panedata);
|
||||||
|
|
||||||
return exit_mode;
|
return exit_mode;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user