]> Chaos Git - corbenik/ctrulib.git/commitdiff
Added bossGetNsDataHeaderInfo() and enums for it + added a comment for bossTaskStatus.
authoryellows8 <yellows8@users.noreply.github.com>
Tue, 10 Jan 2017 23:08:15 +0000 (18:08 -0500)
committeryellows8 <yellows8@users.noreply.github.com>
Tue, 10 Jan 2017 23:08:15 +0000 (18:08 -0500)
libctru/include/3ds/services/boss.h
libctru/source/services/boss.c

index aad3ce4210518083c2fdfefbb88d9261af77ff60..10f9202acaffd8c94ef5b9b3689328607765f217 100644 (file)
@@ -39,11 +39,22 @@ typedef struct
        u8 property_x3e[0x200];
 } bossContext;
 
+/// BOSS task status.
 typedef enum {
        BOSSTASKSTATUS_STARTED = 0x2,
        BOSSTASKSTATUS_ERROR = 0x7,
 } bossTaskStatus;
 
+/// Type values for bossGetNsDataHeaderInfo().
+typedef enum {
+       bossNsDataHeaderInfoType_ContentSize = 0x3 /// Size of the content.
+} bossNsDataHeaderInfoTypes;
+
+/// Size of the output data for bossGetNsDataHeaderInfo().
+typedef enum {
+       bossNsDataHeaderInfoTypeSize_ContentSize = 0x4 ///Type2
+} bossNsDataHeaderInfoTypeSizes;
+
 /**
  * @brief Initializes BOSS.
  * @param programID programID to use, 0 for the current process. Only used when BOSSP is available without *hax payload.
@@ -98,6 +109,15 @@ Result bossSendProperty(u16 PropertyID, const void* buf, u32 size);
  */
 Result bossDeleteNsData(u32 NsDataId);
 
+/**
+ * @brief Gets header info for the specified NsDataId.
+ * @param NsDataId NsDataId
+ * @param type Type of data to load.
+ * @param buffer Output buffer.
+ * @param size Output buffer size.
+ */
+Result bossGetNsDataHeaderInfo(u32 NsDataId, u8 type, void* buffer, u32 size);
+
 /**
  * @brief Reads data from the content for the specified NsDataId.
  * @param NsDataId NsDataId
index 26cd8999657d5c14a703788da623bce949d52fbe..1d669fc07b5badc08ae2c6a1ceec199b06a38f0c 100644 (file)
@@ -247,6 +247,23 @@ Result bossDeleteNsData(u32 NsDataId)
        return (Result)cmdbuf[1];
 }
 
+Result bossGetNsDataHeaderInfo(u32 NsDataId, u8 type, void* buffer, u32 size)
+{
+       Result ret = 0;
+       u32 *cmdbuf = getThreadCommandBuffer();
+
+       cmdbuf[0] = IPC_MakeHeader(0x27,3,2); // 0x2700C2
+       cmdbuf[1] = NsDataId;
+       cmdbuf[2] = type;
+       cmdbuf[3] = size;
+       cmdbuf[4] = IPC_Desc_Buffer(size, IPC_BUFFER_W);
+       cmdbuf[5] = (u32)buffer;
+
+       if(R_FAILED(ret = svcSendSyncRequest(bossHandle)))return ret;
+
+       return (Result)cmdbuf[1];
+}
+
 Result bossReadNsData(u32 NsDataId, u64 offset, void* buffer, u32 size, u32 *transfer_total, u32 *unk_out)
 {
        Result ret = 0;