add applet exit locking to haze and reboot_to_payload

This commit is contained in:
TotalJustice 2023-06-14 13:59:26 +01:00
parent 8b88351cb4
commit 4c57189025
2 changed files with 10 additions and 0 deletions

View file

@ -17,6 +17,9 @@
#include <haze/console_main_loop.hpp>
int main(int argc, char **argv) {
/* Lock exit so that cleanup is ensured. */
HAZE_R_ABORT_UNLESS(appletLockExit());
/* Load device firmware version and serial number. */
HAZE_R_ABORT_UNLESS(haze::LoadDeviceProperties());
@ -24,5 +27,6 @@ int main(int argc, char **argv) {
haze::ConsoleMainLoop::RunApplication();
/* Return to the loader. */
appletUnlockExit();
return 0;
}

View file

@ -8,11 +8,17 @@
#define IRAM_PAYLOAD_MAX_SIZE 0x24000
static u8 g_reboot_payload[IRAM_PAYLOAD_MAX_SIZE];
void userAppInit(void)
{
appletLockExit();
}
void userAppExit(void)
{
amsBpcExit();
setsysExit();
spsmExit();
appletUnlockExit();
}
static void reboot_to_payload(void) {