Result FSUSER_CreateDirectory(Handle* handle, FS_archive archive, FS_path dirLowPath);
Result FSUSER_DeleteFile(Handle *handle, FS_archive archive, FS_path fileLowPath);
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_Read(Handle handle, u32 *bytesRead, u64 offset, void *buffer, u32 size);
#include <string.h>
-#include <3ds/types.h>
-#include <3ds/FS.h>
-#include <3ds/srv.h>
-#include <3ds/svc.h>
+#include <3ds.h>
/*! @internal
*
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
*
* @param[in] handle Open file handle