From 287bb009819710cf3b6f85cf9b112411436ec27a Mon Sep 17 00:00:00 2001 From: yellows8 Date: Fri, 16 Aug 2019 20:33:09 -0400 Subject: [PATCH] Enter an infinite-sleep-loop in _appletExitProcess when the exit cmds were successful, this is used with __nx_applet_exit_mode handling. Minor other changes. --- nx/source/services/applet.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index 44bc6ca4..9282bb41 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -29,6 +29,7 @@ static Service g_appletSrv; static Service g_appletProxySession; static u64 g_refCnt; static bool g_appletExitProcessFlag; +static Result g_appletExitProcessResult; // From Get*Functions. static Service g_appletIAppletCommonFunctions; @@ -345,6 +346,8 @@ Result appletInitialize(void) static void NORETURN _appletExitProcess(int result_code) { appletExit(); + if (R_SUCCEEDED(g_appletExitProcessResult)) while(1)svcSleepThread(86400000000000ULL); + svcExitProcess(); __builtin_unreachable(); } @@ -381,12 +384,10 @@ void appletExit(void) return; } else { - if (_appletIsApplication()) { - //appletSetTerminateResult(0); - _appletSelfExit(); - } + if (_appletIsApplication()) + g_appletExitProcessResult = _appletSelfExit(); if (__nx_applet_type == AppletType_LibraryApplet) - _appletExitProcessAndReturn(); + g_appletExitProcessResult = _appletExitProcessAndReturn(); } } }