Added bossGetNsDataHeaderInfo() and enums for it + added a comment for bossTaskStatus.

This commit is contained in:
yellows8 2017-01-10 18:08:15 -05:00
parent d42efe636b
commit 6e107a1aa5
2 changed files with 37 additions and 0 deletions

View File

@ -39,11 +39,22 @@ typedef struct
u8 property_x3e[0x200]; u8 property_x3e[0x200];
} bossContext; } bossContext;
/// BOSS task status.
typedef enum { typedef enum {
BOSSTASKSTATUS_STARTED = 0x2, BOSSTASKSTATUS_STARTED = 0x2,
BOSSTASKSTATUS_ERROR = 0x7, BOSSTASKSTATUS_ERROR = 0x7,
} bossTaskStatus; } 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. * @brief Initializes BOSS.
* @param programID programID to use, 0 for the current process. Only used when BOSSP is available without *hax payload. * @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); 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. * @brief Reads data from the content for the specified NsDataId.
* @param NsDataId NsDataId * @param NsDataId NsDataId

View File

@ -247,6 +247,23 @@ Result bossDeleteNsData(u32 NsDataId)
return (Result)cmdbuf[1]; 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 bossReadNsData(u32 NsDataId, u64 offset, void* buffer, u32 size, u32 *transfer_total, u32 *unk_out)
{ {
Result ret = 0; Result ret = 0;