From a40537314405d62baa012836da9bba24ad4b02e5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 2 Sep 2018 10:53:06 -0400 Subject: 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. --- src/core/core.cpp | 5 +++-- src/core/file_sys/registered_cache.cpp | 2 +- src/core/file_sys/vfs_real.cpp | 6 ++++++ src/core/file_sys/vfs_real.h | 20 ++++++++++++++------ src/core/file_sys/xts_archive.cpp | 1 + src/core/loader/loader.cpp | 5 ++++- src/core/loader/loader.h | 6 ++---- src/yuzu/game_list.cpp | 3 ++- src/yuzu/game_list.h | 2 ++ src/yuzu/game_list_p.h | 5 +++++ src/yuzu/main.cpp | 1 + src/yuzu/main.h | 3 +++ src/yuzu_cmd/yuzu.cpp | 1 + 13 files changed, 45 insertions(+), 15 deletions(-) (limited to 'src') 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 @@ #include "core/core.h" #include "core/core_cpu.h" #include "core/core_timing.h" +#include "core/file_sys/mode.h" +#include "core/file_sys/vfs_concat.h" +#include "core/file_sys/vfs_real.h" #include "core/gdbstub/gdbstub.h" #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/kernel.h" @@ -27,8 +30,6 @@ #include "core/perf_stats.h" #include "core/settings.h" #include "core/telemetry_session.h" -#include "file_sys/vfs_concat.h" -#include "file_sys/vfs_real.h" #include "video_core/debug_utils/debug_utils.h" #include "video_core/gpu.h" #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 @@ #include #include #include "common/assert.h" +#include "common/file_util.h" #include "common/hex_util.h" #include "common/logging/log.h" -#include "core/crypto/encryption_layer.h" #include "core/file_sys/card_image.h" #include "core/file_sys/nca_metadata.h" #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 @@ #include #include "common/assert.h" #include "common/common_paths.h" +#include "common/file_util.h" #include "common/logging/log.h" #include "core/file_sys/vfs_real.h" @@ -39,6 +40,7 @@ static std::string ModeFlagsToString(Mode mode) { } RealVfsFilesystem::RealVfsFilesystem() : VfsFilesystem(nullptr) {} +RealVfsFilesystem::~RealVfsFilesystem() = default; std::string RealVfsFilesystem::GetName() const { return "Real"; @@ -219,6 +221,8 @@ RealVfsFile::RealVfsFile(RealVfsFilesystem& base_, std::shared_ptr RealVfsDirectory::GetFileRelative(std::string_view path) const { const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path)); 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 @@ #include #include -#include "common/file_util.h" #include "core/file_sys/mode.h" #include "core/file_sys/vfs.h" +namespace FileUtil { +class IOFile; +} + namespace FileSys { class RealVfsFilesystem : public VfsFilesystem { public: RealVfsFilesystem(); + ~RealVfsFilesystem() override; std::string GetName() const override; bool IsReadable() const override; @@ -40,10 +44,9 @@ class RealVfsFile : public VfsFile { friend class RealVfsDirectory; friend class RealVfsFilesystem; - RealVfsFile(RealVfsFilesystem& base, std::shared_ptr backing, - const std::string& path, Mode perms = Mode::Read); - public: + ~RealVfsFile() override; + std::string GetName() const override; size_t GetSize() const override; bool Resize(size_t new_size) override; @@ -55,6 +58,9 @@ public: bool Rename(std::string_view name) override; private: + RealVfsFile(RealVfsFilesystem& base, std::shared_ptr backing, + const std::string& path, Mode perms = Mode::Read); + bool Close(); RealVfsFilesystem& base; @@ -70,9 +76,9 @@ private: class RealVfsDirectory : public VfsDirectory { friend class RealVfsFilesystem; - RealVfsDirectory(RealVfsFilesystem& base, const std::string& path, Mode perms = Mode::Read); - public: + ~RealVfsDirectory() override; + std::shared_ptr GetFileRelative(std::string_view path) const override; std::shared_ptr GetDirectoryRelative(std::string_view path) const override; std::shared_ptr GetFile(std::string_view name) const override; @@ -97,6 +103,8 @@ protected: bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) override; private: + RealVfsDirectory(RealVfsFilesystem& base, const std::string& path, Mode perms = Mode::Read); + template std::vector> IterateEntries() const; 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 @@ #include #include #include "common/assert.h" +#include "common/file_util.h" #include "common/hex_util.h" #include "common/logging/log.h" #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 @@ #include #include #include +#include "common/file_util.h" #include "common/logging/log.h" #include "common/string_util.h" -#include "core/file_sys/vfs_real.h" #include "core/hle/kernel/process.h" #include "core/loader/deconstructed_rom_directory.h" #include "core/loader/elf.h" @@ -144,6 +144,9 @@ std::ostream& operator<<(std::ostream& os, ResultStatus status) { return os; } +AppLoader::AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {} +AppLoader::~AppLoader() = default; + /** * Get a loader for a file with a specific type * @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 @@ #pragma once -#include #include #include #include @@ -12,7 +11,6 @@ #include #include #include "common/common_types.h" -#include "common/file_util.h" #include "core/file_sys/vfs.h" #include "core/hle/kernel/object.h" @@ -114,8 +112,8 @@ std::ostream& operator<<(std::ostream& os, ResultStatus status); /// Interface for loading an application class AppLoader : NonCopyable { public: - explicit AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {} - virtual ~AppLoader() {} + explicit AppLoader(FileSys::VirtualFile file); + virtual ~AppLoader(); /** * Returns the type of this file diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index d15242d59..a3f4d9421 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -16,8 +16,9 @@ #include #include #include "common/common_paths.h" +#include "common/common_types.h" +#include "common/file_util.h" #include "common/logging/log.h" -#include "common/string_util.h" #include "core/file_sys/content_archive.h" #include "core/file_sys/control_metadata.h" #include "core/file_sys/registered_cache.h" diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 6a5c2f5f8..84731464a 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h @@ -20,6 +20,8 @@ #include #include +#include "common/common_types.h" + class GameListWorker; class GMainWindow; diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 3624cb21a..4ddd8cd88 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h @@ -4,18 +4,23 @@ #pragma once +#include #include #include #include #include +#include #include #include + #include #include #include #include #include #include + +#include "common/common_types.h" #include "common/logging/log.h" #include "common/string_util.h" #include "yuzu/ui_settings.h" diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index cfc48a416..fd73b8541 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -18,6 +18,7 @@ #include #include #include "common/common_paths.h" +#include "common/file_util.h" #include "common/logging/backend.h" #include "common/logging/filter.h" #include "common/logging/log.h" diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 3d6ebe329..29bc6e004 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -6,8 +6,11 @@ #include #include + #include #include + +#include "common/common_types.h" #include "core/core.h" #include "ui_main.h" #include "yuzu/hotkeys.h" diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 41e7da897..173ac0e0f 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -10,6 +10,7 @@ #include #include "common/common_paths.h" +#include "common/file_util.h" #include "common/logging/backend.h" #include "common/logging/filter.h" #include "common/logging/log.h" -- cgit v1.2.3