From 721a92775d2da30843fc5e1d9887e55dafa0bc3a Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Tue, 16 Apr 2019 14:28:20 -0400 Subject: sdmc_factory: Add SD Card size getters --- src/core/file_sys/sdmc_factory.cpp | 9 +++++++++ src/core/file_sys/sdmc_factory.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/core/file_sys/sdmc_factory.cpp b/src/core/file_sys/sdmc_factory.cpp index a5f1dcc5c..743e2e63a 100644 --- a/src/core/file_sys/sdmc_factory.cpp +++ b/src/core/file_sys/sdmc_factory.cpp @@ -6,6 +6,7 @@ #include "core/file_sys/registered_cache.h" #include "core/file_sys/sdmc_factory.h" #include "core/file_sys/xts_archive.h" +#include "core/settings.h" namespace FileSys { @@ -40,4 +41,12 @@ VirtualDir SDMCFactory::GetImageDirectory() const { return GetOrCreateDirectoryRelative(dir, "/Nintendo/Album"); } +u64 SDMCFactory::GetSDMCFreeSpace() const { + return GetSDMCTotalSpace() - dir->GetSize(); +} + +u64 SDMCFactory::GetSDMCTotalSpace() const { + return static_cast(Settings::values.sdmc_size); +} + } // namespace FileSys diff --git a/src/core/file_sys/sdmc_factory.h b/src/core/file_sys/sdmc_factory.h index abe6cc41c..164fd9435 100644 --- a/src/core/file_sys/sdmc_factory.h +++ b/src/core/file_sys/sdmc_factory.h @@ -28,6 +28,9 @@ public: VirtualDir GetImageDirectory() const; + u64 GetSDMCFreeSpace() const; + u64 GetSDMCTotalSpace() const; + private: VirtualDir dir; -- cgit v1.2.3