static bool __handle_incoming_parameter() { u8 type; aptOpenSession(); APT_ReceiveParameter(NULL, currentAppId, 0x1000, aptParameters, NULL, &type); aptCloseSession(); switch(type) { case 0x1: // Application just started. aptAppStarted(); return true; case 0x3: // "Launched library applet finished loading" aptSetStatus(APP_APPLETSTARTED); return true; case 0xA: // "Launched library applet closed" if(__apt_launchapplet_parambuf && __apt_launchapplet_parambufsize)memcpy(__apt_launchapplet_parambuf, aptParameters, __apt_launchapplet_parambufsize); aptSetStatus(APP_APPLETCLOSED); return true; case 0xB: // Just returned from menu. GSPGPU_AcquireRight(NULL, 0x0); GSPGPU_RestoreVramSysArea(NULL); aptAppletUtility_Exit_RetToApp(0); aptSetStatus(APP_RUNNING); return true; case 0xC: // Exiting application. aptSetStatus(APP_EXITING); return false; } return true; }
void aptAppletClosed() { aptAppletUtility_Exit_RetToApp(1); GSPGPU_AcquireRight(NULL, 0x0); GSPGPU_RestoreVramSysArea(NULL); svcClearEvent(aptStatusEvent); aptSetStatus(APP_RUNNING); }