diff --git a/source/tegraexplorer/mainmenu.c b/source/tegraexplorer/mainmenu.c index b98506e..27dc360 100644 --- a/source/tegraexplorer/mainmenu.c +++ b/source/tegraexplorer/mainmenu.c @@ -145,7 +145,9 @@ void EnterMainMenu(){ sd_unmount(); // // -- Exit -- - mainMenuEntries[MainRebootHekate].hide = !h_cfg.t210b01 && (!sd_get_card_mounted() || !hekate_reboot_available()); + // Always offered: on Erista, reboot_to_hekate_menu() mounts the SD card + // itself and says so if hekate is missing. + mainMenuEntries[MainRebootHekate].hide = false; mainMenuEntries[MainRebootRCM].hide = h_cfg.t210b01; mainMenuEntries[FixMarikoWarmbootSleep].hide = !h_cfg.t210b01; diff --git a/source/utils/utils.c b/source/utils/utils.c index e963576..2631838 100644 --- a/source/utils/utils.c +++ b/source/utils/utils.c @@ -12,33 +12,22 @@ #include "../fs/fsutils.h" #include "../config.h" #include +#include #include extern hekate_config h_cfg; extern int launch_payload_ex(char *path, bool force_hekate_menu); +// Hekate files first: reboot_payload.bin is often Atmosphere's fusee (no hekate +// magic, skipped by launch_payload_ex), so it only helps when it is hekate. static const char *hekate_payload_paths[] = { - "sd:/atmosphere/reboot_payload.bin", "sd:/bootloader/update.bin", "sd:/bootloader/payloads/hekate.bin", + "sd:/atmosphere/reboot_payload.bin", "sd:/sept/payload.bin", }; -bool hekate_reboot_available(void) -{ - if (h_cfg.t210b01) - return true; - - for (u32 i = 0; i < sizeof(hekate_payload_paths) / sizeof(hekate_payload_paths[0]); i++) - { - if (FileExists(hekate_payload_paths[i])) - return true; - } - - return false; -} - void reboot_to_hekate_menu(void) { if (h_cfg.t210b01) @@ -50,8 +39,22 @@ void reboot_to_hekate_menu(void) return; } + // Erista: chainload hekate from the SD card (mounted here, so the entry + // also works after an action unmounted the card). + if (!sd_get_card_mounted() && !sd_mount()) + { + gfx_clearscreen(); + gfx_printf("\n\nSD-Karte konnte nicht gemountet werden.\n\nNutze \"Neustart in RCM-Modus\" und starte\nhekate per Payload-Injector.\n\nDruecke eine Taste um zurueckzukehren"); + hidWait(); + return; + } + for (u32 i = 0; i < sizeof(hekate_payload_paths) / sizeof(hekate_payload_paths[0]); i++) { + // launch_payload_ex() unmounts the card when it rejects a payload that is + // not hekate, so mount again before checking the next path. + if (!sd_get_card_mounted() && !sd_mount()) + break; if (!FileExists(hekate_payload_paths[i])) continue; @@ -60,7 +63,7 @@ void reboot_to_hekate_menu(void) } gfx_clearscreen(); - gfx_printf("\n\nHekate nicht gefunden.\n\nDruecke eine Taste um zurueckzukehren"); + gfx_printf("\n\nHekate nicht gefunden (bootloader/update.bin).\n\nNutze \"Neustart in RCM-Modus\" und starte\nhekate per Payload-Injector.\n\nDruecke eine Taste um zurueckzukehren"); hidWait(); } diff --git a/source/utils/utils.h b/source/utils/utils.h index ef1f1d2..566058f 100644 --- a/source/utils/utils.h +++ b/source/utils/utils.h @@ -7,7 +7,6 @@ bool StrEndsWith(char *begin, char *end); void WaitFor(u32 ms); void RebootToPayloadOrRcm(); void reboot_to_hekate_menu(void); -bool hekate_reboot_available(void); int launch_payload_ex(char *path, bool force_hekate_menu); int launch_payload(char *path);