summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar bunnei2020-12-12 01:54:28 -0800
committerGravatar GitHub2020-12-12 01:54:28 -0800
commit69b46dd607e92e50b2f83e35bb7301bb9f41d460 (patch)
tree34c48167b9b422315021a0be86db7ae76cc835fa /src/core/file_sys
parentMerge pull request #5187 from Morph1984/revert-stdfs (diff)
parentvfs: Use existing type aliases consistently (diff)
downloadyuzu-69b46dd607e92e50b2f83e35bb7301bb9f41d460.tar.gz
yuzu-69b46dd607e92e50b2f83e35bb7301bb9f41d460.tar.xz
yuzu-69b46dd607e92e50b2f83e35bb7301bb9f41d460.zip
Merge pull request #5183 from lioncash/alias2
vfs: Use existing type aliases consistently
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/content_archive.cpp12
-rw-r--r--src/core/file_sys/content_archive.h8
-rw-r--r--src/core/file_sys/nca_patch.cpp2
-rw-r--r--src/core/file_sys/nca_patch.h2
-rw-r--r--src/core/file_sys/vfs.cpp32
-rw-r--r--src/core/file_sys/vfs.h44
-rw-r--r--src/core/file_sys/vfs_concat.cpp18
-rw-r--r--src/core/file_sys/vfs_concat.h2
-rw-r--r--src/core/file_sys/vfs_layered.cpp24
-rw-r--r--src/core/file_sys/vfs_layered.h18
-rw-r--r--src/core/file_sys/vfs_offset.cpp4
-rw-r--r--src/core/file_sys/vfs_offset.h6
-rw-r--r--src/core/file_sys/vfs_real.cpp24
-rw-r--r--src/core/file_sys/vfs_real.h24
-rw-r--r--src/core/file_sys/vfs_static.h2
-rw-r--r--src/core/file_sys/vfs_vector.cpp12
-rw-r--r--src/core/file_sys/vfs_vector.h14
-rw-r--r--src/core/file_sys/xts_archive.cpp6
-rw-r--r--src/core/file_sys/xts_archive.h6
19 files changed, 133 insertions, 127 deletions
diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp
index 363ff980f..a6c0337fa 100644
--- a/src/core/file_sys/content_archive.cpp
+++ b/src/core/file_sys/content_archive.cpp
@@ -519,15 +519,17 @@ Loader::ResultStatus NCA::GetStatus() const {
519 return status; 519 return status;
520} 520}
521 521
522std::vector<std::shared_ptr<VfsFile>> NCA::GetFiles() const { 522std::vector<VirtualFile> NCA::GetFiles() const {
523 if (status != Loader::ResultStatus::Success) 523 if (status != Loader::ResultStatus::Success) {
524 return {}; 524 return {};
525 }
525 return files; 526 return files;
526} 527}
527 528
528std::vector<std::shared_ptr<VfsDirectory>> NCA::GetSubdirectories() const { 529std::vector<VirtualDir> NCA::GetSubdirectories() const {
529 if (status != Loader::ResultStatus::Success) 530 if (status != Loader::ResultStatus::Success) {
530 return {}; 531 return {};
532 }
531 return dirs; 533 return dirs;
532} 534}
533 535
@@ -535,7 +537,7 @@ std::string NCA::GetName() const {
535 return file->GetName(); 537 return file->GetName();
536} 538}
537 539
538std::shared_ptr<VfsDirectory> NCA::GetParentDirectory() const { 540VirtualDir NCA::GetParentDirectory() const {
539 return file->GetContainingDirectory(); 541 return file->GetContainingDirectory();
540} 542}
541 543
diff --git a/src/core/file_sys/content_archive.h b/src/core/file_sys/content_archive.h
index 69292232a..e9eccdea3 100644
--- a/src/core/file_sys/content_archive.h
+++ b/src/core/file_sys/content_archive.h
@@ -82,7 +82,7 @@ struct NCAHeader {
82}; 82};
83static_assert(sizeof(NCAHeader) == 0x400, "NCAHeader has incorrect size."); 83static_assert(sizeof(NCAHeader) == 0x400, "NCAHeader has incorrect size.");
84 84
85inline bool IsDirectoryExeFS(const std::shared_ptr<VfsDirectory>& pfs) { 85inline bool IsDirectoryExeFS(const VirtualDir& pfs) {
86 // According to switchbrew, an exefs must only contain these two files: 86 // According to switchbrew, an exefs must only contain these two files:
87 return pfs->GetFile("main") != nullptr && pfs->GetFile("main.npdm") != nullptr; 87 return pfs->GetFile("main") != nullptr && pfs->GetFile("main.npdm") != nullptr;
88} 88}
@@ -104,10 +104,10 @@ public:
104 104
105 Loader::ResultStatus GetStatus() const; 105 Loader::ResultStatus GetStatus() const;
106 106
107 std::vector<std::shared_ptr<VfsFile>> GetFiles() const override; 107 std::vector<VirtualFile> GetFiles() const override;
108 std::vector<std::shared_ptr<VfsDirectory>> GetSubdirectories() const override; 108 std::vector<VirtualDir> GetSubdirectories() const override;
109 std::string GetName() const override; 109 std::string GetName() const override;
110 std::shared_ptr<VfsDirectory> GetParentDirectory() const override; 110 VirtualDir GetParentDirectory() const override;
111 111
112 NCAContentType GetType() const; 112 NCAContentType GetType() const;
113 u64 GetTitleId() const; 113 u64 GetTitleId() const;
diff --git a/src/core/file_sys/nca_patch.cpp b/src/core/file_sys/nca_patch.cpp
index 5990a2fd5..adcf0732f 100644
--- a/src/core/file_sys/nca_patch.cpp
+++ b/src/core/file_sys/nca_patch.cpp
@@ -191,7 +191,7 @@ bool BKTR::Resize(std::size_t new_size) {
191 return false; 191 return false;
192} 192}
193 193
194std::shared_ptr<VfsDirectory> BKTR::GetContainingDirectory() const { 194VirtualDir BKTR::GetContainingDirectory() const {
195 return base_romfs->GetContainingDirectory(); 195 return base_romfs->GetContainingDirectory();
196} 196}
197 197
diff --git a/src/core/file_sys/nca_patch.h b/src/core/file_sys/nca_patch.h
index 60c544f8e..503cf473e 100644
--- a/src/core/file_sys/nca_patch.h
+++ b/src/core/file_sys/nca_patch.h
@@ -106,7 +106,7 @@ public:
106 106
107 bool Resize(std::size_t new_size) override; 107 bool Resize(std::size_t new_size) override;
108 108
109 std::shared_ptr<VfsDirectory> GetContainingDirectory() const override; 109 VirtualDir GetContainingDirectory() const override;
110 110
111 bool IsWritable() const override; 111 bool IsWritable() const override;
112 112
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp
index b2f026b6d..f497e9396 100644
--- a/src/core/file_sys/vfs.cpp
+++ b/src/core/file_sys/vfs.cpp
@@ -203,7 +203,7 @@ std::string VfsFile::GetFullPath() const {
203 return GetContainingDirectory()->GetFullPath() + "/" + GetName(); 203 return GetContainingDirectory()->GetFullPath() + "/" + GetName();
204} 204}
205 205
206std::shared_ptr<VfsFile> VfsDirectory::GetFileRelative(std::string_view path) const { 206VirtualFile VfsDirectory::GetFileRelative(std::string_view path) const {
207 auto vec = Common::FS::SplitPathComponents(path); 207 auto vec = Common::FS::SplitPathComponents(path);
208 vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), 208 vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }),
209 vec.end()); 209 vec.end());
@@ -231,7 +231,7 @@ std::shared_ptr<VfsFile> VfsDirectory::GetFileRelative(std::string_view path) co
231 return dir->GetFile(vec.back()); 231 return dir->GetFile(vec.back());
232} 232}
233 233
234std::shared_ptr<VfsFile> VfsDirectory::GetFileAbsolute(std::string_view path) const { 234VirtualFile VfsDirectory::GetFileAbsolute(std::string_view path) const {
235 if (IsRoot()) { 235 if (IsRoot()) {
236 return GetFileRelative(path); 236 return GetFileRelative(path);
237 } 237 }
@@ -239,7 +239,7 @@ std::shared_ptr<VfsFile> VfsDirectory::GetFileAbsolute(std::string_view path) co
239 return GetParentDirectory()->GetFileAbsolute(path); 239 return GetParentDirectory()->GetFileAbsolute(path);
240} 240}
241 241
242std::shared_ptr<VfsDirectory> VfsDirectory::GetDirectoryRelative(std::string_view path) const { 242VirtualDir VfsDirectory::GetDirectoryRelative(std::string_view path) const {
243 auto vec = Common::FS::SplitPathComponents(path); 243 auto vec = Common::FS::SplitPathComponents(path);
244 vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), 244 vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }),
245 vec.end()); 245 vec.end());
@@ -261,7 +261,7 @@ std::shared_ptr<VfsDirectory> VfsDirectory::GetDirectoryRelative(std::string_vie
261 return dir; 261 return dir;
262} 262}
263 263
264std::shared_ptr<VfsDirectory> VfsDirectory::GetDirectoryAbsolute(std::string_view path) const { 264VirtualDir VfsDirectory::GetDirectoryAbsolute(std::string_view path) const {
265 if (IsRoot()) { 265 if (IsRoot()) {
266 return GetDirectoryRelative(path); 266 return GetDirectoryRelative(path);
267 } 267 }
@@ -269,14 +269,14 @@ std::shared_ptr<VfsDirectory> VfsDirectory::GetDirectoryAbsolute(std::string_vie
269 return GetParentDirectory()->GetDirectoryAbsolute(path); 269 return GetParentDirectory()->GetDirectoryAbsolute(path);
270} 270}
271 271
272std::shared_ptr<VfsFile> VfsDirectory::GetFile(std::string_view name) const { 272VirtualFile VfsDirectory::GetFile(std::string_view name) const {
273 const auto& files = GetFiles(); 273 const auto& files = GetFiles();
274 const auto iter = std::find_if(files.begin(), files.end(), 274 const auto iter = std::find_if(files.begin(), files.end(),
275 [&name](const auto& file1) { return name == file1->GetName(); }); 275 [&name](const auto& file1) { return name == file1->GetName(); });
276 return iter == files.end() ? nullptr : *iter; 276 return iter == files.end() ? nullptr : *iter;
277} 277}
278 278
279std::shared_ptr<VfsDirectory> VfsDirectory::GetSubdirectory(std::string_view name) const { 279VirtualDir VfsDirectory::GetSubdirectory(std::string_view name) const {
280 const auto& subs = GetSubdirectories(); 280 const auto& subs = GetSubdirectories();
281 const auto iter = std::find_if(subs.begin(), subs.end(), 281 const auto iter = std::find_if(subs.begin(), subs.end(),
282 [&name](const auto& file1) { return name == file1->GetName(); }); 282 [&name](const auto& file1) { return name == file1->GetName(); });
@@ -301,7 +301,7 @@ std::size_t VfsDirectory::GetSize() const {
301 return file_total + subdir_total; 301 return file_total + subdir_total;
302} 302}
303 303
304std::shared_ptr<VfsFile> VfsDirectory::CreateFileRelative(std::string_view path) { 304VirtualFile VfsDirectory::CreateFileRelative(std::string_view path) {
305 auto vec = Common::FS::SplitPathComponents(path); 305 auto vec = Common::FS::SplitPathComponents(path);
306 vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), 306 vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }),
307 vec.end()); 307 vec.end());
@@ -324,7 +324,7 @@ std::shared_ptr<VfsFile> VfsDirectory::CreateFileRelative(std::string_view path)
324 return dir->CreateFileRelative(Common::FS::GetPathWithoutTop(path)); 324 return dir->CreateFileRelative(Common::FS::GetPathWithoutTop(path));
325} 325}
326 326
327std::shared_ptr<VfsFile> VfsDirectory::CreateFileAbsolute(std::string_view path) { 327VirtualFile VfsDirectory::CreateFileAbsolute(std::string_view path) {
328 if (IsRoot()) { 328 if (IsRoot()) {
329 return CreateFileRelative(path); 329 return CreateFileRelative(path);
330 } 330 }
@@ -332,7 +332,7 @@ std::shared_ptr<VfsFile> VfsDirectory::CreateFileAbsolute(std::string_view path)
332 return GetParentDirectory()->CreateFileAbsolute(path); 332 return GetParentDirectory()->CreateFileAbsolute(path);
333} 333}
334 334
335std::shared_ptr<VfsDirectory> VfsDirectory::CreateDirectoryRelative(std::string_view path) { 335VirtualDir VfsDirectory::CreateDirectoryRelative(std::string_view path) {
336 auto vec = Common::FS::SplitPathComponents(path); 336 auto vec = Common::FS::SplitPathComponents(path);
337 vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), 337 vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }),
338 vec.end()); 338 vec.end());
@@ -355,7 +355,7 @@ std::shared_ptr<VfsDirectory> VfsDirectory::CreateDirectoryRelative(std::string_
355 return dir->CreateDirectoryRelative(Common::FS::GetPathWithoutTop(path)); 355 return dir->CreateDirectoryRelative(Common::FS::GetPathWithoutTop(path));
356} 356}
357 357
358std::shared_ptr<VfsDirectory> VfsDirectory::CreateDirectoryAbsolute(std::string_view path) { 358VirtualDir VfsDirectory::CreateDirectoryAbsolute(std::string_view path) {
359 if (IsRoot()) { 359 if (IsRoot()) {
360 return CreateDirectoryRelative(path); 360 return CreateDirectoryRelative(path);
361 } 361 }
@@ -446,27 +446,27 @@ bool ReadOnlyVfsDirectory::IsReadable() const {
446 return true; 446 return true;
447} 447}
448 448
449std::shared_ptr<VfsDirectory> ReadOnlyVfsDirectory::CreateSubdirectory(std::string_view name) { 449VirtualDir ReadOnlyVfsDirectory::CreateSubdirectory(std::string_view name) {
450 return nullptr; 450 return nullptr;
451} 451}
452 452
453std::shared_ptr<VfsFile> ReadOnlyVfsDirectory::CreateFile(std::string_view name) { 453VirtualFile ReadOnlyVfsDirectory::CreateFile(std::string_view name) {
454 return nullptr; 454 return nullptr;
455} 455}
456 456
457std::shared_ptr<VfsFile> ReadOnlyVfsDirectory::CreateFileAbsolute(std::string_view path) { 457VirtualFile ReadOnlyVfsDirectory::CreateFileAbsolute(std::string_view path) {
458 return nullptr; 458 return nullptr;
459} 459}
460 460
461std::shared_ptr<VfsFile> ReadOnlyVfsDirectory::CreateFileRelative(std::string_view path) { 461VirtualFile ReadOnlyVfsDirectory::CreateFileRelative(std::string_view path) {
462 return nullptr; 462 return nullptr;
463} 463}
464 464
465std::shared_ptr<VfsDirectory> ReadOnlyVfsDirectory::CreateDirectoryAbsolute(std::string_view path) { 465VirtualDir ReadOnlyVfsDirectory::CreateDirectoryAbsolute(std::string_view path) {
466 return nullptr; 466 return nullptr;
467} 467}
468 468
469std::shared_ptr<VfsDirectory> ReadOnlyVfsDirectory::CreateDirectoryRelative(std::string_view path) { 469VirtualDir ReadOnlyVfsDirectory::CreateDirectoryRelative(std::string_view path) {
470 return nullptr; 470 return nullptr;
471} 471}
472 472
diff --git a/src/core/file_sys/vfs.h b/src/core/file_sys/vfs.h
index 954094772..afd64e95c 100644
--- a/src/core/file_sys/vfs.h
+++ b/src/core/file_sys/vfs.h
@@ -91,7 +91,7 @@ public:
91 // Resizes the file to new_size. Returns whether or not the operation was successful. 91 // Resizes the file to new_size. Returns whether or not the operation was successful.
92 virtual bool Resize(std::size_t new_size) = 0; 92 virtual bool Resize(std::size_t new_size) = 0;
93 // Gets a pointer to the directory containing this file, returning nullptr if there is none. 93 // Gets a pointer to the directory containing this file, returning nullptr if there is none.
94 virtual std::shared_ptr<VfsDirectory> GetContainingDirectory() const = 0; 94 virtual VirtualDir GetContainingDirectory() const = 0;
95 95
96 // Returns whether or not the file can be written to. 96 // Returns whether or not the file can be written to.
97 virtual bool IsWritable() const = 0; 97 virtual bool IsWritable() const = 0;
@@ -183,27 +183,27 @@ public:
183 183
184 // Retrives the file located at path as if the current directory was root. Returns nullptr if 184 // Retrives the file located at path as if the current directory was root. Returns nullptr if
185 // not found. 185 // not found.
186 virtual std::shared_ptr<VfsFile> GetFileRelative(std::string_view path) const; 186 virtual VirtualFile GetFileRelative(std::string_view path) const;
187 // Calls GetFileRelative(path) on the root of the current directory. 187 // Calls GetFileRelative(path) on the root of the current directory.
188 virtual std::shared_ptr<VfsFile> GetFileAbsolute(std::string_view path) const; 188 virtual VirtualFile GetFileAbsolute(std::string_view path) const;
189 189
190 // Retrives the directory located at path as if the current directory was root. Returns nullptr 190 // Retrives the directory located at path as if the current directory was root. Returns nullptr
191 // if not found. 191 // if not found.
192 virtual std::shared_ptr<VfsDirectory> GetDirectoryRelative(std::string_view path) const; 192 virtual VirtualDir GetDirectoryRelative(std::string_view path) const;
193 // Calls GetDirectoryRelative(path) on the root of the current directory. 193 // Calls GetDirectoryRelative(path) on the root of the current directory.
194 virtual std::shared_ptr<VfsDirectory> GetDirectoryAbsolute(std::string_view path) const; 194 virtual VirtualDir GetDirectoryAbsolute(std::string_view path) const;
195 195
196 // Returns a vector containing all of the files in this directory. 196 // Returns a vector containing all of the files in this directory.
197 virtual std::vector<std::shared_ptr<VfsFile>> GetFiles() const = 0; 197 virtual std::vector<VirtualFile> GetFiles() const = 0;
198 // Returns the file with filename matching name. Returns nullptr if directory dosen't have a 198 // Returns the file with filename matching name. Returns nullptr if directory dosen't have a
199 // file with name. 199 // file with name.
200 virtual std::shared_ptr<VfsFile> GetFile(std::string_view name) const; 200 virtual VirtualFile GetFile(std::string_view name) const;
201 201
202 // Returns a vector containing all of the subdirectories in this directory. 202 // Returns a vector containing all of the subdirectories in this directory.
203 virtual std::vector<std::shared_ptr<VfsDirectory>> GetSubdirectories() const = 0; 203 virtual std::vector<VirtualDir> GetSubdirectories() const = 0;
204 // Returns the directory with name matching name. Returns nullptr if directory dosen't have a 204 // Returns the directory with name matching name. Returns nullptr if directory dosen't have a
205 // directory with name. 205 // directory with name.
206 virtual std::shared_ptr<VfsDirectory> GetSubdirectory(std::string_view name) const; 206 virtual VirtualDir GetSubdirectory(std::string_view name) const;
207 207
208 // Returns whether or not the directory can be written to. 208 // Returns whether or not the directory can be written to.
209 virtual bool IsWritable() const = 0; 209 virtual bool IsWritable() const = 0;
@@ -219,31 +219,31 @@ public:
219 virtual std::size_t GetSize() const; 219 virtual std::size_t GetSize() const;
220 // Returns the parent directory of this directory. Returns nullptr if this directory is root or 220 // Returns the parent directory of this directory. Returns nullptr if this directory is root or
221 // has no parent. 221 // has no parent.
222 virtual std::shared_ptr<VfsDirectory> GetParentDirectory() const = 0; 222 virtual VirtualDir GetParentDirectory() const = 0;
223 223
224 // Creates a new subdirectory with name name. Returns a pointer to the new directory or nullptr 224 // Creates a new subdirectory with name name. Returns a pointer to the new directory or nullptr
225 // if the operation failed. 225 // if the operation failed.
226 virtual std::shared_ptr<VfsDirectory> CreateSubdirectory(std::string_view name) = 0; 226 virtual VirtualDir CreateSubdirectory(std::string_view name) = 0;
227 // Creates a new file with name name. Returns a pointer to the new file or nullptr if the 227 // Creates a new file with name name. Returns a pointer to the new file or nullptr if the
228 // operation failed. 228 // operation failed.
229 virtual std::shared_ptr<VfsFile> CreateFile(std::string_view name) = 0; 229 virtual VirtualFile CreateFile(std::string_view name) = 0;
230 230
231 // Creates a new file at the path relative to this directory. Also creates directories if 231 // Creates a new file at the path relative to this directory. Also creates directories if
232 // they do not exist and is supported by this implementation. Returns nullptr on any failure. 232 // they do not exist and is supported by this implementation. Returns nullptr on any failure.
233 virtual std::shared_ptr<VfsFile> CreateFileRelative(std::string_view path); 233 virtual VirtualFile CreateFileRelative(std::string_view path);
234 234
235 // Creates a new file at the path relative to root of this directory. Also creates directories 235 // Creates a new file at the path relative to root of this directory. Also creates directories
236 // if they do not exist and is supported by this implementation. Returns nullptr on any failure. 236 // if they do not exist and is supported by this implementation. Returns nullptr on any failure.
237 virtual std::shared_ptr<VfsFile> CreateFileAbsolute(std::string_view path); 237 virtual VirtualFile CreateFileAbsolute(std::string_view path);
238 238
239 // Creates a new directory at the path relative to this directory. Also creates directories if 239 // Creates a new directory at the path relative to this directory. Also creates directories if
240 // they do not exist and is supported by this implementation. Returns nullptr on any failure. 240 // they do not exist and is supported by this implementation. Returns nullptr on any failure.
241 virtual std::shared_ptr<VfsDirectory> CreateDirectoryRelative(std::string_view path); 241 virtual VirtualDir CreateDirectoryRelative(std::string_view path);
242 242
243 // Creates a new directory at the path relative to root of this directory. Also creates 243 // Creates a new directory at the path relative to root of this directory. Also creates
244 // directories if they do not exist and is supported by this implementation. Returns nullptr on 244 // directories if they do not exist and is supported by this implementation. Returns nullptr on
245 // any failure. 245 // any failure.
246 virtual std::shared_ptr<VfsDirectory> CreateDirectoryAbsolute(std::string_view path); 246 virtual VirtualDir CreateDirectoryAbsolute(std::string_view path);
247 247
248 // Deletes the subdirectory with the given name and returns true on success. 248 // Deletes the subdirectory with the given name and returns true on success.
249 virtual bool DeleteSubdirectory(std::string_view name) = 0; 249 virtual bool DeleteSubdirectory(std::string_view name) = 0;
@@ -280,12 +280,12 @@ class ReadOnlyVfsDirectory : public VfsDirectory {
280public: 280public:
281 bool IsWritable() const override; 281 bool IsWritable() const override;
282 bool IsReadable() const override; 282 bool IsReadable() const override;
283 std::shared_ptr<VfsDirectory> CreateSubdirectory(std::string_view name) override; 283 VirtualDir CreateSubdirectory(std::string_view name) override;
284 std::shared_ptr<VfsFile> CreateFile(std::string_view name) override; 284 VirtualFile CreateFile(std::string_view name) override;
285 std::shared_ptr<VfsFile> CreateFileAbsolute(std::string_view path) override; 285 VirtualFile CreateFileAbsolute(std::string_view path) override;
286 std::shared_ptr<VfsFile> CreateFileRelative(std::string_view path) override; 286 VirtualFile CreateFileRelative(std::string_view path) override;
287 std::shared_ptr<VfsDirectory> CreateDirectoryAbsolute(std::string_view path) override; 287 VirtualDir CreateDirectoryAbsolute(std::string_view path) override;
288 std::shared_ptr<VfsDirectory> CreateDirectoryRelative(std::string_view path) override; 288 VirtualDir CreateDirectoryRelative(std::string_view path) override;
289 bool DeleteSubdirectory(std::string_view name) override; 289 bool DeleteSubdirectory(std::string_view name) override;
290 bool DeleteSubdirectoryRecursive(std::string_view name) override; 290 bool DeleteSubdirectoryRecursive(std::string_view name) override;
291 bool CleanSubdirectoryRecursive(std::string_view name) override; 291 bool CleanSubdirectoryRecursive(std::string_view name) override;
diff --git a/src/core/file_sys/vfs_concat.cpp b/src/core/file_sys/vfs_concat.cpp
index e0ff70174..3c5a7d87a 100644
--- a/src/core/file_sys/vfs_concat.cpp
+++ b/src/core/file_sys/vfs_concat.cpp
@@ -46,7 +46,7 @@ VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(std::vector<VirtualFile> f
46 if (files.size() == 1) 46 if (files.size() == 1)
47 return files[0]; 47 return files[0];
48 48
49 return std::shared_ptr<VfsFile>(new ConcatenatedVfsFile(std::move(files), std::move(name))); 49 return VirtualFile(new ConcatenatedVfsFile(std::move(files), std::move(name)));
50} 50}
51 51
52VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(u8 filler_byte, 52VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(u8 filler_byte,
@@ -71,20 +71,23 @@ VirtualFile ConcatenatedVfsFile::MakeConcatenatedFile(u8 filler_byte,
71 if (files.begin()->first != 0) 71 if (files.begin()->first != 0)
72 files.emplace(0, std::make_shared<StaticVfsFile>(filler_byte, files.begin()->first)); 72 files.emplace(0, std::make_shared<StaticVfsFile>(filler_byte, files.begin()->first));
73 73
74 return std::shared_ptr<VfsFile>(new ConcatenatedVfsFile(std::move(files), std::move(name))); 74 return VirtualFile(new ConcatenatedVfsFile(std::move(files), std::move(name)));
75} 75}
76 76
77std::string ConcatenatedVfsFile::GetName() const { 77std::string ConcatenatedVfsFile::GetName() const {
78 if (files.empty()) 78 if (files.empty()) {
79 return ""; 79 return "";
80 if (!name.empty()) 80 }
81 if (!name.empty()) {
81 return name; 82 return name;
83 }
82 return files.begin()->second->GetName(); 84 return files.begin()->second->GetName();
83} 85}
84 86
85std::size_t ConcatenatedVfsFile::GetSize() const { 87std::size_t ConcatenatedVfsFile::GetSize() const {
86 if (files.empty()) 88 if (files.empty()) {
87 return 0; 89 return 0;
90 }
88 return files.rbegin()->first + files.rbegin()->second->GetSize(); 91 return files.rbegin()->first + files.rbegin()->second->GetSize();
89} 92}
90 93
@@ -92,9 +95,10 @@ bool ConcatenatedVfsFile::Resize(std::size_t new_size) {
92 return false; 95 return false;
93} 96}
94 97
95std::shared_ptr<VfsDirectory> ConcatenatedVfsFile::GetContainingDirectory() const { 98VirtualDir ConcatenatedVfsFile::GetContainingDirectory() const {
96 if (files.empty()) 99 if (files.empty()) {
97 return nullptr; 100 return nullptr;
101 }
98 return files.begin()->second->GetContainingDirectory(); 102 return files.begin()->second->GetContainingDirectory();
99} 103}
100 104
diff --git a/src/core/file_sys/vfs_concat.h b/src/core/file_sys/vfs_concat.h
index 7a26343c0..287c72555 100644
--- a/src/core/file_sys/vfs_concat.h
+++ b/src/core/file_sys/vfs_concat.h
@@ -31,7 +31,7 @@ public:
31 std::string GetName() const override; 31 std::string GetName() const override;
32 std::size_t GetSize() const override; 32 std::size_t GetSize() const override;
33 bool Resize(std::size_t new_size) override; 33 bool Resize(std::size_t new_size) override;
34 std::shared_ptr<VfsDirectory> GetContainingDirectory() const override; 34 VirtualDir GetContainingDirectory() const override;
35 bool IsWritable() const override; 35 bool IsWritable() const override;
36 bool IsReadable() const override; 36 bool IsReadable() const override;
37 std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override; 37 std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override;
diff --git a/src/core/file_sys/vfs_layered.cpp b/src/core/file_sys/vfs_layered.cpp
index 338e398da..434b03cec 100644
--- a/src/core/file_sys/vfs_layered.cpp
+++ b/src/core/file_sys/vfs_layered.cpp
@@ -20,10 +20,10 @@ VirtualDir LayeredVfsDirectory::MakeLayeredDirectory(std::vector<VirtualDir> dir
20 if (dirs.size() == 1) 20 if (dirs.size() == 1)
21 return dirs[0]; 21 return dirs[0];
22 22
23 return std::shared_ptr<VfsDirectory>(new LayeredVfsDirectory(std::move(dirs), std::move(name))); 23 return VirtualDir(new LayeredVfsDirectory(std::move(dirs), std::move(name)));
24} 24}
25 25
26std::shared_ptr<VfsFile> LayeredVfsDirectory::GetFileRelative(std::string_view path) const { 26VirtualFile LayeredVfsDirectory::GetFileRelative(std::string_view path) const {
27 for (const auto& layer : dirs) { 27 for (const auto& layer : dirs) {
28 const auto file = layer->GetFileRelative(path); 28 const auto file = layer->GetFileRelative(path);
29 if (file != nullptr) 29 if (file != nullptr)
@@ -33,23 +33,23 @@ std::shared_ptr<VfsFile> LayeredVfsDirectory::GetFileRelative(std::string_view p
33 return nullptr; 33 return nullptr;
34} 34}
35 35
36std::shared_ptr<VfsDirectory> LayeredVfsDirectory::GetDirectoryRelative( 36VirtualDir LayeredVfsDirectory::GetDirectoryRelative(std::string_view path) const {
37 std::string_view path) const {
38 std::vector<VirtualDir> out; 37 std::vector<VirtualDir> out;
39 for (const auto& layer : dirs) { 38 for (const auto& layer : dirs) {
40 auto dir = layer->GetDirectoryRelative(path); 39 auto dir = layer->GetDirectoryRelative(path);
41 if (dir != nullptr) 40 if (dir != nullptr) {
42 out.push_back(std::move(dir)); 41 out.push_back(std::move(dir));
42 }
43 } 43 }
44 44
45 return MakeLayeredDirectory(std::move(out)); 45 return MakeLayeredDirectory(std::move(out));
46} 46}
47 47
48std::shared_ptr<VfsFile> LayeredVfsDirectory::GetFile(std::string_view name) const { 48VirtualFile LayeredVfsDirectory::GetFile(std::string_view name) const {
49 return GetFileRelative(name); 49 return GetFileRelative(name);
50} 50}
51 51
52std::shared_ptr<VfsDirectory> LayeredVfsDirectory::GetSubdirectory(std::string_view name) const { 52VirtualDir LayeredVfsDirectory::GetSubdirectory(std::string_view name) const {
53 return GetDirectoryRelative(name); 53 return GetDirectoryRelative(name);
54} 54}
55 55
@@ -57,7 +57,7 @@ std::string LayeredVfsDirectory::GetFullPath() const {
57 return dirs[0]->GetFullPath(); 57 return dirs[0]->GetFullPath();
58} 58}
59 59
60std::vector<std::shared_ptr<VfsFile>> LayeredVfsDirectory::GetFiles() const { 60std::vector<VirtualFile> LayeredVfsDirectory::GetFiles() const {
61 std::vector<VirtualFile> out; 61 std::vector<VirtualFile> out;
62 for (const auto& layer : dirs) { 62 for (const auto& layer : dirs) {
63 for (const auto& file : layer->GetFiles()) { 63 for (const auto& file : layer->GetFiles()) {
@@ -72,7 +72,7 @@ std::vector<std::shared_ptr<VfsFile>> LayeredVfsDirectory::GetFiles() const {
72 return out; 72 return out;
73} 73}
74 74
75std::vector<std::shared_ptr<VfsDirectory>> LayeredVfsDirectory::GetSubdirectories() const { 75std::vector<VirtualDir> LayeredVfsDirectory::GetSubdirectories() const {
76 std::vector<std::string> names; 76 std::vector<std::string> names;
77 for (const auto& layer : dirs) { 77 for (const auto& layer : dirs) {
78 for (const auto& sd : layer->GetSubdirectories()) { 78 for (const auto& sd : layer->GetSubdirectories()) {
@@ -101,15 +101,15 @@ std::string LayeredVfsDirectory::GetName() const {
101 return name.empty() ? dirs[0]->GetName() : name; 101 return name.empty() ? dirs[0]->GetName() : name;
102} 102}
103 103
104std::shared_ptr<VfsDirectory> LayeredVfsDirectory::GetParentDirectory() const { 104VirtualDir LayeredVfsDirectory::GetParentDirectory() const {
105 return dirs[0]->GetParentDirectory(); 105 return dirs[0]->GetParentDirectory();
106} 106}
107 107
108std::shared_ptr<VfsDirectory> LayeredVfsDirectory::CreateSubdirectory(std::string_view name) { 108VirtualDir LayeredVfsDirectory::CreateSubdirectory(std::string_view name) {
109 return nullptr; 109 return nullptr;
110} 110}
111 111
112std::shared_ptr<VfsFile> LayeredVfsDirectory::CreateFile(std::string_view name) { 112VirtualFile LayeredVfsDirectory::CreateFile(std::string_view name) {
113 return nullptr; 113 return nullptr;
114} 114}
115 115
diff --git a/src/core/file_sys/vfs_layered.h b/src/core/file_sys/vfs_layered.h
index 8a25c3428..6d7513ac6 100644
--- a/src/core/file_sys/vfs_layered.h
+++ b/src/core/file_sys/vfs_layered.h
@@ -21,20 +21,20 @@ public:
21 /// Wrapper function to allow for more efficient handling of dirs.size() == 0, 1 cases. 21 /// Wrapper function to allow for more efficient handling of dirs.size() == 0, 1 cases.
22 static VirtualDir MakeLayeredDirectory(std::vector<VirtualDir> dirs, std::string name = ""); 22 static VirtualDir MakeLayeredDirectory(std::vector<VirtualDir> dirs, std::string name = "");
23 23
24 std::shared_ptr<VfsFile> GetFileRelative(std::string_view path) const override; 24 VirtualFile GetFileRelative(std::string_view path) const override;
25 std::shared_ptr<VfsDirectory> GetDirectoryRelative(std::string_view path) const override; 25 VirtualDir GetDirectoryRelative(std::string_view path) const override;
26 std::shared_ptr<VfsFile> GetFile(std::string_view name) const override; 26 VirtualFile GetFile(std::string_view name) const override;
27 std::shared_ptr<VfsDirectory> GetSubdirectory(std::string_view name) const override; 27 VirtualDir GetSubdirectory(std::string_view name) const override;
28 std::string GetFullPath() const override; 28 std::string GetFullPath() const override;
29 29
30 std::vector<std::shared_ptr<VfsFile>> GetFiles() const override; 30 std::vector<VirtualFile> GetFiles() const override;
31 std::vector<std::shared_ptr<VfsDirectory>> GetSubdirectories() const override; 31 std::vector<VirtualDir> GetSubdirectories() const override;
32 bool IsWritable() const override; 32 bool IsWritable() const override;
33 bool IsReadable() const override; 33 bool IsReadable() const override;
34 std::string GetName() const override; 34 std::string GetName() const override;
35 std::shared_ptr<VfsDirectory> GetParentDirectory() const override; 35 VirtualDir GetParentDirectory() const override;
36 std::shared_ptr<VfsDirectory> CreateSubdirectory(std::string_view name) override; 36 VirtualDir CreateSubdirectory(std::string_view name) override;
37 std::shared_ptr<VfsFile> CreateFile(std::string_view name) override; 37 VirtualFile CreateFile(std::string_view name) override;
38 bool DeleteSubdirectory(std::string_view name) override; 38 bool DeleteSubdirectory(std::string_view name) override;
39 bool DeleteFile(std::string_view name) override; 39 bool DeleteFile(std::string_view name) override;
40 bool Rename(std::string_view name) override; 40 bool Rename(std::string_view name) override;
diff --git a/src/core/file_sys/vfs_offset.cpp b/src/core/file_sys/vfs_offset.cpp
index 7714d3de5..056737b54 100644
--- a/src/core/file_sys/vfs_offset.cpp
+++ b/src/core/file_sys/vfs_offset.cpp
@@ -9,7 +9,7 @@
9 9
10namespace FileSys { 10namespace FileSys {
11 11
12OffsetVfsFile::OffsetVfsFile(std::shared_ptr<VfsFile> file_, std::size_t size_, std::size_t offset_, 12OffsetVfsFile::OffsetVfsFile(VirtualFile file_, std::size_t size_, std::size_t offset_,
13 std::string name_, VirtualDir parent_) 13 std::string name_, VirtualDir parent_)
14 : file(file_), offset(offset_), size(size_), name(std::move(name_)), 14 : file(file_), offset(offset_), size(size_), name(std::move(name_)),
15 parent(parent_ == nullptr ? file->GetContainingDirectory() : std::move(parent_)) {} 15 parent(parent_ == nullptr ? file->GetContainingDirectory() : std::move(parent_)) {}
@@ -37,7 +37,7 @@ bool OffsetVfsFile::Resize(std::size_t new_size) {
37 return true; 37 return true;
38} 38}
39 39
40std::shared_ptr<VfsDirectory> OffsetVfsFile::GetContainingDirectory() const { 40VirtualDir OffsetVfsFile::GetContainingDirectory() const {
41 return parent; 41 return parent;
42} 42}
43 43
diff --git a/src/core/file_sys/vfs_offset.h b/src/core/file_sys/vfs_offset.h
index f7b7a3256..b2ccc5c7b 100644
--- a/src/core/file_sys/vfs_offset.h
+++ b/src/core/file_sys/vfs_offset.h
@@ -17,14 +17,14 @@ namespace FileSys {
17// the size of this wrapper. 17// the size of this wrapper.
18class OffsetVfsFile : public VfsFile { 18class OffsetVfsFile : public VfsFile {
19public: 19public:
20 OffsetVfsFile(std::shared_ptr<VfsFile> file, std::size_t size, std::size_t offset = 0, 20 OffsetVfsFile(VirtualFile file, std::size_t size, std::size_t offset = 0,
21 std::string new_name = "", VirtualDir new_parent = nullptr); 21 std::string new_name = "", VirtualDir new_parent = nullptr);
22 ~OffsetVfsFile() override; 22 ~OffsetVfsFile() override;
23 23
24 std::string GetName() const override; 24 std::string GetName() const override;
25 std::size_t GetSize() const override; 25 std::size_t GetSize() const override;
26 bool Resize(std::size_t new_size) override; 26 bool Resize(std::size_t new_size) override;
27 std::shared_ptr<VfsDirectory> GetContainingDirectory() const override; 27 VirtualDir GetContainingDirectory() const override;
28 bool IsWritable() const override; 28 bool IsWritable() const override;
29 bool IsReadable() const override; 29 bool IsReadable() const override;
30 std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override; 30 std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override;
@@ -42,7 +42,7 @@ public:
42private: 42private:
43 std::size_t TrimToFit(std::size_t r_size, std::size_t r_offset) const; 43 std::size_t TrimToFit(std::size_t r_size, std::size_t r_offset) const;
44 44
45 std::shared_ptr<VfsFile> file; 45 VirtualFile file;
46 std::size_t offset; 46 std::size_t offset;
47 std::size_t size; 47 std::size_t size;
48 std::string name; 48 std::string name;
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp
index 488687ba9..a287eebe3 100644
--- a/src/core/file_sys/vfs_real.cpp
+++ b/src/core/file_sys/vfs_real.cpp
@@ -263,7 +263,7 @@ bool RealVfsFile::Resize(std::size_t new_size) {
263 return backing->Resize(new_size); 263 return backing->Resize(new_size);
264} 264}
265 265
266std::shared_ptr<VfsDirectory> RealVfsFile::GetContainingDirectory() const { 266VirtualDir RealVfsFile::GetContainingDirectory() const {
267 return base.OpenDirectory(parent_path, perms); 267 return base.OpenDirectory(parent_path, perms);
268} 268}
269 269
@@ -352,7 +352,7 @@ RealVfsDirectory::RealVfsDirectory(RealVfsFilesystem& base_, const std::string&
352 352
353RealVfsDirectory::~RealVfsDirectory() = default; 353RealVfsDirectory::~RealVfsDirectory() = default;
354 354
355std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path) const { 355VirtualFile RealVfsDirectory::GetFileRelative(std::string_view path) const {
356 const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); 356 const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
357 if (!FS::Exists(full_path) || FS::IsDirectory(full_path)) { 357 if (!FS::Exists(full_path) || FS::IsDirectory(full_path)) {
358 return nullptr; 358 return nullptr;
@@ -360,7 +360,7 @@ std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path
360 return base.OpenFile(full_path, perms); 360 return base.OpenFile(full_path, perms);
361} 361}
362 362
363std::shared_ptr<VfsDirectory> RealVfsDirectory::GetDirectoryRelative(std::string_view path) const { 363VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view path) const {
364 const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); 364 const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
365 if (!FS::Exists(full_path) || !FS::IsDirectory(full_path)) { 365 if (!FS::Exists(full_path) || !FS::IsDirectory(full_path)) {
366 return nullptr; 366 return nullptr;
@@ -368,20 +368,20 @@ std::shared_ptr<VfsDirectory> RealVfsDirectory::GetDirectoryRelative(std::string
368 return base.OpenDirectory(full_path, perms); 368 return base.OpenDirectory(full_path, perms);
369} 369}
370 370
371std::shared_ptr<VfsFile> RealVfsDirectory::GetFile(std::string_view name) const { 371VirtualFile RealVfsDirectory::GetFile(std::string_view name) const {
372 return GetFileRelative(name); 372 return GetFileRelative(name);
373} 373}
374 374
375std::shared_ptr<VfsDirectory> RealVfsDirectory::GetSubdirectory(std::string_view name) const { 375VirtualDir RealVfsDirectory::GetSubdirectory(std::string_view name) const {
376 return GetDirectoryRelative(name); 376 return GetDirectoryRelative(name);
377} 377}
378 378
379std::shared_ptr<VfsFile> RealVfsDirectory::CreateFileRelative(std::string_view path) { 379VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view path) {
380 const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); 380 const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
381 return base.CreateFile(full_path, perms); 381 return base.CreateFile(full_path, perms);
382} 382}
383 383
384std::shared_ptr<VfsDirectory> RealVfsDirectory::CreateDirectoryRelative(std::string_view path) { 384VirtualDir RealVfsDirectory::CreateDirectoryRelative(std::string_view path) {
385 const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); 385 const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
386 return base.CreateDirectory(full_path, perms); 386 return base.CreateDirectory(full_path, perms);
387} 387}
@@ -391,11 +391,11 @@ bool RealVfsDirectory::DeleteSubdirectoryRecursive(std::string_view name) {
391 return base.DeleteDirectory(full_path); 391 return base.DeleteDirectory(full_path);
392} 392}
393 393
394std::vector<std::shared_ptr<VfsFile>> RealVfsDirectory::GetFiles() const { 394std::vector<VirtualFile> RealVfsDirectory::GetFiles() const {
395 return IterateEntries<RealVfsFile, VfsFile>(); 395 return IterateEntries<RealVfsFile, VfsFile>();
396} 396}
397 397
398std::vector<std::shared_ptr<VfsDirectory>> RealVfsDirectory::GetSubdirectories() const { 398std::vector<VirtualDir> RealVfsDirectory::GetSubdirectories() const {
399 return IterateEntries<RealVfsDirectory, VfsDirectory>(); 399 return IterateEntries<RealVfsDirectory, VfsDirectory>();
400} 400}
401 401
@@ -411,7 +411,7 @@ std::string RealVfsDirectory::GetName() const {
411 return path_components.back(); 411 return path_components.back();
412} 412}
413 413
414std::shared_ptr<VfsDirectory> RealVfsDirectory::GetParentDirectory() const { 414VirtualDir RealVfsDirectory::GetParentDirectory() const {
415 if (path_components.size() <= 1) { 415 if (path_components.size() <= 1) {
416 return nullptr; 416 return nullptr;
417 } 417 }
@@ -419,12 +419,12 @@ std::shared_ptr<VfsDirectory> RealVfsDirectory::GetParentDirectory() const {
419 return base.OpenDirectory(parent_path, perms); 419 return base.OpenDirectory(parent_path, perms);
420} 420}
421 421
422std::shared_ptr<VfsDirectory> RealVfsDirectory::CreateSubdirectory(std::string_view name) { 422VirtualDir RealVfsDirectory::CreateSubdirectory(std::string_view name) {
423 const std::string subdir_path = (path + DIR_SEP).append(name); 423 const std::string subdir_path = (path + DIR_SEP).append(name);
424 return base.CreateDirectory(subdir_path, perms); 424 return base.CreateDirectory(subdir_path, perms);
425} 425}
426 426
427std::shared_ptr<VfsFile> RealVfsDirectory::CreateFile(std::string_view name) { 427VirtualFile RealVfsDirectory::CreateFile(std::string_view name) {
428 const std::string file_path = (path + DIR_SEP).append(name); 428 const std::string file_path = (path + DIR_SEP).append(name);
429 return base.CreateFile(file_path, perms); 429 return base.CreateFile(file_path, perms);
430} 430}
diff --git a/src/core/file_sys/vfs_real.h b/src/core/file_sys/vfs_real.h
index 0b537b22c..23e99865e 100644
--- a/src/core/file_sys/vfs_real.h
+++ b/src/core/file_sys/vfs_real.h
@@ -50,7 +50,7 @@ public:
50 std::string GetName() const override; 50 std::string GetName() const override;
51 std::size_t GetSize() const override; 51 std::size_t GetSize() const override;
52 bool Resize(std::size_t new_size) override; 52 bool Resize(std::size_t new_size) override;
53 std::shared_ptr<VfsDirectory> GetContainingDirectory() const override; 53 VirtualDir GetContainingDirectory() const override;
54 bool IsWritable() const override; 54 bool IsWritable() const override;
55 bool IsReadable() const override; 55 bool IsReadable() const override;
56 std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override; 56 std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override;
@@ -79,21 +79,21 @@ class RealVfsDirectory : public VfsDirectory {
79public: 79public:
80 ~RealVfsDirectory() override; 80 ~RealVfsDirectory() override;
81 81
82 std::shared_ptr<VfsFile> GetFileRelative(std::string_view path) const override; 82 VirtualFile GetFileRelative(std::string_view path) const override;
83 std::shared_ptr<VfsDirectory> GetDirectoryRelative(std::string_view path) const override; 83 VirtualDir GetDirectoryRelative(std::string_view path) const override;
84 std::shared_ptr<VfsFile> GetFile(std::string_view name) const override; 84 VirtualFile GetFile(std::string_view name) const override;
85 std::shared_ptr<VfsDirectory> GetSubdirectory(std::string_view name) const override; 85 VirtualDir GetSubdirectory(std::string_view name) const override;
86 std::shared_ptr<VfsFile> CreateFileRelative(std::string_view path) override; 86 VirtualFile CreateFileRelative(std::string_view path) override;
87 std::shared_ptr<VfsDirectory> CreateDirectoryRelative(std::string_view path) override; 87 VirtualDir CreateDirectoryRelative(std::string_view path) override;
88 bool DeleteSubdirectoryRecursive(std::string_view name) override; 88 bool DeleteSubdirectoryRecursive(std::string_view name) override;
89 std::vector<std::shared_ptr<VfsFile>> GetFiles() const override; 89 std::vector<VirtualFile> GetFiles() const override;
90 std::vector<std::shared_ptr<VfsDirectory>> GetSubdirectories() const override; 90 std::vector<VirtualDir> GetSubdirectories() const override;
91 bool IsWritable() const override; 91 bool IsWritable() const override;
92 bool IsReadable() const override; 92 bool IsReadable() const override;
93 std::string GetName() const override; 93 std::string GetName() const override;
94 std::shared_ptr<VfsDirectory> GetParentDirectory() const override; 94 VirtualDir GetParentDirectory() const override;
95 std::shared_ptr<VfsDirectory> CreateSubdirectory(std::string_view name) override; 95 VirtualDir CreateSubdirectory(std::string_view name) override;
96 std::shared_ptr<VfsFile> CreateFile(std::string_view name) override; 96 VirtualFile CreateFile(std::string_view name) override;
97 bool DeleteSubdirectory(std::string_view name) override; 97 bool DeleteSubdirectory(std::string_view name) override;
98 bool DeleteFile(std::string_view name) override; 98 bool DeleteFile(std::string_view name) override;
99 bool Rename(std::string_view name) override; 99 bool Rename(std::string_view name) override;
diff --git a/src/core/file_sys/vfs_static.h b/src/core/file_sys/vfs_static.h
index 8b27c30fa..c840b24b9 100644
--- a/src/core/file_sys/vfs_static.h
+++ b/src/core/file_sys/vfs_static.h
@@ -31,7 +31,7 @@ public:
31 return true; 31 return true;
32 } 32 }
33 33
34 std::shared_ptr<VfsDirectory> GetContainingDirectory() const override { 34 VirtualDir GetContainingDirectory() const override {
35 return parent; 35 return parent;
36 } 36 }
37 37
diff --git a/src/core/file_sys/vfs_vector.cpp b/src/core/file_sys/vfs_vector.cpp
index 75fc04302..c1ec1e645 100644
--- a/src/core/file_sys/vfs_vector.cpp
+++ b/src/core/file_sys/vfs_vector.cpp
@@ -25,7 +25,7 @@ bool VectorVfsFile::Resize(size_t new_size) {
25 return true; 25 return true;
26} 26}
27 27
28std::shared_ptr<VfsDirectory> VectorVfsFile::GetContainingDirectory() const { 28VirtualDir VectorVfsFile::GetContainingDirectory() const {
29 return parent; 29 return parent;
30} 30}
31 31
@@ -68,11 +68,11 @@ VectorVfsDirectory::VectorVfsDirectory(std::vector<VirtualFile> files_,
68 68
69VectorVfsDirectory::~VectorVfsDirectory() = default; 69VectorVfsDirectory::~VectorVfsDirectory() = default;
70 70
71std::vector<std::shared_ptr<VfsFile>> VectorVfsDirectory::GetFiles() const { 71std::vector<VirtualFile> VectorVfsDirectory::GetFiles() const {
72 return files; 72 return files;
73} 73}
74 74
75std::vector<std::shared_ptr<VfsDirectory>> VectorVfsDirectory::GetSubdirectories() const { 75std::vector<VirtualDir> VectorVfsDirectory::GetSubdirectories() const {
76 return dirs; 76 return dirs;
77} 77}
78 78
@@ -88,7 +88,7 @@ std::string VectorVfsDirectory::GetName() const {
88 return name; 88 return name;
89} 89}
90 90
91std::shared_ptr<VfsDirectory> VectorVfsDirectory::GetParentDirectory() const { 91VirtualDir VectorVfsDirectory::GetParentDirectory() const {
92 return parent; 92 return parent;
93} 93}
94 94
@@ -116,11 +116,11 @@ bool VectorVfsDirectory::Rename(std::string_view name_) {
116 return true; 116 return true;
117} 117}
118 118
119std::shared_ptr<VfsDirectory> VectorVfsDirectory::CreateSubdirectory(std::string_view name) { 119VirtualDir VectorVfsDirectory::CreateSubdirectory(std::string_view name) {
120 return nullptr; 120 return nullptr;
121} 121}
122 122
123std::shared_ptr<VfsFile> VectorVfsDirectory::CreateFile(std::string_view name) { 123VirtualFile VectorVfsDirectory::CreateFile(std::string_view name) {
124 return nullptr; 124 return nullptr;
125} 125}
126 126
diff --git a/src/core/file_sys/vfs_vector.h b/src/core/file_sys/vfs_vector.h
index c214db422..2aff9ca34 100644
--- a/src/core/file_sys/vfs_vector.h
+++ b/src/core/file_sys/vfs_vector.h
@@ -33,7 +33,7 @@ public:
33 return false; 33 return false;
34 } 34 }
35 35
36 std::shared_ptr<VfsDirectory> GetContainingDirectory() const override { 36 VirtualDir GetContainingDirectory() const override {
37 return parent; 37 return parent;
38 } 38 }
39 39
@@ -82,7 +82,7 @@ public:
82 std::string GetName() const override; 82 std::string GetName() const override;
83 std::size_t GetSize() const override; 83 std::size_t GetSize() const override;
84 bool Resize(std::size_t new_size) override; 84 bool Resize(std::size_t new_size) override;
85 std::shared_ptr<VfsDirectory> GetContainingDirectory() const override; 85 VirtualDir GetContainingDirectory() const override;
86 bool IsWritable() const override; 86 bool IsWritable() const override;
87 bool IsReadable() const override; 87 bool IsReadable() const override;
88 std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override; 88 std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override;
@@ -106,17 +106,17 @@ public:
106 VirtualDir parent = nullptr); 106 VirtualDir parent = nullptr);
107 ~VectorVfsDirectory() override; 107 ~VectorVfsDirectory() override;
108 108
109 std::vector<std::shared_ptr<VfsFile>> GetFiles() const override; 109 std::vector<VirtualFile> GetFiles() const override;
110 std::vector<std::shared_ptr<VfsDirectory>> GetSubdirectories() const override; 110 std::vector<VirtualDir> GetSubdirectories() const override;
111 bool IsWritable() const override; 111 bool IsWritable() const override;
112 bool IsReadable() const override; 112 bool IsReadable() const override;
113 std::string GetName() const override; 113 std::string GetName() const override;
114 std::shared_ptr<VfsDirectory> GetParentDirectory() const override; 114 VirtualDir GetParentDirectory() const override;
115 bool DeleteSubdirectory(std::string_view name) override; 115 bool DeleteSubdirectory(std::string_view name) override;
116 bool DeleteFile(std::string_view name) override; 116 bool DeleteFile(std::string_view name) override;
117 bool Rename(std::string_view name) override; 117 bool Rename(std::string_view name) override;
118 std::shared_ptr<VfsDirectory> CreateSubdirectory(std::string_view name) override; 118 VirtualDir CreateSubdirectory(std::string_view name) override;
119 std::shared_ptr<VfsFile> CreateFile(std::string_view name) override; 119 VirtualFile CreateFile(std::string_view name) override;
120 120
121 virtual void AddFile(VirtualFile file); 121 virtual void AddFile(VirtualFile file);
122 virtual void AddDirectory(VirtualDir dir); 122 virtual void AddDirectory(VirtualDir dir);
diff --git a/src/core/file_sys/xts_archive.cpp b/src/core/file_sys/xts_archive.cpp
index 24c58e7ae..814fd5680 100644
--- a/src/core/file_sys/xts_archive.cpp
+++ b/src/core/file_sys/xts_archive.cpp
@@ -152,11 +152,11 @@ NAXContentType NAX::GetContentType() const {
152 return type; 152 return type;
153} 153}
154 154
155std::vector<std::shared_ptr<VfsFile>> NAX::GetFiles() const { 155std::vector<VirtualFile> NAX::GetFiles() const {
156 return {dec_file}; 156 return {dec_file};
157} 157}
158 158
159std::vector<std::shared_ptr<VfsDirectory>> NAX::GetSubdirectories() const { 159std::vector<VirtualDir> NAX::GetSubdirectories() const {
160 return {}; 160 return {};
161} 161}
162 162
@@ -164,7 +164,7 @@ std::string NAX::GetName() const {
164 return file->GetName(); 164 return file->GetName();
165} 165}
166 166
167std::shared_ptr<VfsDirectory> NAX::GetParentDirectory() const { 167VirtualDir NAX::GetParentDirectory() const {
168 return file->GetContainingDirectory(); 168 return file->GetContainingDirectory();
169} 169}
170 170
diff --git a/src/core/file_sys/xts_archive.h b/src/core/file_sys/xts_archive.h
index c472e226e..63a032b68 100644
--- a/src/core/file_sys/xts_archive.h
+++ b/src/core/file_sys/xts_archive.h
@@ -47,13 +47,13 @@ public:
47 47
48 NAXContentType GetContentType() const; 48 NAXContentType GetContentType() const;
49 49
50 std::vector<std::shared_ptr<VfsFile>> GetFiles() const override; 50 std::vector<VirtualFile> GetFiles() const override;
51 51
52 std::vector<std::shared_ptr<VfsDirectory>> GetSubdirectories() const override; 52 std::vector<VirtualDir> GetSubdirectories() const override;
53 53
54 std::string GetName() const override; 54 std::string GetName() const override;
55 55
56 std::shared_ptr<VfsDirectory> GetParentDirectory() const override; 56 VirtualDir GetParentDirectory() const override;
57 57
58private: 58private:
59 Loader::ResultStatus Parse(std::string_view path); 59 Loader::ResultStatus Parse(std::string_view path);