Add FSUSER_IsSdmcDetected() and FSUSER_IsSdmcWritable().
This commit is contained in:
parent
589c59fab7
commit
cad12973c8
@ -139,6 +139,8 @@ Result FSUSER_CloseArchive(Handle* handle, FS_archive* archive);
|
|||||||
Result FSUSER_CreateDirectory(Handle* handle, FS_archive archive, FS_path dirLowPath);
|
Result FSUSER_CreateDirectory(Handle* handle, FS_archive archive, FS_path dirLowPath);
|
||||||
Result FSUSER_DeleteFile(Handle *handle, FS_archive archive, FS_path fileLowPath);
|
Result FSUSER_DeleteFile(Handle *handle, FS_archive archive, FS_path fileLowPath);
|
||||||
Result FSUSER_DeleteDirectory(Handle *handle, FS_archive archive, FS_path dirLowPath);
|
Result FSUSER_DeleteDirectory(Handle *handle, FS_archive archive, FS_path dirLowPath);
|
||||||
|
Result FSUSER_IsSdmcDetected(Handle *handle);
|
||||||
|
Result FSUSER_IsSdmcWritable(Handle *handle);
|
||||||
|
|
||||||
Result FSFILE_Close(Handle handle);
|
Result FSFILE_Close(Handle handle);
|
||||||
Result FSFILE_Read(Handle handle, u32 *bytesRead, u64 offset, void *buffer, u32 size);
|
Result FSFILE_Read(Handle handle, u32 *bytesRead, u64 offset, void *buffer, u32 size);
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <3ds/types.h>
|
#include <3ds.h>
|
||||||
#include <3ds/FS.h>
|
|
||||||
#include <3ds/srv.h>
|
|
||||||
#include <3ds/svc.h>
|
|
||||||
|
|
||||||
/*! @internal
|
/*! @internal
|
||||||
*
|
*
|
||||||
@ -609,6 +606,82 @@ FSUSER_CloseArchive(Handle *handle,
|
|||||||
return cmdbuf[1];
|
return cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Check if SD card is detected
|
||||||
|
*
|
||||||
|
* @param[in] handle fs:USER handle
|
||||||
|
*
|
||||||
|
* @returns error
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* #### Request
|
||||||
|
*
|
||||||
|
* Index Word | Description
|
||||||
|
* -----------|-------------------------
|
||||||
|
* 0 | Header code [0x08170000]
|
||||||
|
*
|
||||||
|
* #### Response
|
||||||
|
*
|
||||||
|
* Index Word | Description
|
||||||
|
* -----------|-------------------------
|
||||||
|
* 0 | Header code
|
||||||
|
* 1 | Result code
|
||||||
|
*/
|
||||||
|
Result
|
||||||
|
FSUSER_IsSdmcDetected(Handle *handle)
|
||||||
|
{
|
||||||
|
if(!handle)
|
||||||
|
handle = &fsuHandle;
|
||||||
|
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = 0x08170000;
|
||||||
|
|
||||||
|
Result ret = 0;
|
||||||
|
if((ret = svcSendSyncRequest(*handle)))
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return cmdbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! Check if SD card is writable
|
||||||
|
*
|
||||||
|
* @param[in] handle fs:USER handle
|
||||||
|
*
|
||||||
|
* @returns error
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* #### Request
|
||||||
|
*
|
||||||
|
* Index Word | Description
|
||||||
|
* -----------|-------------------------
|
||||||
|
* 0 | Header code [0x08180000]
|
||||||
|
*
|
||||||
|
* #### Response
|
||||||
|
*
|
||||||
|
* Index Word | Description
|
||||||
|
* -----------|-------------------------
|
||||||
|
* 0 | Header code
|
||||||
|
* 1 | Result code
|
||||||
|
*/
|
||||||
|
Result
|
||||||
|
FSUSER_IsSdmcWritable(Handle *handle)
|
||||||
|
{
|
||||||
|
if(!handle)
|
||||||
|
handle = &fsuHandle;
|
||||||
|
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = 0x08180000;
|
||||||
|
|
||||||
|
Result ret = 0;
|
||||||
|
if((ret = svcSendSyncRequest(*handle)))
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return cmdbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
/*! Close an open file
|
/*! Close an open file
|
||||||
*
|
*
|
||||||
* @param[in] handle Open file handle
|
* @param[in] handle Open file handle
|
||||||
|
Loading…
Reference in New Issue
Block a user