Implemented APT_GetAppletManInfo. Implemented loading the menu AppID with APT_GetAppletManInfo, instead of using a hard-coded AppID.

This commit is contained in:
yellows8 2014-05-22 00:22:56 -04:00
parent 54757cfd60
commit ce92c8b20d
2 changed files with 35 additions and 1 deletions

View File

@ -30,10 +30,12 @@ u32 aptGetStatusPower();//This can be used when the status is APP_SUSPEND* to ch
void aptSetStatusPower(u32 status); 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 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(); void aptWaitStatusEvent();
NS_APPID aptGetMenuAppID();
Result APT_GetLockHandle(Handle* handle, u16 flags, Handle* lockHandle); Result APT_GetLockHandle(Handle* handle, u16 flags, Handle* lockHandle);
Result APT_Initialize(Handle* handle, NS_APPID appId, Handle* eventHandle1, Handle* eventHandle2); Result APT_Initialize(Handle* handle, NS_APPID appId, Handle* eventHandle1, Handle* eventHandle2);
Result APT_Enable(Handle* handle, u32 a); 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_PrepareToJumpToHomeMenu(Handle* handle);
Result APT_JumpToHomeMenu(Handle* handle, u32 a, u32 b, u32 c); Result APT_JumpToHomeMenu(Handle* handle, u32 a, u32 b, u32 c);
Result APT_InquireNotification(Handle* handle, u32 appID, u8* signalType); Result APT_InquireNotification(Handle* handle, u32 appID, u8* signalType);

View File

@ -104,8 +104,20 @@ void aptAppletUtility_Exit_RetToApp()
aptCloseSession(); aptCloseSession();
} }
NS_APPID aptGetMenuAppID()
{
NS_APPID menu_appid;
aptOpenSession();
APT_GetAppletManInfo(NULL, 0xff, NULL, NULL, &menu_appid, NULL);
aptCloseSession();
return menu_appid;
}
void aptReturnToMenu() void aptReturnToMenu()
{ {
NS_APPID menu_appid;
u32 tmp0 = 1, tmp1 = 0; u32 tmp0 = 1, tmp1 = 0;
u32 ns_capinfo[0x20>>2]; u32 ns_capinfo[0x20>>2];
u32 tmp_params[0x20>>2]; u32 tmp_params[0x20>>2];
@ -128,8 +140,10 @@ void aptReturnToMenu()
aptInitCaptureInfo(ns_capinfo); aptInitCaptureInfo(ns_capinfo);
menu_appid = aptGetMenuAppID();
aptOpenSession(); aptOpenSession();
APT_SendParameter(NULL, currentAppId, 0x101, 0x20, ns_capinfo, 0x0, 0x10); APT_SendParameter(NULL, currentAppId, menu_appid, 0x20, ns_capinfo, 0x0, 0x10);
aptCloseSession(); aptCloseSession();
aptOpenSession(); aptOpenSession();
@ -450,6 +464,24 @@ Result APT_Enable(Handle* handle, u32 a)
return cmdbuf[1]; 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) Result APT_InquireNotification(Handle* handle, u32 appID, u8* signalType)
{ {
if(!handle)handle=&aptuHandle; if(!handle)handle=&aptuHandle;