Reboot to Hekate menu once without changing hekate_ipl.ini

Mariko: RTC REBOOT_REASON_MENU + PMIC reboot. Erista: patch in-memory
boot_cfg on valid Hekate payload and try common SD paths.
This commit is contained in:
2026-07-03 17:17:56 +02:00
parent e5ab6a2ed0
commit 1b63a03b01
4 changed files with 90 additions and 6 deletions

View File

@@ -11,10 +11,58 @@
#include "../hid/hid.h"
#include "../fs/fsutils.h"
#include "../config.h"
#include <rtc/max77620-rtc.h>
#include <string.h>
extern hekate_config h_cfg;
extern int launch_payload(char *path);
extern int launch_payload_ex(char *path, bool force_hekate_menu);
static const char *hekate_payload_paths[] = {
"sd:/atmosphere/reboot_payload.bin",
"sd:/bootloader/update.bin",
"sd:/bootloader/payloads/hekate.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)
{
rtc_reboot_reason_t rr = {0};
rr.dec.reason = REBOOT_REASON_MENU;
max77620_rtc_set_reboot_reason(&rr);
power_set_state(POWER_OFF_REBOOT);
return;
}
for (u32 i = 0; i < sizeof(hekate_payload_paths) / sizeof(hekate_payload_paths[0]); i++)
{
if (!FileExists(hekate_payload_paths[i]))
continue;
if (launch_payload_ex((char *)hekate_payload_paths[i], true) != 2)
return;
}
gfx_clearscreen();
gfx_printf("\n\nHekate nicht gefunden.\n\nDruecke eine Taste um zurueckzukehren");
hidWait();
}
void inline __attribute__((always_inline)) power_off(){
power_set_state(POWER_OFF_RESET);

View File

@@ -6,6 +6,10 @@ void MaskIn(char *mod, u32 bitstream, char mask);
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);
#define FREE(x) free(x); x = NULL;
char *ShowKeyboard(const char *toEdit, u8 alwaysRet);