From: fincs Date: Mon, 26 Oct 2015 20:19:00 +0000 (+0100) Subject: aptInit(): Wait for APT_RUNNING (solves certain timing problems) X-Git-Tag: v1.0.0~58 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=6bdfa1a0052fff481dc4fdd01df0d0782431bb62;p=corbenik%2Fctrulib.git aptInit(): Wait for APT_RUNNING (solves certain timing problems) --- diff --git a/libctru/source/services/apt.c b/libctru/source/services/apt.c index 58d508f..8fef522 100644 --- a/libctru/source/services/apt.c +++ b/libctru/source/services/apt.c @@ -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();