mirror of
https://github.com/joel16/3DSident.git
synced 2024-11-26 21:10:24 +00:00
99fc2e4c58
Basically cleaning up and making sure functions succeed before returning the result.
31 lines
817 B
C
31 lines
817 B
C
#include "storage.h"
|
|
|
|
u64 getFreeStorage(FS_SystemMediaType mediaType)
|
|
{
|
|
FS_ArchiveResource resource = {0};
|
|
|
|
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, mediaType)))
|
|
return (((u64) resource.freeClusters * (u64) resource.clusterSize));
|
|
|
|
return 0;
|
|
}
|
|
|
|
u64 getTotalStorage(FS_SystemMediaType mediaType)
|
|
{
|
|
FS_ArchiveResource resource = {0};
|
|
|
|
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, mediaType)))
|
|
return (((u64) resource.totalClusters * (u64) resource.clusterSize));
|
|
|
|
return 0;
|
|
}
|
|
|
|
u64 getUsedStorage(FS_SystemMediaType mediaType)
|
|
{
|
|
FS_ArchiveResource resource = {0};
|
|
|
|
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, mediaType)))
|
|
return ((((u64) resource.totalClusters * (u64) resource.clusterSize)) - (((u64) resource.freeClusters * (u64) resource.clusterSize)));
|
|
|
|
return 0;
|
|
} |