summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorarchshift <gh@archshift.com>2015-10-19 00:52:37 +0200
committerarchshift <gh@archshift.com>2015-10-28 07:33:59 +0100
commit5dfd2dba70b15cead6358b40b980d5be1b32039e (patch)
treebda933874f35988982444c9e4e934fe64a6e0a9c /src/core/file_sys
parentMerge pull request #1194 from linkmauve/no-newline (diff)
downloadyuzu-5dfd2dba70b15cead6358b40b980d5be1b32039e.tar
yuzu-5dfd2dba70b15cead6358b40b980d5be1b32039e.tar.gz
yuzu-5dfd2dba70b15cead6358b40b980d5be1b32039e.tar.bz2
yuzu-5dfd2dba70b15cead6358b40b980d5be1b32039e.tar.lz
yuzu-5dfd2dba70b15cead6358b40b980d5be1b32039e.tar.xz
yuzu-5dfd2dba70b15cead6358b40b980d5be1b32039e.tar.zst
yuzu-5dfd2dba70b15cead6358b40b980d5be1b32039e.zip
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:
* @return Opened directory, or nullptr
*/
virtual std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const = 0;
+
+ /**
+ * Get the free space
+ * @return The number of free bytes in the archive
+ */
+ virtual u64 GetFreeBytes() const = 0;
};
class 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
return std::move(directory);
}
+u64 DiskArchive::GetFreeBytes() const {
+ // TODO: Stubbed to return 1GiB
+ return 1024 * 1024 * 1024;
+}
+
////////////////////////////////////////////////////////////////////////////////////////////////////
DiskFile::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:
bool CreateDirectory(const Path& path) const override;
bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;
std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
+ u64 GetFreeBytes() const override;
protected:
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
return Common::make_unique<IVFCDirectory>();
}
+u64 IVFCArchive::GetFreeBytes() const {
+ LOG_WARNING(Service_FS, "Attempted to get the free space in an IVFC archive");
+ return 0;
+}
+
////////////////////////////////////////////////////////////////////////////////////////////////////
size_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:
bool CreateDirectory(const Path& path) const override;
bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;
std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
+ u64 GetFreeBytes() const override;
protected:
std::shared_ptr<FileUtil::IOFile> romfs_file;