Result AM_InstallTicketAbort(Handle ticketHandle);
/**
- * @brief Finalizes installing a ticket.
+ * @brief Finishes installing a ticket.
* @param ticketHandle Handle of the installation to finalize.
*/
-Result AM_InstallTicketFinalize(Handle ticketHandle);
+Result AM_InstallTicketFinish(Handle ticketHandle);
/**
* @brief Begins installing a title.
* @param mediaType Destination to install to.
* @param titleId ID of the title to install.
+ * @param unk Unknown. (usually false)
*/
-Result AM_InstallTitleBegin(FS_MediaType mediaType, u64 titleId);
+Result AM_InstallTitleBegin(FS_MediaType mediaType, u64 titleId, bool unk);
-/// Aborts installing a title.
-Result AM_InstallTitleAbort();
+/// Stops installing a title, generally to be resumed later.
+Result AM_InstallTitleStop();
/**
* @brief Resumes installing a title.
*/
Result AM_InstallTitleResume(FS_MediaType mediaType, u64 titleId);
-/// Aborts installing a title due to a TMD error.
-Result AM_InstallTitleAbortTMD();
+/// Aborts installing a title.
+Result AM_InstallTitleAbort();
/// Finishes installing a title.
Result AM_InstallTitleFinish();
+/**
+ * @brief Commits installed titles.
+ * @param mediaType Location of the titles to finalize.
+ * @param titleCount Number of titles to finalize.
+ * @param temp Whether the titles being finalized are in the temporary database.
+ * @param titleIds Title IDs to finalize.
+ */
+Result AM_CommitImportTitles(FS_MediaType mediaType, u32 titleCount, bool temp, u64* titleIds);
+
/**
* @brief Begins installing a TMD.
* @param[out] tmdHandle Pointer to output a handle to write TMD data to.
Result AM_InstallTmdAbort(Handle tmdHandle);
/**
- * @brief Finalizes installing a TMD.
+ * @brief Finishes installing a TMD.
* @param tmdHandle Handle of the installation to finalize.
+ * @param unk Unknown. (usually true)
+ */
+Result AM_InstallTmdFinish(Handle tmdHandle, bool unk);
+
+/**
+ * @brief Prepares to import title contents.
+ * @param contentCount Number of contents to be imported.
+ * @param contentIndices Indices of the contents to be imported.
*/
-Result AM_InstallTmdFinalize(Handle tmdHandle);
+Result AM_CreateImportContentContexts(u32 contentCount, u16* contentIndices);
/**
* @brief Begins installing title content.
Result AM_InstallContentBegin(Handle *contentHandle, u16 index);
/**
- * @brief Aborts installing title content.
+ * @brief Stops installing title content, generally to be resumed later.
* @param contentHandle Handle of the installation to abort.
*/
-Result AM_InstallContentAbort(Handle contentHandle);
+Result AM_InstallContentStop(Handle contentHandle);
/**
* @brief Resumes installing title content.
Result AM_InstallContentResume(Handle *contentHandle, u64* resumeOffset, u16 index);
/**
- * @brief Finalizes installing title content.
+ * @brief Cancels installing title content.
+ * @param contentHandle Handle of the installation to finalize.
+ */
+Result AM_InstallContentCancel(Handle contentHandle);
+
+/**
+ * @brief Finishes installing title content.
* @param contentHandle Handle of the installation to finalize.
*/
-Result AM_InstallContentFinalize(Handle contentHandle);
+Result AM_InstallContentFinish(Handle contentHandle);
+
+/**
+ * @brief Imports up to four certificates into the ticket certificate chain.
+ * @param cert1Size Size of the first certificate.
+ * @param cert1 Data of the first certificate.
+ * @param cert2Size Size of the second certificate.
+ * @param cert2 Data of the second certificate.
+ * @param cert3Size Size of the third certificate.
+ * @param cert3 Data of the third certificate.
+ * @param cert4Size Size of the fourth certificate.
+ * @param cert4 Data of the fourth certificate.
+ */
+Result AM_ImportCertificates(u32 cert1Size, void* cert1, u32 cert2Size, void* cert2, u32 cert3Size, void* cert3, u32 cert4Size, void* cert4);
+
+/**
+ * @brief Imports a certificate into the ticket certificate chain.
+ * @param certSize Size of the certificate.
+ * @param cert Data of the certificate.
+ */
+Result AM_ImportCertificate(u32 certSize, void* cert);
/**
- * @brief Finalizes the installation of one or more titles.
+ * @brief Commits installed titles, and updates FIRM if necessary.
* @param mediaType Location of the titles to finalize.
* @param titleCount Number of titles to finalize.
* @param temp Whether the titles being finalized are in the temporary database.
* @param titleIds Title IDs to finalize.
*/
-Result AM_InstallTitlesFinish(FS_MediaType mediaType, u32 titleCount, bool temp, u64* titleIds);
+Result AM_CommitImportTitlesAndUpdateFirmwareAuto(FS_MediaType mediaType, u32 titleCount, bool temp, u64* titleIds);
return (Result)cmdbuf[1];
}
-Result AM_InstallTicketFinalize(Handle ticketHandle)
+Result AM_InstallTicketFinish(Handle ticketHandle)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
return (Result)cmdbuf[1];
}
-Result AM_InstallTitleBegin(FS_MediaType mediaType, u64 titleId)
+Result AM_InstallTitleBegin(FS_MediaType mediaType, u64 titleId, bool unk)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[1] = mediaType;
cmdbuf[2] = (u32) (titleId & 0xFFFFFFFF);
cmdbuf[3] = (u32) ((titleId >> 32) & 0xFFFFFFFF);
- cmdbuf[4] = 0;
+ cmdbuf[4] = unk;
if(R_FAILED(ret = svcSendSyncRequest(amHandle))) return ret;
return (Result)cmdbuf[1];
}
-Result AM_InstallTitleAbort()
+Result AM_InstallTitleStop()
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
return (Result)cmdbuf[1];
}
-Result AM_InstallTitleAbortTMD()
+
+Result AM_InstallTitleAbort()
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
return (Result)cmdbuf[1];
}
+Result AM_CommitImportTitles(FS_MediaType mediaType, u32 titleCount, bool temp, u64* titleIds)
+{
+ Result ret = 0;
+ u32 *cmdbuf = getThreadCommandBuffer();
+
+ cmdbuf[0] = IPC_MakeHeader(0x809,3,2); // 0x080900C2
+ cmdbuf[1] = mediaType;
+ cmdbuf[2] = titleCount;
+ cmdbuf[3] = temp ? 1 : 0;
+ cmdbuf[4] = IPC_Desc_Buffer(titleCount * 8, IPC_BUFFER_R);
+ cmdbuf[5] = (u32)titleIds;
+
+ if(R_FAILED(ret = svcSendSyncRequest(amHandle))) return ret;
+
+ return (Result)cmdbuf[1];
+}
+
Result AM_InstallTmdBegin(Handle *tmdHandle)
{
Result ret = 0;
return (Result)cmdbuf[1];
}
-Result AM_InstallTmdFinalize(Handle tmdHandle)
+Result AM_InstallTmdFinish(Handle tmdHandle, bool unk)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x80C,1,2); // 0x080C0042
- cmdbuf[1] = 1;
+ cmdbuf[1] = unk;
cmdbuf[2] = IPC_Desc_MoveHandles(1);
cmdbuf[3] = tmdHandle;
return (Result)cmdbuf[1];
}
+Result AM_CreateImportContentContexts(u32 contentCount, u16* contentIndices)
+{
+ Result ret = 0;
+ u32 *cmdbuf = getThreadCommandBuffer();
+
+ cmdbuf[0] = IPC_MakeHeader(0x80D,1,2); // 0x080D0042
+ cmdbuf[1] = contentCount;
+ cmdbuf[2] = IPC_Desc_Buffer(contentCount * 2, IPC_BUFFER_R);
+ cmdbuf[3] = (u32)contentIndices;
+
+ if(R_FAILED(ret = svcSendSyncRequest(amHandle))) return ret;
+
+ return (Result)cmdbuf[1];
+}
+
Result AM_InstallContentBegin(Handle *contentHandle, u16 index)
{
Result ret = 0;
return (Result)cmdbuf[1];
}
-Result AM_InstallContentAbort(Handle contentHandle)
+Result AM_InstallContentStop(Handle contentHandle)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
return (Result)cmdbuf[1];
}
-Result AM_InstallContentFinalize(Handle contentHandle)
+Result AM_InstallContentCancel(Handle contentHandle)
+{
+ Result ret = 0;
+ u32 *cmdbuf = getThreadCommandBuffer();
+
+ cmdbuf[0] = IPC_MakeHeader(0x811,0,2); // 0x08110002
+ cmdbuf[1] = IPC_Desc_MoveHandles(1);
+ cmdbuf[2] = contentHandle;
+
+ if(R_FAILED(ret = svcSendSyncRequest(amHandle))) return ret;
+
+ return (Result)cmdbuf[1];
+}
+
+Result AM_InstallContentFinish(Handle contentHandle)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
return (Result)cmdbuf[1];
}
-Result AM_InstallTitlesFinish(FS_MediaType mediaType, u32 titleCount, bool temp, u64* titleIds)
+Result AM_ImportCertificates(u32 cert1Size, void* cert1, u32 cert2Size, void* cert2, u32 cert3Size, void* cert3, u32 cert4Size, void* cert4)
+{
+ Result ret = 0;
+ u32 *cmdbuf = getThreadCommandBuffer();
+
+ cmdbuf[0] = IPC_MakeHeader(0x819,4,8); // 0x08190108
+ cmdbuf[1] = cert1Size;
+ cmdbuf[2] = cert2Size;
+ cmdbuf[3] = cert3Size;
+ cmdbuf[4] = cert4Size;
+ cmdbuf[5] = IPC_Desc_Buffer(cert1Size, IPC_BUFFER_R);
+ cmdbuf[6] = (u32)cert1;
+ cmdbuf[7] = IPC_Desc_Buffer(cert2Size, IPC_BUFFER_R);
+ cmdbuf[8] = (u32)cert2;
+ cmdbuf[9] = IPC_Desc_Buffer(cert3Size, IPC_BUFFER_R);
+ cmdbuf[10] = (u32)cert3;
+ cmdbuf[11] = IPC_Desc_Buffer(cert4Size, IPC_BUFFER_R);
+ cmdbuf[12] = (u32)cert4;
+
+ if(R_FAILED(ret = svcSendSyncRequest(amHandle))) return ret;
+
+ return (Result)cmdbuf[1];
+}
+
+Result AM_ImportCertificate(u32 certSize, void* cert)
+{
+ Result ret = 0;
+ u32 *cmdbuf = getThreadCommandBuffer();
+
+ cmdbuf[0] = IPC_MakeHeader(0x81A,1,2); // 0x081A0042
+ cmdbuf[1] = certSize;
+ cmdbuf[2] = IPC_Desc_Buffer(certSize, IPC_BUFFER_R);
+ cmdbuf[3] = (u32)cert;
+
+ if(R_FAILED(ret = svcSendSyncRequest(amHandle))) return ret;
+
+ return (Result)cmdbuf[1];
+}
+
+Result AM_CommitImportTitlesAndUpdateFirmwareAuto(FS_MediaType mediaType, u32 titleCount, bool temp, u64* titleIds)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();