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);
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];
+}
+