Merge pull request #101 from profi200/master

Implemented functions to start system applets.
This commit is contained in:
Dave Murphy 2015-03-08 01:07:34 +00:00
commit c71637d9ca
3 changed files with 36 additions and 1 deletions

View File

@ -8,7 +8,7 @@
typedef struct
{
u64 titleID;
u64 unknown;
u64 size;
u16 titleVersion;
u8 unknown2[6];
} TitleList;

View File

@ -82,4 +82,6 @@ Result APT_DoAppJump(Handle* handle, u32 NSbuf0Size, u32 NSbuf1Size, u8 *NSbuf0P
Result APT_PrepareToStartLibraryApplet(Handle* handle, NS_APPID appID);
Result APT_StartLibraryApplet(Handle* handle, NS_APPID appID, Handle inhandle, u32 *parambuf, u32 parambufsize);
Result APT_LaunchLibraryApplet(NS_APPID appID, Handle inhandle, u32 *parambuf, u32 parambufsize);//This should be used for launching library applets, this uses the above APT_StartLibraryApplet/APT_PrepareToStartLibraryApplet funcs + apt*Session(). parambuf is used for APT params input, when the applet closes the output param block is copied here. This is not usable from the homebrew launcher. This is broken: when the applet does get launched at all, the applet process doesn't actually get terminated when the applet gets closed.
Result APT_PrepareToStartSystemApplet(Handle* handle, NS_APPID appID);
Result APT_StartSystemApplet(Handle* handle, NS_APPID appID, u32 bufSize, Handle applHandle, u8 *buf);

View File

@ -1155,3 +1155,36 @@ Result APT_LaunchLibraryApplet(NS_APPID appID, Handle inhandle, u32 *parambuf, u
return 0;
}
Result APT_PrepareToStartSystemApplet(Handle* handle, NS_APPID appID)
{
if(!handle)handle=&aptuHandle;
u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x00190040; //request header code
cmdbuf[1]=appID;
Result ret=0;
if((ret=svcSendSyncRequest(*handle)))return ret;
return cmdbuf[1];
}
Result APT_StartSystemApplet(Handle* handle, NS_APPID appID, u32 bufSize, Handle applHandle, u8 *buf)
{
if(!handle)handle=&aptuHandle;
u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0] = 0x001F0084; //request header code
cmdbuf[1] = appID;
cmdbuf[2] = bufSize;
cmdbuf[3] = 0;
cmdbuf[4] = applHandle;
cmdbuf[5] = (bufSize<<14) | 2;
cmdbuf[6] = (u32)buf;
Result ret=0;
if((ret=svcSendSyncRequest(*handle)))return ret;
return cmdbuf[1];
}