diff --git a/libctru/include/3ds/services/fs.h b/libctru/include/3ds/services/fs.h index d26920f..28628aa 100644 --- a/libctru/include/3ds/services/fs.h +++ b/libctru/include/3ds/services/fs.h @@ -139,8 +139,8 @@ Result FSUSER_CloseArchive(Handle* handle, FS_archive* archive); 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 FSUSER_IsSdmcDetected(Handle *handle, u32 *detected); +Result FSUSER_IsSdmcWritable(Handle *handle, u32 *writable); Result FSFILE_Close(Handle handle); Result FSFILE_Read(Handle handle, u32 *bytesRead, u64 offset, void *buffer, u32 size); diff --git a/libctru/source/services/fs.c b/libctru/source/services/fs.c index 4216e85..99fcec4 100644 --- a/libctru/source/services/fs.c +++ b/libctru/source/services/fs.c @@ -608,7 +608,8 @@ FSUSER_CloseArchive(Handle *handle, /*! Check if SD card is detected * - * @param[in] handle fs:USER handle + * @param[in] handle fs:USER handle + * @param[out] detected Output detected state * * @returns error * @@ -628,7 +629,8 @@ FSUSER_CloseArchive(Handle *handle, * 1 | Result code */ Result -FSUSER_IsSdmcDetected(Handle *handle) +FSUSER_IsSdmcDetected(Handle *handle, + u32 *detected) { if(!handle) handle = &fsuHandle; @@ -641,12 +643,16 @@ FSUSER_IsSdmcDetected(Handle *handle) if((ret = svcSendSyncRequest(*handle))) return ret; + if(detected) + *detected = cmdbuf[2]; + return cmdbuf[1]; } /*! Check if SD card is writable * - * @param[in] handle fs:USER handle + * @param[in] handle fs:USER handle + * @param[out] writable Output writable state * * @returns error * @@ -666,7 +672,8 @@ FSUSER_IsSdmcDetected(Handle *handle) * 1 | Result code */ Result -FSUSER_IsSdmcWritable(Handle *handle) +FSUSER_IsSdmcWritable(Handle *handle, + u32 *writable) { if(!handle) handle = &fsuHandle; @@ -679,6 +686,9 @@ FSUSER_IsSdmcWritable(Handle *handle) if((ret = svcSendSyncRequest(*handle))) return ret; + if(writable) + *writable = cmdbuf[2]; + return cmdbuf[1]; }