Implemented FSUSER_GetProductInfo.

This commit is contained in:
yellows8 2015-11-07 17:35:54 -05:00
parent 6b40ea9d8e
commit fcb370a8c1
2 changed files with 57 additions and 0 deletions

View File

@ -127,6 +127,14 @@ typedef struct
u64 fileSize; //!< file size
} FS_dirent;
/*! ProductInfo. These strings are not NULL-terminated. */
typedef struct
{
char product_code[0x10];
char company_code[0x2];
u16 remaster_version;
} FS_ProductInfo;
Result fsInit(void);
Result fsExit(void);
Handle *fsGetSessionHandle();
@ -150,6 +158,7 @@ Result FSUSER_GetSdmcArchiveResource(Handle *handle, u32 *sectorSize, u32 *clust
Result FSUSER_GetNandArchiveResource(Handle *handle, u32 *sectorSize, u32 *clusterSize, u32 *numClusters, u32 *freeClusters);
Result FSUSER_IsSdmcDetected(Handle *handle, u8 *detected);
Result FSUSER_IsSdmcWritable(Handle *handle, u8 *writable);
Result FSUSER_GetProductInfo(Handle *handle, u32 processid, FS_ProductInfo *out);
Result FSUSER_GetMediaType(Handle *handle, u8* mediatype);
Result FSFILE_Close(Handle handle);

View File

@ -1051,6 +1051,54 @@ FSUSER_IsSdmcDetected(Handle *handle,
return cmdbuf[1];
}
/*! Get the ProductInfo for the specified process.
*
* @param[in] handle fs:USER handle
* @param[in] processid ProcessID
* @param[out] out Output ProductInfo
*
* @returns error
*
* @internal
*
* #### Request
*
* Index Word | Description
* -----------|-------------------------
* 0 | Header code [0x082E0040]
* 1 | u32 processID
*
* #### Response
*
* Index Word | Description
* -----------|-------------------------
* 0 | Header code
* 1 | Result code
* 2-6 | Output ProductInfo
*/
Result
FSUSER_GetProductInfo(Handle *handle,
u32 processid,
FS_ProductInfo *out)
{
if(!handle)
handle = &fsuHandle;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = 0x082E0040;
cmdbuf[1] = processid;
Result ret = 0;
if((ret = svcSendSyncRequest(*handle)))
return ret;
if(out)
memcpy(out, &cmdbuf[2], sizeof(FS_ProductInfo));
return cmdbuf[1];
}
/*! Get curent process mediatype
*
* @param[in] handle fs:USER handle