2017-09-15 16:16:13 +00:00
|
|
|
#include "storage.h"
|
|
|
|
|
2018-07-31 18:59:17 +00:00
|
|
|
u64 Storage_GetFreeStorage(FS_SystemMediaType mediaType)
|
2017-09-15 16:16:13 +00:00
|
|
|
{
|
2018-07-31 18:59:17 +00:00
|
|
|
FS_ArchiveResource resource = {0};
|
2017-09-15 16:16:13 +00:00
|
|
|
|
|
|
|
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, mediaType)))
|
|
|
|
return (((u64) resource.freeClusters * (u64) resource.clusterSize));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-07-31 18:59:17 +00:00
|
|
|
u64 Storage_GetTotalStorage(FS_SystemMediaType mediaType)
|
2017-09-15 16:16:13 +00:00
|
|
|
{
|
2018-07-31 18:59:17 +00:00
|
|
|
FS_ArchiveResource resource = {0};
|
2017-09-15 16:16:13 +00:00
|
|
|
|
|
|
|
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, mediaType)))
|
|
|
|
return (((u64) resource.totalClusters * (u64) resource.clusterSize));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-07-31 18:59:17 +00:00
|
|
|
u64 Storage_GetUsedStorage(FS_SystemMediaType mediaType)
|
2017-09-15 16:16:13 +00:00
|
|
|
{
|
2018-07-31 18:59:17 +00:00
|
|
|
FS_ArchiveResource resource = {0};
|
2017-09-15 16:16:13 +00:00
|
|
|
|
|
|
|
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, mediaType)))
|
|
|
|
return ((((u64) resource.totalClusters * (u64) resource.clusterSize)) - (((u64) resource.freeClusters * (u64) resource.clusterSize)));
|
|
|
|
|
|
|
|
return 0;
|
2018-07-31 18:59:17 +00:00
|
|
|
}
|