]> Chaos Git - corbenik/ctrulib.git/commitdiff
Fix APT applet launch code [regression caused by c75ed65]
authorfincs <fincs.alt1@gmail.com>
Sat, 23 May 2015 16:46:56 +0000 (18:46 +0200)
committerfincs <fincs.alt1@gmail.com>
Sat, 23 May 2015 16:46:56 +0000 (18:46 +0200)
libctru/source/services/apt.c

index 4f33c922f286addfed7eb2bf45ab17e922b6c7f6..7fdad04e4e80a56c835d7cd33790a532773e954a 100644 (file)
@@ -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();