From 6bdfa1a0052fff481dc4fdd01df0d0782431bb62 Mon Sep 17 00:00:00 2001 From: fincs Date: Mon, 26 Oct 2015 21:19:00 +0100 Subject: [PATCH] aptInit(): Wait for APT_RUNNING (solves certain timing problems) --- libctru/source/services/apt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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();