summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar archshift2015-10-18 15:52:37 -0700
committerGravatar archshift2015-10-27 23:33:59 -0700
commit5dfd2dba70b15cead6358b40b980d5be1b32039e (patch)
treebda933874f35988982444c9e4e934fe64a6e0a9c /src/core/file_sys
parentMerge pull request #1194 from linkmauve/no-newline (diff)
downloadyuzu-5dfd2dba70b15cead6358b40b980d5be1b32039e.tar.gz
yuzu-5dfd2dba70b15cead6358b40b980d5be1b32039e.tar.xz
yuzu-5dfd2dba70b15cead6358b40b980d5be1b32039e.zip
Implement FS_User::GetFreeBytes
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/archive_backend.h6
-rw-r--r--src/core/file_sys/disk_archive.cpp5
-rw-r--r--src/core/file_sys/disk_archive.h1
-rw-r--r--src/core/file_sys/ivfc_archive.cpp5
-rw-r--r--src/core/file_sys/ivfc_archive.h1
5 files changed, 18 insertions, 0 deletions
diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h
index c6a1be79d..e7a59a1ed 100644
--- a/src/core/file_sys/archive_backend.h
+++ b/src/core/file_sys/archive_backend.h
@@ -131,6 +131,12 @@ public:
131 * @return Opened directory, or nullptr 131 * @return Opened directory, or nullptr
132 */ 132 */
133 virtual std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const = 0; 133 virtual std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const = 0;
134
135 /**
136 * Get the free space
137 * @return The number of free bytes in the archive
138 */
139 virtual u64 GetFreeBytes() const = 0;
134}; 140};
135 141
136class ArchiveFactory : NonCopyable { 142class ArchiveFactory : NonCopyable {
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp
index e9ecd2b1c..0ba502200 100644
--- a/src/core/file_sys/disk_archive.cpp
+++ b/src/core/file_sys/disk_archive.cpp
@@ -74,6 +74,11 @@ std::unique_ptr<DirectoryBackend> DiskArchive::OpenDirectory(const Path& path) c
74 return std::move(directory); 74 return std::move(directory);
75} 75}
76 76
77u64 DiskArchive::GetFreeBytes() const {
78 // TODO: Stubbed to return 1GiB
79 return 1024 * 1024 * 1024;
80}
81
77//////////////////////////////////////////////////////////////////////////////////////////////////// 82////////////////////////////////////////////////////////////////////////////////////////////////////
78 83
79DiskFile::DiskFile(const DiskArchive& archive, const Path& path, const Mode mode) { 84DiskFile::DiskFile(const DiskArchive& archive, const Path& path, const Mode mode) {
diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h
index aaac65b17..ef9a98057 100644
--- a/src/core/file_sys/disk_archive.h
+++ b/src/core/file_sys/disk_archive.h
@@ -41,6 +41,7 @@ public:
41 bool CreateDirectory(const Path& path) const override; 41 bool CreateDirectory(const Path& path) const override;
42 bool RenameDirectory(const Path& src_path, const Path& dest_path) const override; 42 bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;
43 std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override; 43 std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
44 u64 GetFreeBytes() const override;
44 45
45protected: 46protected:
46 friend class DiskFile; 47 friend class DiskFile;
diff --git a/src/core/file_sys/ivfc_archive.cpp b/src/core/file_sys/ivfc_archive.cpp
index 441ca9b53..2efc31a8c 100644
--- a/src/core/file_sys/ivfc_archive.cpp
+++ b/src/core/file_sys/ivfc_archive.cpp
@@ -59,6 +59,11 @@ std::unique_ptr<DirectoryBackend> IVFCArchive::OpenDirectory(const Path& path) c
59 return Common::make_unique<IVFCDirectory>(); 59 return Common::make_unique<IVFCDirectory>();
60} 60}
61 61
62u64 IVFCArchive::GetFreeBytes() const {
63 LOG_WARNING(Service_FS, "Attempted to get the free space in an IVFC archive");
64 return 0;
65}
66
62//////////////////////////////////////////////////////////////////////////////////////////////////// 67////////////////////////////////////////////////////////////////////////////////////////////////////
63 68
64size_t IVFCFile::Read(const u64 offset, const size_t length, u8* buffer) const { 69size_t IVFCFile::Read(const u64 offset, const size_t length, u8* buffer) const {
diff --git a/src/core/file_sys/ivfc_archive.h b/src/core/file_sys/ivfc_archive.h
index c15a6c4ae..f3fd82de4 100644
--- a/src/core/file_sys/ivfc_archive.h
+++ b/src/core/file_sys/ivfc_archive.h
@@ -42,6 +42,7 @@ public:
42 bool CreateDirectory(const Path& path) const override; 42 bool CreateDirectory(const Path& path) const override;
43 bool RenameDirectory(const Path& src_path, const Path& dest_path) const override; 43 bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;
44 std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override; 44 std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
45 u64 GetFreeBytes() const override;
45 46
46protected: 47protected:
47 std::shared_ptr<FileUtil::IOFile> romfs_file; 48 std::shared_ptr<FileUtil::IOFile> romfs_file;