diff options
| author | 2018-09-02 10:53:06 -0400 | |
|---|---|---|
| committer | 2018-09-02 12:38:14 -0400 | |
| commit | a40537314405d62baa012836da9bba24ad4b02e5 (patch) | |
| tree | e713eda9ce20870d7e803989d555e7842eab3415 /src/core | |
| parent | Merge pull request #1213 from DarkLordZach/octopath-fs (diff) | |
| download | yuzu-a40537314405d62baa012836da9bba24ad4b02e5.tar.gz yuzu-a40537314405d62baa012836da9bba24ad4b02e5.tar.xz yuzu-a40537314405d62baa012836da9bba24ad4b02e5.zip | |
vfs_real: Forward declare IOFile
Eliminates the need to rebuild some source files if the file_util header
ever changes. This also uncovered some indirect inclusions, which have
also been fixed.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/core.cpp | 5 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_real.cpp | 6 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_real.h | 20 | ||||
| -rw-r--r-- | src/core/file_sys/xts_archive.cpp | 1 | ||||
| -rw-r--r-- | src/core/loader/loader.cpp | 5 | ||||
| -rw-r--r-- | src/core/loader/loader.h | 6 |
7 files changed, 31 insertions, 14 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 2cfae18df..29983b9b4 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -14,6 +14,9 @@ | |||
| 14 | #include "core/core.h" | 14 | #include "core/core.h" |
| 15 | #include "core/core_cpu.h" | 15 | #include "core/core_cpu.h" |
| 16 | #include "core/core_timing.h" | 16 | #include "core/core_timing.h" |
| 17 | #include "core/file_sys/mode.h" | ||
| 18 | #include "core/file_sys/vfs_concat.h" | ||
| 19 | #include "core/file_sys/vfs_real.h" | ||
| 17 | #include "core/gdbstub/gdbstub.h" | 20 | #include "core/gdbstub/gdbstub.h" |
| 18 | #include "core/hle/kernel/client_port.h" | 21 | #include "core/hle/kernel/client_port.h" |
| 19 | #include "core/hle/kernel/kernel.h" | 22 | #include "core/hle/kernel/kernel.h" |
| @@ -27,8 +30,6 @@ | |||
| 27 | #include "core/perf_stats.h" | 30 | #include "core/perf_stats.h" |
| 28 | #include "core/settings.h" | 31 | #include "core/settings.h" |
| 29 | #include "core/telemetry_session.h" | 32 | #include "core/telemetry_session.h" |
| 30 | #include "file_sys/vfs_concat.h" | ||
| 31 | #include "file_sys/vfs_real.h" | ||
| 32 | #include "video_core/debug_utils/debug_utils.h" | 33 | #include "video_core/debug_utils/debug_utils.h" |
| 33 | #include "video_core/gpu.h" | 34 | #include "video_core/gpu.h" |
| 34 | #include "video_core/renderer_base.h" | 35 | #include "video_core/renderer_base.h" |
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index dacf8568b..fe5d36930 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -5,9 +5,9 @@ | |||
| 5 | #include <regex> | 5 | #include <regex> |
| 6 | #include <mbedtls/sha256.h> | 6 | #include <mbedtls/sha256.h> |
| 7 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 8 | #include "common/file_util.h" | ||
| 8 | #include "common/hex_util.h" | 9 | #include "common/hex_util.h" |
| 9 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 10 | #include "core/crypto/encryption_layer.h" | ||
| 11 | #include "core/file_sys/card_image.h" | 11 | #include "core/file_sys/card_image.h" |
| 12 | #include "core/file_sys/nca_metadata.h" | 12 | #include "core/file_sys/nca_metadata.h" |
| 13 | #include "core/file_sys/registered_cache.h" | 13 | #include "core/file_sys/registered_cache.h" |
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index 2b8ac7103..89b101145 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <utility> | 8 | #include <utility> |
| 9 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| 10 | #include "common/common_paths.h" | 10 | #include "common/common_paths.h" |
| 11 | #include "common/file_util.h" | ||
| 11 | #include "common/logging/log.h" | 12 | #include "common/logging/log.h" |
| 12 | #include "core/file_sys/vfs_real.h" | 13 | #include "core/file_sys/vfs_real.h" |
| 13 | 14 | ||
| @@ -39,6 +40,7 @@ static std::string ModeFlagsToString(Mode mode) { | |||
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | RealVfsFilesystem::RealVfsFilesystem() : VfsFilesystem(nullptr) {} | 42 | RealVfsFilesystem::RealVfsFilesystem() : VfsFilesystem(nullptr) {} |
| 43 | RealVfsFilesystem::~RealVfsFilesystem() = default; | ||
| 42 | 44 | ||
| 43 | std::string RealVfsFilesystem::GetName() const { | 45 | std::string RealVfsFilesystem::GetName() const { |
| 44 | return "Real"; | 46 | return "Real"; |
| @@ -219,6 +221,8 @@ RealVfsFile::RealVfsFile(RealVfsFilesystem& base_, std::shared_ptr<FileUtil::IOF | |||
| 219 | parent_components(FileUtil::SliceVector(path_components, 0, path_components.size() - 1)), | 221 | parent_components(FileUtil::SliceVector(path_components, 0, path_components.size() - 1)), |
| 220 | perms(perms_) {} | 222 | perms(perms_) {} |
| 221 | 223 | ||
| 224 | RealVfsFile::~RealVfsFile() = default; | ||
| 225 | |||
| 222 | std::string RealVfsFile::GetName() const { | 226 | std::string RealVfsFile::GetName() const { |
| 223 | return path_components.back(); | 227 | return path_components.back(); |
| 224 | } | 228 | } |
| @@ -312,6 +316,8 @@ RealVfsDirectory::RealVfsDirectory(RealVfsFilesystem& base_, const std::string& | |||
| 312 | FileUtil::CreateDir(path); | 316 | FileUtil::CreateDir(path); |
| 313 | } | 317 | } |
| 314 | 318 | ||
| 319 | RealVfsDirectory::~RealVfsDirectory() = default; | ||
| 320 | |||
| 315 | std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path) const { | 321 | std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path) const { |
| 316 | const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path)); | 322 | const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path)); |
| 317 | if (!FileUtil::Exists(full_path) || FileUtil::IsDirectory(full_path)) | 323 | if (!FileUtil::Exists(full_path) || FileUtil::IsDirectory(full_path)) |
diff --git a/src/core/file_sys/vfs_real.h b/src/core/file_sys/vfs_real.h index 989803d43..7db86691f 100644 --- a/src/core/file_sys/vfs_real.h +++ b/src/core/file_sys/vfs_real.h | |||
| @@ -6,15 +6,19 @@ | |||
| 6 | 6 | ||
| 7 | #include <string_view> | 7 | #include <string_view> |
| 8 | #include <boost/container/flat_map.hpp> | 8 | #include <boost/container/flat_map.hpp> |
| 9 | #include "common/file_util.h" | ||
| 10 | #include "core/file_sys/mode.h" | 9 | #include "core/file_sys/mode.h" |
| 11 | #include "core/file_sys/vfs.h" | 10 | #include "core/file_sys/vfs.h" |
| 12 | 11 | ||
| 12 | namespace FileUtil { | ||
| 13 | class IOFile; | ||
| 14 | } | ||
| 15 | |||
| 13 | namespace FileSys { | 16 | namespace FileSys { |
| 14 | 17 | ||
| 15 | class RealVfsFilesystem : public VfsFilesystem { | 18 | class RealVfsFilesystem : public VfsFilesystem { |
| 16 | public: | 19 | public: |
| 17 | RealVfsFilesystem(); | 20 | RealVfsFilesystem(); |
| 21 | ~RealVfsFilesystem() override; | ||
| 18 | 22 | ||
| 19 | std::string GetName() const override; | 23 | std::string GetName() const override; |
| 20 | bool IsReadable() const override; | 24 | bool IsReadable() const override; |
| @@ -40,10 +44,9 @@ class RealVfsFile : public VfsFile { | |||
| 40 | friend class RealVfsDirectory; | 44 | friend class RealVfsDirectory; |
| 41 | friend class RealVfsFilesystem; | 45 | friend class RealVfsFilesystem; |
| 42 | 46 | ||
| 43 | RealVfsFile(RealVfsFilesystem& base, std::shared_ptr<FileUtil::IOFile> backing, | ||
| 44 | const std::string& path, Mode perms = Mode::Read); | ||
| 45 | |||
| 46 | public: | 47 | public: |
| 48 | ~RealVfsFile() override; | ||
| 49 | |||
| 47 | std::string GetName() const override; | 50 | std::string GetName() const override; |
| 48 | size_t GetSize() const override; | 51 | size_t GetSize() const override; |
| 49 | bool Resize(size_t new_size) override; | 52 | bool Resize(size_t new_size) override; |
| @@ -55,6 +58,9 @@ public: | |||
| 55 | bool Rename(std::string_view name) override; | 58 | bool Rename(std::string_view name) override; |
| 56 | 59 | ||
| 57 | private: | 60 | private: |
| 61 | RealVfsFile(RealVfsFilesystem& base, std::shared_ptr<FileUtil::IOFile> backing, | ||
| 62 | const std::string& path, Mode perms = Mode::Read); | ||
| 63 | |||
| 58 | bool Close(); | 64 | bool Close(); |
| 59 | 65 | ||
| 60 | RealVfsFilesystem& base; | 66 | RealVfsFilesystem& base; |
| @@ -70,9 +76,9 @@ private: | |||
| 70 | class RealVfsDirectory : public VfsDirectory { | 76 | class RealVfsDirectory : public VfsDirectory { |
| 71 | friend class RealVfsFilesystem; | 77 | friend class RealVfsFilesystem; |
| 72 | 78 | ||
| 73 | RealVfsDirectory(RealVfsFilesystem& base, const std::string& path, Mode perms = Mode::Read); | ||
| 74 | |||
| 75 | public: | 79 | public: |
| 80 | ~RealVfsDirectory() override; | ||
| 81 | |||
| 76 | std::shared_ptr<VfsFile> GetFileRelative(std::string_view path) const override; | 82 | std::shared_ptr<VfsFile> GetFileRelative(std::string_view path) const override; |
| 77 | std::shared_ptr<VfsDirectory> GetDirectoryRelative(std::string_view path) const override; | 83 | std::shared_ptr<VfsDirectory> GetDirectoryRelative(std::string_view path) const override; |
| 78 | std::shared_ptr<VfsFile> GetFile(std::string_view name) const override; | 84 | std::shared_ptr<VfsFile> GetFile(std::string_view name) const override; |
| @@ -97,6 +103,8 @@ protected: | |||
| 97 | bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) override; | 103 | bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) override; |
| 98 | 104 | ||
| 99 | private: | 105 | private: |
| 106 | RealVfsDirectory(RealVfsFilesystem& base, const std::string& path, Mode perms = Mode::Read); | ||
| 107 | |||
| 100 | template <typename T, typename R> | 108 | template <typename T, typename R> |
| 101 | std::vector<std::shared_ptr<R>> IterateEntries() const; | 109 | std::vector<std::shared_ptr<R>> IterateEntries() const; |
| 102 | 110 | ||
diff --git a/src/core/file_sys/xts_archive.cpp b/src/core/file_sys/xts_archive.cpp index 552835738..4dbc25c55 100644 --- a/src/core/file_sys/xts_archive.cpp +++ b/src/core/file_sys/xts_archive.cpp | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <mbedtls/md.h> | 10 | #include <mbedtls/md.h> |
| 11 | #include <mbedtls/sha256.h> | 11 | #include <mbedtls/sha256.h> |
| 12 | #include "common/assert.h" | 12 | #include "common/assert.h" |
| 13 | #include "common/file_util.h" | ||
| 13 | #include "common/hex_util.h" | 14 | #include "common/hex_util.h" |
| 14 | #include "common/logging/log.h" | 15 | #include "common/logging/log.h" |
| 15 | #include "core/crypto/aes_util.h" | 16 | #include "core/crypto/aes_util.h" |
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index c13fb49b8..5980cdb25 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp | |||
| @@ -5,9 +5,9 @@ | |||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | #include <ostream> | 6 | #include <ostream> |
| 7 | #include <string> | 7 | #include <string> |
| 8 | #include "common/file_util.h" | ||
| 8 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 9 | #include "common/string_util.h" | 10 | #include "common/string_util.h" |
| 10 | #include "core/file_sys/vfs_real.h" | ||
| 11 | #include "core/hle/kernel/process.h" | 11 | #include "core/hle/kernel/process.h" |
| 12 | #include "core/loader/deconstructed_rom_directory.h" | 12 | #include "core/loader/deconstructed_rom_directory.h" |
| 13 | #include "core/loader/elf.h" | 13 | #include "core/loader/elf.h" |
| @@ -144,6 +144,9 @@ std::ostream& operator<<(std::ostream& os, ResultStatus status) { | |||
| 144 | return os; | 144 | return os; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | AppLoader::AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {} | ||
| 148 | AppLoader::~AppLoader() = default; | ||
| 149 | |||
| 147 | /** | 150 | /** |
| 148 | * Get a loader for a file with a specific type | 151 | * Get a loader for a file with a specific type |
| 149 | * @param file The file to load | 152 | * @param file The file to load |
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 885fee84c..5a8540b0e 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <algorithm> | ||
| 8 | #include <iosfwd> | 7 | #include <iosfwd> |
| 9 | #include <memory> | 8 | #include <memory> |
| 10 | #include <string> | 9 | #include <string> |
| @@ -12,7 +11,6 @@ | |||
| 12 | #include <vector> | 11 | #include <vector> |
| 13 | #include <boost/optional.hpp> | 12 | #include <boost/optional.hpp> |
| 14 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 15 | #include "common/file_util.h" | ||
| 16 | #include "core/file_sys/vfs.h" | 14 | #include "core/file_sys/vfs.h" |
| 17 | #include "core/hle/kernel/object.h" | 15 | #include "core/hle/kernel/object.h" |
| 18 | 16 | ||
| @@ -114,8 +112,8 @@ std::ostream& operator<<(std::ostream& os, ResultStatus status); | |||
| 114 | /// Interface for loading an application | 112 | /// Interface for loading an application |
| 115 | class AppLoader : NonCopyable { | 113 | class AppLoader : NonCopyable { |
| 116 | public: | 114 | public: |
| 117 | explicit AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {} | 115 | explicit AppLoader(FileSys::VirtualFile file); |
| 118 | virtual ~AppLoader() {} | 116 | virtual ~AppLoader(); |
| 119 | 117 | ||
| 120 | /** | 118 | /** |
| 121 | * Returns the type of this file | 119 | * Returns the type of this file |