]> Chaos Git - corbenik/ctrulib.git/commitdiff
Implement NS_LaunchFIRM and NS_LaunchApplicationFIRM (#316) master
authorTuxSH <tuxsh@sfr.fr>
Tue, 27 Sep 2016 21:16:11 +0000 (23:16 +0200)
committerfincs <fincs.alt1@gmail.com>
Tue, 27 Sep 2016 21:16:11 +0000 (23:16 +0200)
libctru/include/3ds/services/ns.h
libctru/source/services/ns.c

index 6616168233e0605397c94320d0841708d276a34c..9b3100a9e873db8e89116fa9aa6d9e866cc0326b 100644 (file)
@@ -10,6 +10,12 @@ Result nsInit(void);
 /// Exits NS.
 void nsExit(void);
 
+/**
+ * @brief Launches a title and the required firmware (only if necessary).
+ * @param titleid ID of the title to launch, 0 for gamecard, JPN System Settings' titleID for System Settings.
+ */
+Result NS_LaunchFIRM(u64 titleid);
+
 /**
  * @brief Launches a title.
  * @param titleid ID of the title to launch, or 0 for gamecard.
@@ -18,6 +24,13 @@ void nsExit(void);
  */
 Result NS_LaunchTitle(u64 titleid, u32 launch_flags, u32 *procid);
 
+/**
+ * @brief Launches a title and the required firmware.
+ * @param titleid ID of the title to launch, 0 for gamecard.
+ * @param flags Flags for firm-launch. bit0: require an application title-info structure in FIRM paramters to be specified via FIRM parameters. bit1: if clear, NS will check certain Configuration Memory fields.
+ */
+Result NS_LaunchApplicationFIRM(u64 titleid, u32 flags);
+
 /**
  * @brief Reboots to a title.
  * @param mediatype Mediatype of the title.
index 97f1547d8b322921f7bb536c3b3414edd4f3cb8c..8c66d7cce34cce4b0de2c5d52cbbada8db17975f 100644 (file)
@@ -25,6 +25,20 @@ void nsExit(void)
        svcCloseHandle(nsHandle);
 }
 
+Result NS_LaunchFIRM(u64 titleid)
+{
+       Result ret = 0;
+       u32 *cmdbuf = getThreadCommandBuffer();
+
+       cmdbuf[0] = IPC_MakeHeader(0x1,3,0); // 0x100C0
+       cmdbuf[1] = titleid & 0xffffffff;
+       cmdbuf[2] = (titleid >> 32) & 0xffffffff;
+       
+       if(R_FAILED(ret = svcSendSyncRequest(nsHandle)))return ret;
+       
+       return (Result)cmdbuf[1];
+}
+
 Result NS_LaunchTitle(u64 titleid, u32 launch_flags, u32 *procid)
 {
        Result ret = 0;
@@ -42,6 +56,21 @@ Result NS_LaunchTitle(u64 titleid, u32 launch_flags, u32 *procid)
        return (Result)cmdbuf[1];
 }
 
+Result NS_LaunchApplicationFIRM(u64 titleid, u32 flags)
+{
+       Result ret = 0;
+       u32 *cmdbuf = getThreadCommandBuffer();
+
+       cmdbuf[0] = IPC_MakeHeader(0x5,3,0); // 0x500C0
+       cmdbuf[1] = titleid & 0xffffffff;
+       cmdbuf[2] = (titleid >> 32) & 0xffffffff;
+       cmdbuf[3] = flags;
+       
+       if(R_FAILED(ret = svcSendSyncRequest(nsHandle)))return ret;
+       
+       return (Result)cmdbuf[1];
+}
+
 Result NS_RebootToTitle(u8 mediatype, u64 titleid)
 {
        Result ret = 0;