]> Chaos Git - corbenik/ctrulib.git/commitdiff
aptInit(): Wait for APT_RUNNING (solves certain timing problems)
authorfincs <fincs.alt1@gmail.com>
Mon, 26 Oct 2015 20:19:00 +0000 (21:19 +0100)
committerfincs <fincs.alt1@gmail.com>
Mon, 26 Oct 2015 20:19:00 +0000 (21:19 +0100)
libctru/source/services/apt.c

index 58d508f6bc9d746432de9eb5b54c4451e4036803..8fef5227c8fd82fd1f6607384b2b0432c394cbf9 100644 (file)
@@ -175,7 +175,7 @@ void aptAppletUtility_Exit_RetToApp(u32 type)
 
 NS_APPID aptGetMenuAppID(void)
 {
-       NS_APPID menu_appid;
+       NS_APPID menu_appid = 0;
 
        aptOpenSession();
        APT_GetAppletManInfo(0xff, NULL, NULL, &menu_appid, NULL);
@@ -501,6 +501,9 @@ Result aptInit(void)
                // create APT event handler thread
                svcCreateThread(&aptEventHandlerThread, aptEventHandler, 0x0,
                        (u32*)(&aptEventHandlerStack[APT_HANDLER_STACKSIZE/8]), 0x31, 0xfffffffe);
+
+               // Wait for the state to become APT_RUNNING
+               aptWaitStatusEvent();
        } else
                aptAppStarted();