From 8ac3549abfd984c710ab04de266abc876da3ebeb Mon Sep 17 00:00:00 2001 From: fincs Date: Sat, 23 May 2015 18:46:56 +0200 Subject: [PATCH] Fix APT applet launch code [regression caused by c75ed65] --- libctru/source/services/apt.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libctru/source/services/apt.c b/libctru/source/services/apt.c index 4f33c92..7fdad04 100644 --- a/libctru/source/services/apt.c +++ b/libctru/source/services/apt.c @@ -202,6 +202,7 @@ void aptReturnToMenu() } // Set status to SUSPENDED. + __apt_launchapplet_appID = 0; svcClearEvent(aptStatusEvent); aptSetStatus(APP_SUSPENDED); @@ -384,11 +385,11 @@ static bool __handle_incoming_parameter() { return true; case 0x3: // "Launched library applet finished loading" - if (aptGetStatus() == APP_SUSPENDED) return true; + if (aptGetStatus() != APP_SUSPENDED || __apt_launchapplet_appID==0) return true; aptSetStatus(APP_APPLETSTARTED); return true; case 0xA: // "Launched library applet closed" - if (aptGetStatus() == APP_SUSPENDED) return true; + if (aptGetStatus() != APP_SUSPENDED || __apt_launchapplet_appID==0) return true; if(__apt_launchapplet_parambuf && __apt_launchapplet_parambufsize)memcpy(__apt_launchapplet_parambuf, aptParameters, __apt_launchapplet_parambufsize); aptSetStatus(APP_APPLETCLOSED); return true; @@ -1236,15 +1237,6 @@ Result APT_LaunchLibraryApplet(NS_APPID appID, Handle inhandle, u32 *parambuf, u APT_ReplySleepQuery(NULL, currentAppId, 0); aptCloseSession(); - memset(buf1, 0, 4); - aptOpenSession(); - APT_AppletUtility(NULL, NULL, 0x4, 0x1, buf1, 0x1, buf2); - aptCloseSession(); - - aptOpenSession(); - APT_ReplySleepQuery(NULL, currentAppId, 0); - aptCloseSession(); - aptOpenSession(); ret=APT_PrepareToStartLibraryApplet(NULL, appID); aptCloseSession();