void aptSetStatusPower(u32 status);
void aptReturnToMenu();//This should be called by the user application when aptGetStatus() returns APP_SUSPENDING, not calling this will result in return-to-menu being disabled with the status left at APP_SUSPENDING. This function will not return until the system returns to the application, or when the status was changed to APP_EXITING.
void aptWaitStatusEvent();
+NS_APPID aptGetMenuAppID();
Result APT_GetLockHandle(Handle* handle, u16 flags, Handle* lockHandle);
Result APT_Initialize(Handle* handle, NS_APPID appId, Handle* eventHandle1, Handle* eventHandle2);
Result APT_Enable(Handle* handle, u32 a);
+Result APT_GetAppletManInfo(Handle* handle, u8 inval, u8 *outval8, u32 *outval32, NS_APPID *menu_appid, NS_APPID *active_appid);
Result APT_PrepareToJumpToHomeMenu(Handle* handle);
Result APT_JumpToHomeMenu(Handle* handle, u32 a, u32 b, u32 c);
Result APT_InquireNotification(Handle* handle, u32 appID, u8* signalType);
aptCloseSession();
}
+NS_APPID aptGetMenuAppID()
+{
+ NS_APPID menu_appid;
+
+ aptOpenSession();
+ APT_GetAppletManInfo(NULL, 0xff, NULL, NULL, &menu_appid, NULL);
+ aptCloseSession();
+
+ return menu_appid;
+}
+
void aptReturnToMenu()
{
+ NS_APPID menu_appid;
u32 tmp0 = 1, tmp1 = 0;
u32 ns_capinfo[0x20>>2];
u32 tmp_params[0x20>>2];
aptInitCaptureInfo(ns_capinfo);
+ menu_appid = aptGetMenuAppID();
+
aptOpenSession();
- APT_SendParameter(NULL, currentAppId, 0x101, 0x20, ns_capinfo, 0x0, 0x10);
+ APT_SendParameter(NULL, currentAppId, menu_appid, 0x20, ns_capinfo, 0x0, 0x10);
aptCloseSession();
aptOpenSession();
return cmdbuf[1];
}
+Result APT_GetAppletManInfo(Handle* handle, u8 inval, u8 *outval8, u32 *outval32, NS_APPID *menu_appid, NS_APPID *active_appid)
+{
+ if(!handle)handle=&aptuHandle;
+ u32* cmdbuf=getThreadCommandBuffer();
+ cmdbuf[0]=0x00050040; //request header code
+ cmdbuf[1]=inval;
+
+ Result ret=0;
+ if((ret=svc_sendSyncRequest(*handle)))return ret;
+
+ if(outval8)*outval8=cmdbuf[2];
+ if(outval32)*outval32=cmdbuf[3];
+ if(menu_appid)*menu_appid=cmdbuf[4];
+ if(active_appid)*active_appid=cmdbuf[5];
+
+ return cmdbuf[1];
+}
+
Result APT_InquireNotification(Handle* handle, u32 appID, u8* signalType)
{
if(!handle)handle=&aptuHandle;