]> Chaos Git - corbenik/ctrulib.git/commitdiff
Implementing AM_InstallFirm
authorTuxSH <tuxsh@sfr.fr>
Sun, 3 Jan 2016 18:38:41 +0000 (19:38 +0100)
committerTuxSH <tuxsh@sfr.fr>
Sun, 3 Jan 2016 18:38:41 +0000 (19:38 +0100)
libctru/include/3ds/services/am.h
libctru/source/services/am.c

index 31f4b06035357dabd69bb7a1f64aef1733b160f7..9f0ef8bf2213934a70722357856d09e641b232da 100644 (file)
@@ -97,6 +97,9 @@ Result AM_DeleteAppTitle(u8 mediatype, u64 titleID);
 /// Installs the current NATIVE_FIRM title to NAND (firm0:/ & firm1:/)
 Result AM_InstallNativeFirm(void);
 
+/// Similar to InstallNativeFirm, but doesn't use AMPXI_GetTitleList (NATIVE_FIRM: 0004013800000002 or 0004013820000002 (N3DS))
+Result AM_InstallFirm(u64 titleID);
+
 /**
  * @brief Gets the product code of a title.
  * @param mediatype Mediatype of the title.
index 509ca3e583d233a060cd75a0c334e59357c21784..1de3605df68059497b43bc64b761a7b941f0851b 100644 (file)
@@ -199,6 +199,19 @@ Result AM_InstallNativeFirm(void)
        return (Result)cmdbuf[1];
 }
 
+Result AM_InstallFirm(u64 titleID){
+       Result ret = 0;
+       u32 *cmdbuf = getThreadCommandBuffer();
+
+       cmdbuf[0] = IPC_MakeHeader(0x401,2,0); // 0x04010080
+       cmdbuf[1] = titleID & 0xffffffff;
+       cmdbuf[2] = (u32)(titleID >> 32);
+
+       if(R_FAILED(ret = svcSendSyncRequest(amHandle))) return ret;
+
+       return (Result)cmdbuf[1];
+}
+
 Result AM_GetTitleProductCode(u8 mediatype, u64 titleID, char* productCode)
 {
        Result ret = 0;