From 4c57189025e0c7a24d02e74981c42ac0997f5c8b Mon Sep 17 00:00:00 2001 From: TotalJustice <47043333+ITotalJustice@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:59:26 +0100 Subject: [PATCH] add applet exit locking to haze and reboot_to_payload --- troposphere/haze/source/main.cpp | 4 ++++ troposphere/reboot_to_payload/source/main.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/troposphere/haze/source/main.cpp b/troposphere/haze/source/main.cpp index 1cab75b9b..cfdf240ee 100644 --- a/troposphere/haze/source/main.cpp +++ b/troposphere/haze/source/main.cpp @@ -17,6 +17,9 @@ #include 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; } diff --git a/troposphere/reboot_to_payload/source/main.c b/troposphere/reboot_to_payload/source/main.c index ebae553ea..4e4e9504a 100644 --- a/troposphere/reboot_to_payload/source/main.c +++ b/troposphere/reboot_to_payload/source/main.c @@ -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) {