summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2019-04-16 20:27:34 +0200
committerZach Hilman <zachhilman@gmail.com>2019-09-21 22:43:10 +0200
commite47b57a90fb2123a2c4d98f4f990b61976c0ea1f (patch)
tree248e411b62e6172107b9299130445957bccc82cc /src/core
parentfilesystem: Add FileSystemController to deglobalize FS services (diff)
downloadyuzu-e47b57a90fb2123a2c4d98f4f990b61976c0ea1f.tar
yuzu-e47b57a90fb2123a2c4d98f4f990b61976c0ea1f.tar.gz
yuzu-e47b57a90fb2123a2c4d98f4f990b61976c0ea1f.tar.bz2
yuzu-e47b57a90fb2123a2c4d98f4f990b61976c0ea1f.tar.lz
yuzu-e47b57a90fb2123a2c4d98f4f990b61976c0ea1f.tar.xz
yuzu-e47b57a90fb2123a2c4d98f4f990b61976c0ea1f.tar.zst
yuzu-e47b57a90fb2123a2c4d98f4f990b61976c0ea1f.zip
Diffstat (limited to '')
-rw-r--r--src/core/file_sys/bis_factory.cpp32
-rw-r--r--src/core/file_sys/bis_factory.h6
2 files changed, 38 insertions, 0 deletions
diff --git a/src/core/file_sys/bis_factory.cpp b/src/core/file_sys/bis_factory.cpp
index 6cd0a98eb..8f758d6d9 100644
--- a/src/core/file_sys/bis_factory.cpp
+++ b/src/core/file_sys/bis_factory.cpp
@@ -3,8 +3,12 @@
// Refer to the license.txt file included.
#include <fmt/format.h>
+#include "common/file_util.h"
+#include "core/core.h"
#include "core/file_sys/bis_factory.h"
+#include "core/file_sys/mode.h"
#include "core/file_sys/registered_cache.h"
+#include "core/settings.h"
namespace FileSys {
@@ -104,4 +108,32 @@ VirtualDir BISFactory::GetImageDirectory() const {
return GetOrCreateDirectoryRelative(nand_root, "/user/Album");
}
+u64 BISFactory::GetSystemNANDFreeSpace() const {
+ const auto sys_dir = GetOrCreateDirectoryRelative(nand_root, "/system");
+ if (sys_dir == nullptr)
+ return 0;
+
+ return GetSystemNANDTotalSpace() - sys_dir->GetSize();
+}
+
+u64 BISFactory::GetSystemNANDTotalSpace() const {
+ return static_cast<u64>(Settings::values.nand_system_size);
+}
+
+u64 BISFactory::GetUserNANDFreeSpace() const {
+ const auto usr_dir = GetOrCreateDirectoryRelative(nand_root, "/user");
+ if (usr_dir == nullptr)
+ return 0;
+
+ return GetUserNANDTotalSpace() - usr_dir->GetSize();
+}
+
+u64 BISFactory::GetUserNANDTotalSpace() const {
+ return static_cast<u64>(Settings::values.nand_user_size);
+}
+
+u64 BISFactory::GetFullNANDTotalSpace() const {
+ return static_cast<u64>(Settings::values.nand_total_size);
+}
+
} // namespace FileSys
diff --git a/src/core/file_sys/bis_factory.h b/src/core/file_sys/bis_factory.h
index 6229cd5a9..bdfe728c9 100644
--- a/src/core/file_sys/bis_factory.h
+++ b/src/core/file_sys/bis_factory.h
@@ -55,6 +55,12 @@ public:
VirtualDir GetImageDirectory() const;
+ u64 GetSystemNANDFreeSpace() const;
+ u64 GetSystemNANDTotalSpace() const;
+ u64 GetUserNANDFreeSpace() const;
+ u64 GetUserNANDTotalSpace() const;
+ u64 GetFullNANDTotalSpace() const;
+
private:
VirtualDir nand_root;
VirtualDir load_root;