Added FSUSER_GetMediaType

This commit is contained in:
smea 2015-10-02 23:05:30 -07:00
parent 6590ed3fad
commit 87b9d1302a
2 changed files with 44 additions and 0 deletions

View File

@ -150,6 +150,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_GetMediaType(Handle *handle, u8* mediatype);
Result FSFILE_Close(Handle handle);
Result FSFILE_Read(Handle handle, u32 *bytesRead, u64 offset, void *buffer, u32 size);

View File

@ -1051,6 +1051,49 @@ FSUSER_IsSdmcDetected(Handle *handle,
return cmdbuf[1];
}
/*! Close an open file
*
* @param[in] handle fs:USER handle
* @param[out] mediatype Output curent process mediatype
*
* @returns error
*
* @internal
*
* #### Request
*
* Index Word | Description
* -----------|-------------------------
* 0 | Header code [0x08680000]
*
* #### Response
*
* Index Word | Description
* -----------|-------------------------
* 0 | Header code
* 1 | Result code
*/
Result
FSUSER_GetMediaType(Handle *handle,
u8* mediatype)
{
if(!handle)
handle = &fsuHandle;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = 0x08680000;
Result ret = 0;
if((ret = svcSendSyncRequest(*handle)))
return ret;
if(mediatype)
*mediatype = cmdbuf[2];
return cmdbuf[1];
}
/*! Check if SD card is writable
*
* @param[in] handle fs:USER handle