summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2018-09-02 10:53:06 -0400
committerGravatar Lioncash2018-09-02 12:38:14 -0400
commita40537314405d62baa012836da9bba24ad4b02e5 (patch)
treee713eda9ce20870d7e803989d555e7842eab3415 /src
parentMerge pull request #1213 from DarkLordZach/octopath-fs (diff)
downloadyuzu-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')
-rw-r--r--src/core/core.cpp5
-rw-r--r--src/core/file_sys/registered_cache.cpp2
-rw-r--r--src/core/file_sys/vfs_real.cpp6
-rw-r--r--src/core/file_sys/vfs_real.h20
-rw-r--r--src/core/file_sys/xts_archive.cpp1
-rw-r--r--src/core/loader/loader.cpp5
-rw-r--r--src/core/loader/loader.h6
-rw-r--r--src/yuzu/game_list.cpp3
-rw-r--r--src/yuzu/game_list.h2
-rw-r--r--src/yuzu/game_list_p.h5
-rw-r--r--src/yuzu/main.cpp1
-rw-r--r--src/yuzu/main.h3
-rw-r--r--src/yuzu_cmd/yuzu.cpp1
13 files changed, 45 insertions, 15 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
41RealVfsFilesystem::RealVfsFilesystem() : VfsFilesystem(nullptr) {} 42RealVfsFilesystem::RealVfsFilesystem() : VfsFilesystem(nullptr) {}
43RealVfsFilesystem::~RealVfsFilesystem() = default;
42 44
43std::string RealVfsFilesystem::GetName() const { 45std::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
224RealVfsFile::~RealVfsFile() = default;
225
222std::string RealVfsFile::GetName() const { 226std::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
319RealVfsDirectory::~RealVfsDirectory() = default;
320
315std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path) const { 321std::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
12namespace FileUtil {
13class IOFile;
14}
15
13namespace FileSys { 16namespace FileSys {
14 17
15class RealVfsFilesystem : public VfsFilesystem { 18class RealVfsFilesystem : public VfsFilesystem {
16public: 19public:
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
46public: 47public:
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
57private: 60private:
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:
70class RealVfsDirectory : public VfsDirectory { 76class 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
75public: 79public:
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
99private: 105private:
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
147AppLoader::AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {}
148AppLoader::~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
115class AppLoader : NonCopyable { 113class AppLoader : NonCopyable {
116public: 114public:
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
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 @@
16#include <boost/container/flat_map.hpp> 16#include <boost/container/flat_map.hpp>
17#include <fmt/format.h> 17#include <fmt/format.h>
18#include "common/common_paths.h" 18#include "common/common_paths.h"
19#include "common/common_types.h"
20#include "common/file_util.h"
19#include "common/logging/log.h" 21#include "common/logging/log.h"
20#include "common/string_util.h"
21#include "core/file_sys/content_archive.h" 22#include "core/file_sys/content_archive.h"
22#include "core/file_sys/control_metadata.h" 23#include "core/file_sys/control_metadata.h"
23#include "core/file_sys/registered_cache.h" 24#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 @@
20#include <QVBoxLayout> 20#include <QVBoxLayout>
21#include <QWidget> 21#include <QWidget>
22 22
23#include "common/common_types.h"
24
23class GameListWorker; 25class GameListWorker;
24class GMainWindow; 26class GMainWindow;
25 27
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 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <algorithm>
7#include <array> 8#include <array>
8#include <atomic> 9#include <atomic>
9#include <map> 10#include <map>
10#include <memory> 11#include <memory>
12#include <string>
11#include <unordered_map> 13#include <unordered_map>
12#include <utility> 14#include <utility>
15
13#include <QCoreApplication> 16#include <QCoreApplication>
14#include <QImage> 17#include <QImage>
15#include <QObject> 18#include <QObject>
16#include <QRunnable> 19#include <QRunnable>
17#include <QStandardItem> 20#include <QStandardItem>
18#include <QString> 21#include <QString>
22
23#include "common/common_types.h"
19#include "common/logging/log.h" 24#include "common/logging/log.h"
20#include "common/string_util.h" 25#include "common/string_util.h"
21#include "yuzu/ui_settings.h" 26#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 @@
18#include <QtWidgets> 18#include <QtWidgets>
19#include <fmt/format.h> 19#include <fmt/format.h>
20#include "common/common_paths.h" 20#include "common/common_paths.h"
21#include "common/file_util.h"
21#include "common/logging/backend.h" 22#include "common/logging/backend.h"
22#include "common/logging/filter.h" 23#include "common/logging/filter.h"
23#include "common/logging/log.h" 24#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 @@
6 6
7#include <memory> 7#include <memory>
8#include <unordered_map> 8#include <unordered_map>
9
9#include <QMainWindow> 10#include <QMainWindow>
10#include <QTimer> 11#include <QTimer>
12
13#include "common/common_types.h"
11#include "core/core.h" 14#include "core/core.h"
12#include "ui_main.h" 15#include "ui_main.h"
13#include "yuzu/hotkeys.h" 16#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 @@
10#include <fmt/ostream.h> 10#include <fmt/ostream.h>
11 11
12#include "common/common_paths.h" 12#include "common/common_paths.h"
13#include "common/file_util.h"
13#include "common/logging/backend.h" 14#include "common/logging/backend.h"
14#include "common/logging/filter.h" 15#include "common/logging/filter.h"
15#include "common/logging/log.h" 16#include "common/logging/log.h"