]> Chaos Git - corbenik/ctrulib.git/commitdiff
Implemented functions to start system applets.
authorprofi200 <fd3194@gmx.de>
Sat, 7 Mar 2015 17:37:43 +0000 (18:37 +0100)
committerprofi200 <fd3194@gmx.de>
Sat, 7 Mar 2015 21:10:18 +0000 (22:10 +0100)
libctru/include/3ds/services/am.h
libctru/include/3ds/services/apt.h
libctru/source/services/apt.c

index 3eb1501671970382119283cfcb551b8cddbb57f0..eaf7379ccd08f3b9e34fe99625d175371b601e83 100644 (file)
@@ -8,7 +8,7 @@
 typedef struct
 {
        u64 titleID;
-       u64 unknown;
+       u64 size;
        u16 titleVersion;
        u8 unknown2[6];
 } TitleList;
index 15db7b763e1d349c0879ec24ba66fe3845a14559..368731ce60493016aca579bf87a41b38769af0b1 100644 (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);
 
index 9560c79cb8abb65c20431a0f587539fa12eb07b7..036b09732c0250caf69f36fc651933c3bc84695e 100644 (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];
+}
+