diff --git a/sysmodules/rosalina/source/main.c b/sysmodules/rosalina/source/main.c index 9ef643b..d0c3e7b 100644 --- a/sysmodules/rosalina/source/main.c +++ b/sysmodules/rosalina/source/main.c @@ -140,6 +140,7 @@ static void handleSleepNotification(u32 notificationId) switch (notificationId) { case PTMNOTIFID_SLEEP_REQUESTED: + menuShouldExit = true; PTMSYSM_ReplyToSleepQuery(ROSALINA_PREVENT_DISCONNECT); // deny sleep request if we have network stuff running break; case PTMNOTIFID_GOING_TO_SLEEP: @@ -150,18 +151,26 @@ static void handleSleepNotification(u32 notificationId) break; case PTMNOTIFID_SLEEP_DENIED: case PTMNOTIFID_FULLY_AWAKE: + menuShouldExit = false; + break; default: break; } ptmSysmExit(); } -static void handleShellOpenedNotification(u32 notificationId) +static void handleShellNotification(u32 notificationId) { - (void)notificationId; + if (notificationId == 0x213) { + // Shell opened + // Note that this notification is fired on system init + ScreenFiltersMenu_RestoreCct(); + menuShouldExit = false; + } else { + // Shell closed + menuShouldExit = true; + } - // Note that this is called on system init - ScreenFiltersMenu_RestoreCct(); } static void handlePreTermNotification(u32 notificationId) @@ -221,7 +230,8 @@ static const ServiceManagerNotificationEntry notifications[] = { { PTMNOTIFID_FULLY_WAKING_UP, handleSleepNotification }, { PTMNOTIFID_FULLY_AWAKE, handleSleepNotification }, { PTMNOTIFID_HALF_AWAKE, handleSleepNotification }, - { 0x213, handleShellOpenedNotification }, + { 0x213, handleShellNotification }, + { 0x214, handleShellNotification }, { 0x1000, handleNextApplicationDebuggedByForce }, { 0x2000, handlePreTermNotification }, { 0x3000, handleRestartHbAppNotification }, diff --git a/sysmodules/rosalina/source/menu.c b/sysmodules/rosalina/source/menu.c index 28bed67..04c9779 100644 --- a/sysmodules/rosalina/source/menu.c +++ b/sysmodules/rosalina/source/menu.c @@ -188,6 +188,7 @@ void menuThreadMain(void) while(!preTerminationRequested) { + svcSleepThread(50 * 1000 * 1000LL); if (menuShouldExit) continue; @@ -200,8 +201,6 @@ void menuThreadMain(void) menuShow(&rosalinaMenu); menuLeave(); } - - svcSleepThread(50 * 1000 * 1000LL); } }