Bootloader: Resume GodMode9 if no bootable FIRM found

This commit is contained in:
d0k3 2018-02-07 00:58:38 +01:00
parent 0086a6bcb5
commit 7235401b2b

View File

@ -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,9 +1975,11 @@ 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));
@ -1987,12 +1988,13 @@ u32 GodMode(int entrypoint) {
return exit_mode; return exit_mode;
} }
PaneData* pane = panedata;
GetDirContents(current_dir, ""); GetDirContents(current_dir, "");
clipboard->n_entries = 0; clipboard->n_entries = 0;
memset(panedata, 0x00, N_PANES * sizeof(PaneData)); memset(panedata, 0x00, N_PANES * sizeof(PaneData));
ClearScreenF(true, true, COLOR_STD_BG); // clear splash ClearScreenF(true, true, COLOR_STD_BG); // clear splash
}
PaneData* pane = panedata;
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;
} }