summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-01-19 22:34:48 -0500
committerGravatar bunnei2018-01-21 15:39:26 -0500
commit00851a5ef442947c4237f32e063c37e7751db3ed (patch)
treefbdd26c6239a74a89da198f5f807cee81055e0fb /src
parentfile_sys: Remove disk_archive, savedata_archive, and title_metadata. (diff)
downloadyuzu-00851a5ef442947c4237f32e063c37e7751db3ed.tar.gz
yuzu-00851a5ef442947c4237f32e063c37e7751db3ed.tar.xz
yuzu-00851a5ef442947c4237f32e063c37e7751db3ed.zip
file_sys: Cleanup to better match Switch file system constructs.
file_sys: Add factory class for RomFS file system.
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt14
-rw-r--r--src/core/file_sys/directory.h (renamed from src/core/file_sys/directory_backend.h)2
-rw-r--r--src/core/file_sys/filesystem.cpp (renamed from src/core/file_sys/archive_backend.cpp)4
-rw-r--r--src/core/file_sys/filesystem.h (renamed from src/core/file_sys/archive_backend.h)18
-rw-r--r--src/core/file_sys/path_parser.h2
-rw-r--r--src/core/file_sys/romfs_factory.cpp39
-rw-r--r--src/core/file_sys/romfs_factory.h35
-rw-r--r--src/core/file_sys/romfs_filesystem.cpp (renamed from src/core/file_sys/romfs_archive.cpp)40
-rw-r--r--src/core/file_sys/romfs_filesystem.h (renamed from src/core/file_sys/romfs_archive.h)18
-rw-r--r--src/core/file_sys/storage.h (renamed from src/core/file_sys/file_backend.h)27
10 files changed, 136 insertions, 63 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index b2dcc039a..5ff1311a2 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -6,15 +6,17 @@ add_library(core STATIC
6 core.h 6 core.h
7 core_timing.cpp 7 core_timing.cpp
8 core_timing.h 8 core_timing.h
9 file_sys/archive_backend.cpp 9 file_sys/directory.h
10 file_sys/archive_backend.h
11 file_sys/directory_backend.h
12 file_sys/errors.h 10 file_sys/errors.h
13 file_sys/file_backend.h 11 file_sys/filesystem.cpp
12 file_sys/filesystem.h
14 file_sys/path_parser.cpp 13 file_sys/path_parser.cpp
15 file_sys/path_parser.h 14 file_sys/path_parser.h
16 file_sys/romfs_archive.cpp 15 file_sys/romfs_factory.cpp
17 file_sys/romfs_archive.h 16 file_sys/romfs_factory.h
17 file_sys/romfs_filesystem.cpp
18 file_sys/romfs_filesystem.h
19 file_sys/storage.h
18 frontend/emu_window.cpp 20 frontend/emu_window.cpp
19 frontend/emu_window.h 21 frontend/emu_window.h
20 frontend/framebuffer_layout.cpp 22 frontend/framebuffer_layout.cpp
diff --git a/src/core/file_sys/directory_backend.h b/src/core/file_sys/directory.h
index 0c93f2074..5a40bf472 100644
--- a/src/core/file_sys/directory_backend.h
+++ b/src/core/file_sys/directory.h
@@ -1,4 +1,4 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
diff --git a/src/core/file_sys/archive_backend.cpp b/src/core/file_sys/filesystem.cpp
index fc472b44f..82fdb3c46 100644
--- a/src/core/file_sys/archive_backend.cpp
+++ b/src/core/file_sys/filesystem.cpp
@@ -1,4 +1,4 @@
1// Copyright 2015 Citra Emulator Project 1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
@@ -7,7 +7,7 @@
7#include <sstream> 7#include <sstream>
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "common/string_util.h" 9#include "common/string_util.h"
10#include "core/file_sys/archive_backend.h" 10#include "core/file_sys/filesystem.h"
11#include "core/memory.h" 11#include "core/memory.h"
12 12
13namespace FileSys { 13namespace FileSys {
diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/filesystem.h
index 2255bee42..eb3d9c4d6 100644
--- a/src/core/file_sys/archive_backend.h
+++ b/src/core/file_sys/filesystem.h
@@ -1,4 +1,4 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
@@ -15,7 +15,7 @@
15 15
16namespace FileSys { 16namespace FileSys {
17 17
18class FileBackend; 18class StorageBackend;
19class DirectoryBackend; 19class DirectoryBackend;
20 20
21// Path string type 21// Path string type
@@ -71,9 +71,9 @@ struct ArchiveFormatInfo {
71}; 71};
72static_assert(std::is_pod<ArchiveFormatInfo>::value, "ArchiveFormatInfo is not POD"); 72static_assert(std::is_pod<ArchiveFormatInfo>::value, "ArchiveFormatInfo is not POD");
73 73
74class ArchiveBackend : NonCopyable { 74class FileSystemBackend : NonCopyable {
75public: 75public:
76 virtual ~ArchiveBackend() {} 76 virtual ~FileSystemBackend() {}
77 77
78 /** 78 /**
79 * Get a descriptive name for the archive (e.g. "RomFS", "SaveData", etc.) 79 * Get a descriptive name for the archive (e.g. "RomFS", "SaveData", etc.)
@@ -138,8 +138,8 @@ public:
138 * @param mode Mode to open the file with 138 * @param mode Mode to open the file with
139 * @return Opened file, or error code 139 * @return Opened file, or error code
140 */ 140 */
141 virtual ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path, 141 virtual ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const Path& path,
142 const Mode& mode) const = 0; 142 const Mode& mode) const = 0;
143 143
144 /** 144 /**
145 * Open a directory specified by its path 145 * Open a directory specified by its path
@@ -155,9 +155,9 @@ public:
155 virtual u64 GetFreeSpaceSize() const = 0; 155 virtual u64 GetFreeSpaceSize() const = 0;
156}; 156};
157 157
158class ArchiveFactory : NonCopyable { 158class FileSystemFactory : NonCopyable {
159public: 159public:
160 virtual ~ArchiveFactory() {} 160 virtual ~FileSystemFactory() {}
161 161
162 /** 162 /**
163 * Get a descriptive name for the archive (e.g. "RomFS", "SaveData", etc.) 163 * Get a descriptive name for the archive (e.g. "RomFS", "SaveData", etc.)
@@ -169,7 +169,7 @@ public:
169 * @param path Path to the archive 169 * @param path Path to the archive
170 * @return An ArchiveBackend corresponding operating specified archive path. 170 * @return An ArchiveBackend corresponding operating specified archive path.
171 */ 171 */
172 virtual ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) = 0; 172 virtual ResultVal<std::unique_ptr<FileSystemBackend>> Open(const Path& path) = 0;
173 173
174 /** 174 /**
175 * Deletes the archive contents and then re-creates the base folder 175 * Deletes the archive contents and then re-creates the base folder
diff --git a/src/core/file_sys/path_parser.h b/src/core/file_sys/path_parser.h
index b9f52f65d..184f59d55 100644
--- a/src/core/file_sys/path_parser.h
+++ b/src/core/file_sys/path_parser.h
@@ -6,7 +6,7 @@
6 6
7#include <string> 7#include <string>
8#include <vector> 8#include <vector>
9#include "core/file_sys/archive_backend.h" 9#include "core/file_sys/filesystem.h"
10 10
11namespace FileSys { 11namespace FileSys {
12 12
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp
new file mode 100644
index 000000000..590c2acb3
--- /dev/null
+++ b/src/core/file_sys/romfs_factory.cpp
@@ -0,0 +1,39 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <algorithm>
6#include <memory>
7#include "common/common_types.h"
8#include "common/logging/log.h"
9#include "core/file_sys/romfs_factory.h"
10#include "core/file_sys/romfs_filesystem.h"
11
12namespace FileSys {
13
14RomFS_Factory::RomFS_Factory(Loader::AppLoader& app_loader) {
15 // Load the RomFS from the app
16 if (Loader::ResultStatus::Success != app_loader.ReadRomFS(romfs_file, data_offset, data_size)) {
17 LOG_ERROR(Service_FS, "Unable to read RomFS!");
18 }
19}
20
21ResultVal<std::unique_ptr<FileSystemBackend>> RomFS_Factory::Open(const Path& path) {
22 auto archive = std::make_unique<RomFS_FileSystem>(romfs_file, data_offset, data_size);
23 return MakeResult<std::unique_ptr<FileSystemBackend>>(std::move(archive));
24}
25
26ResultCode RomFS_Factory::Format(const Path& path,
27 const FileSys::ArchiveFormatInfo& format_info) {
28 LOG_ERROR(Service_FS, "Unimplemented Format archive %s", GetName().c_str());
29 // TODO(bunnei): Find the right error code for this
30 return ResultCode(-1);
31}
32
33ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const {
34 LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
35 // TODO(bunnei): Find the right error code for this
36 return ResultCode(-1);
37}
38
39} // namespace FileSys
diff --git a/src/core/file_sys/romfs_factory.h b/src/core/file_sys/romfs_factory.h
new file mode 100644
index 000000000..10ea13966
--- /dev/null
+++ b/src/core/file_sys/romfs_factory.h
@@ -0,0 +1,35 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <memory>
8#include <string>
9#include <vector>
10#include "common/common_types.h"
11#include "core/file_sys/filesystem.h"
12#include "core/hle/result.h"
13#include "core/loader/loader.h"
14
15namespace FileSys {
16
17/// File system interface to the RomFS archive
18class RomFS_Factory final : public FileSystemFactory {
19public:
20 explicit RomFS_Factory(Loader::AppLoader& app_loader);
21
22 std::string GetName() const override {
23 return "ArchiveFactory_RomFS";
24 }
25 ResultVal<std::unique_ptr<FileSystemBackend>> Open(const Path& path) override;
26 ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) override;
27 ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path) const override;
28
29private:
30 std::shared_ptr<FileUtil::IOFile> romfs_file;
31 u64 data_offset;
32 u64 data_size;
33};
34
35} // namespace FileSys
diff --git a/src/core/file_sys/romfs_archive.cpp b/src/core/file_sys/romfs_filesystem.cpp
index 0d93fccd4..5b5c5a73e 100644
--- a/src/core/file_sys/romfs_archive.cpp
+++ b/src/core/file_sys/romfs_filesystem.cpp
@@ -6,79 +6,79 @@
6#include <memory> 6#include <memory>
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "core/file_sys/romfs_archive.h" 9#include "core/file_sys/romfs_filesystem.h"
10 10
11namespace FileSys { 11namespace FileSys {
12 12
13std::string ROMFSArchive::GetName() const { 13std::string RomFS_FileSystem::GetName() const {
14 return "RomFS"; 14 return "RomFS";
15} 15}
16 16
17ResultVal<std::unique_ptr<FileBackend>> ROMFSArchive::OpenFile(const Path& path, 17ResultVal<std::unique_ptr<StorageBackend>> RomFS_FileSystem::OpenFile(const Path& path,
18 const Mode& mode) const { 18 const Mode& mode) const {
19 return MakeResult<std::unique_ptr<FileBackend>>( 19 return MakeResult<std::unique_ptr<StorageBackend>>(
20 std::make_unique<ROMFSFile>(romfs_file, data_offset, data_size)); 20 std::make_unique<RomFS_Storage>(romfs_file, data_offset, data_size));
21} 21}
22 22
23ResultCode ROMFSArchive::DeleteFile(const Path& path) const { 23ResultCode RomFS_FileSystem::DeleteFile(const Path& path) const {
24 LOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive (%s).", 24 LOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive (%s).",
25 GetName().c_str()); 25 GetName().c_str());
26 // TODO(bunnei): Use correct error code 26 // TODO(bunnei): Use correct error code
27 return ResultCode(-1); 27 return ResultCode(-1);
28} 28}
29 29
30ResultCode ROMFSArchive::RenameFile(const Path& src_path, const Path& dest_path) const { 30ResultCode RomFS_FileSystem::RenameFile(const Path& src_path, const Path& dest_path) const {
31 LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive (%s).", 31 LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive (%s).",
32 GetName().c_str()); 32 GetName().c_str());
33 // TODO(wwylele): Use correct error code 33 // TODO(wwylele): Use correct error code
34 return ResultCode(-1); 34 return ResultCode(-1);
35} 35}
36 36
37ResultCode ROMFSArchive::DeleteDirectory(const Path& path) const { 37ResultCode RomFS_FileSystem::DeleteDirectory(const Path& path) const {
38 LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive (%s).", 38 LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive (%s).",
39 GetName().c_str()); 39 GetName().c_str());
40 // TODO(wwylele): Use correct error code 40 // TODO(wwylele): Use correct error code
41 return ResultCode(-1); 41 return ResultCode(-1);
42} 42}
43 43
44ResultCode ROMFSArchive::DeleteDirectoryRecursively(const Path& path) const { 44ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
45 LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive (%s).", 45 LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive (%s).",
46 GetName().c_str()); 46 GetName().c_str());
47 // TODO(wwylele): Use correct error code 47 // TODO(wwylele): Use correct error code
48 return ResultCode(-1); 48 return ResultCode(-1);
49} 49}
50 50
51ResultCode ROMFSArchive::CreateFile(const Path& path, u64 size) const { 51ResultCode RomFS_FileSystem::CreateFile(const Path& path, u64 size) const {
52 LOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive (%s).", 52 LOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive (%s).",
53 GetName().c_str()); 53 GetName().c_str());
54 // TODO(bunnei): Use correct error code 54 // TODO(bunnei): Use correct error code
55 return ResultCode(-1); 55 return ResultCode(-1);
56} 56}
57 57
58ResultCode ROMFSArchive::CreateDirectory(const Path& path) const { 58ResultCode RomFS_FileSystem::CreateDirectory(const Path& path) const {
59 LOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive (%s).", 59 LOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive (%s).",
60 GetName().c_str()); 60 GetName().c_str());
61 // TODO(wwylele): Use correct error code 61 // TODO(wwylele): Use correct error code
62 return ResultCode(-1); 62 return ResultCode(-1);
63} 63}
64 64
65ResultCode ROMFSArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const { 65ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
66 LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive (%s).", 66 LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive (%s).",
67 GetName().c_str()); 67 GetName().c_str());
68 // TODO(wwylele): Use correct error code 68 // TODO(wwylele): Use correct error code
69 return ResultCode(-1); 69 return ResultCode(-1);
70} 70}
71 71
72ResultVal<std::unique_ptr<DirectoryBackend>> ROMFSArchive::OpenDirectory(const Path& path) const { 72ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory(const Path& path) const {
73 return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>()); 73 return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>());
74} 74}
75 75
76u64 ROMFSArchive::GetFreeSpaceSize() const { 76u64 RomFS_FileSystem::GetFreeSpaceSize() const {
77 LOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive"); 77 LOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive");
78 return 0; 78 return 0;
79} 79}
80 80
81ResultVal<size_t> ROMFSFile::Read(const u64 offset, const size_t length, u8* buffer) const { 81ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
82 LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length); 82 LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length);
83 romfs_file->Seek(data_offset + offset, SEEK_SET); 83 romfs_file->Seek(data_offset + offset, SEEK_SET);
84 size_t read_length = (size_t)std::min((u64)length, data_size - offset); 84 size_t read_length = (size_t)std::min((u64)length, data_size - offset);
@@ -86,18 +86,18 @@ ResultVal<size_t> ROMFSFile::Read(const u64 offset, const size_t length, u8* buf
86 return MakeResult<size_t>(romfs_file->ReadBytes(buffer, read_length)); 86 return MakeResult<size_t>(romfs_file->ReadBytes(buffer, read_length));
87} 87}
88 88
89ResultVal<size_t> ROMFSFile::Write(const u64 offset, const size_t length, const bool flush, 89ResultVal<size_t> RomFS_Storage::Write(const u64 offset, const size_t length, const bool flush,
90 const u8* buffer) const { 90 const u8* buffer) const {
91 LOG_ERROR(Service_FS, "Attempted to write to ROMFS file"); 91 LOG_ERROR(Service_FS, "Attempted to write to ROMFS file");
92 // TODO(Subv): Find error code 92 // TODO(Subv): Find error code
93 return MakeResult<size_t>(0); 93 return MakeResult<size_t>(0);
94} 94}
95 95
96u64 ROMFSFile::GetSize() const { 96u64 RomFS_Storage::GetSize() const {
97 return data_size; 97 return data_size;
98} 98}
99 99
100bool ROMFSFile::SetSize(const u64 size) const { 100bool RomFS_Storage::SetSize(const u64 size) const {
101 LOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file"); 101 LOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file");
102 return false; 102 return false;
103} 103}
diff --git a/src/core/file_sys/romfs_archive.h b/src/core/file_sys/romfs_filesystem.h
index 2b6c573ba..900ea567a 100644
--- a/src/core/file_sys/romfs_archive.h
+++ b/src/core/file_sys/romfs_filesystem.h
@@ -10,9 +10,9 @@
10#include <vector> 10#include <vector>
11#include "common/common_types.h" 11#include "common/common_types.h"
12#include "common/file_util.h" 12#include "common/file_util.h"
13#include "core/file_sys/archive_backend.h" 13#include "core/file_sys/directory.h"
14#include "core/file_sys/directory_backend.h" 14#include "core/file_sys/filesystem.h"
15#include "core/file_sys/file_backend.h" 15#include "core/file_sys/storage.h"
16#include "core/hle/result.h" 16#include "core/hle/result.h"
17 17
18namespace FileSys { 18namespace FileSys {
@@ -22,15 +22,15 @@ namespace FileSys {
22 * archives This should be subclassed by concrete archive types, which will provide the input data 22 * archives This should be subclassed by concrete archive types, which will provide the input data
23 * (load the raw ROMFS archive) and override any required methods 23 * (load the raw ROMFS archive) and override any required methods
24 */ 24 */
25class ROMFSArchive : public ArchiveBackend { 25class RomFS_FileSystem : public FileSystemBackend {
26public: 26public:
27 ROMFSArchive(std::shared_ptr<FileUtil::IOFile> file, u64 offset, u64 size) 27 RomFS_FileSystem(std::shared_ptr<FileUtil::IOFile> file, u64 offset, u64 size)
28 : romfs_file(file), data_offset(offset), data_size(size) {} 28 : romfs_file(file), data_offset(offset), data_size(size) {}
29 29
30 std::string GetName() const override; 30 std::string GetName() const override;
31 31
32 ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path, 32 ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const Path& path,
33 const Mode& mode) const override; 33 const Mode& mode) const override;
34 ResultCode DeleteFile(const Path& path) const override; 34 ResultCode DeleteFile(const Path& path) const override;
35 ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override; 35 ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override;
36 ResultCode DeleteDirectory(const Path& path) const override; 36 ResultCode DeleteDirectory(const Path& path) const override;
@@ -47,9 +47,9 @@ protected:
47 u64 data_size; 47 u64 data_size;
48}; 48};
49 49
50class ROMFSFile : public FileBackend { 50class RomFS_Storage : public StorageBackend {
51public: 51public:
52 ROMFSFile(std::shared_ptr<FileUtil::IOFile> file, u64 offset, u64 size) 52 RomFS_Storage(std::shared_ptr<FileUtil::IOFile> file, u64 offset, u64 size)
53 : romfs_file(file), data_offset(offset), data_size(size) {} 53 : romfs_file(file), data_offset(offset), data_size(size) {}
54 54
55 ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override; 55 ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override;
diff --git a/src/core/file_sys/file_backend.h b/src/core/file_sys/storage.h
index 5e7c2bab4..2a6811831 100644
--- a/src/core/file_sys/file_backend.h
+++ b/src/core/file_sys/storage.h
@@ -1,4 +1,4 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
@@ -8,15 +8,12 @@
8#include "common/common_types.h" 8#include "common/common_types.h"
9#include "core/hle/result.h" 9#include "core/hle/result.h"
10 10
11////////////////////////////////////////////////////////////////////////////////////////////////////
12// FileSys namespace
13
14namespace FileSys { 11namespace FileSys {
15 12
16class FileBackend : NonCopyable { 13class StorageBackend : NonCopyable {
17public: 14public:
18 FileBackend() {} 15 StorageBackend() {}
19 virtual ~FileBackend() {} 16 virtual ~StorageBackend() {}
20 17
21 /** 18 /**
22 * Read data from the file 19 * Read data from the file
@@ -39,10 +36,9 @@ public:
39 const u8* buffer) const = 0; 36 const u8* buffer) const = 0;
40 37
41 /** 38 /**
42 * Get the size of the file in bytes 39 * Flushes the file
43 * @return Size of the file in bytes
44 */ 40 */
45 virtual u64 GetSize() const = 0; 41 virtual void Flush() const = 0;
46 42
47 /** 43 /**
48 * Set the size of the file in bytes 44 * Set the size of the file in bytes
@@ -52,15 +48,16 @@ public:
52 virtual bool SetSize(u64 size) const = 0; 48 virtual bool SetSize(u64 size) const = 0;
53 49
54 /** 50 /**
55 * Close the file 51 * Get the size of the file in bytes
56 * @return true if the file closed correctly 52 * @return Size of the file in bytes
57 */ 53 */
58 virtual bool Close() const = 0; 54 virtual u64 GetSize() const = 0;
59 55
60 /** 56 /**
61 * Flushes the file 57 * Close the file
58 * @return true if the file closed correctly
62 */ 59 */
63 virtual void Flush() const = 0; 60 virtual bool Close() const = 0;
64}; 61};
65 62
66} // namespace FileSys 63} // namespace FileSys