From 96463d0a55b11f73417941f2c29ca24f08196878 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 20 Aug 2018 20:24:13 -0400 Subject: [PATCH 1/2] romfs_factory: Remove unnecessary includes and use forward declarations where applicable Avoids the need to rebuild whatever includes the romfs factory header if the loader header ever changes. We also don't need to include the main core header. We can instead include the headers we specifically need. --- src/core/file_sys/nca_metadata.h | 1 + src/core/file_sys/romfs_factory.cpp | 6 ++++-- src/core/file_sys/romfs_factory.h | 8 +++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/core/file_sys/nca_metadata.h b/src/core/file_sys/nca_metadata.h index 88e66d4da1..ce05b4c1d2 100644 --- a/src/core/file_sys/nca_metadata.h +++ b/src/core/file_sys/nca_metadata.h @@ -7,6 +7,7 @@ #include #include #include +#include "common/common_funcs.h" #include "common/common_types.h" #include "common/swap.h" #include "core/file_sys/vfs.h" diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index 1b3824a61b..ab67bc7493 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp @@ -6,15 +6,17 @@ #include #include "common/common_types.h" #include "common/logging/log.h" -#include "core/core.h" +#include "core/file_sys/nca_metadata.h" #include "core/file_sys/romfs_factory.h" #include "core/hle/kernel/process.h" +#include "core/hle/service/filesystem/filesystem.h" +#include "core/loader/loader.h" namespace FileSys { RomFSFactory::RomFSFactory(Loader::AppLoader& app_loader) { // Load the RomFS from the app - if (Loader::ResultStatus::Success != app_loader.ReadRomFS(file)) { + if (app_loader.ReadRomFS(file) != Loader::ResultStatus::Success) { LOG_ERROR(Service_FS, "Unable to read RomFS!"); } } diff --git a/src/core/file_sys/romfs_factory.h b/src/core/file_sys/romfs_factory.h index 455cd41593..f38ddc4f7c 100644 --- a/src/core/file_sys/romfs_factory.h +++ b/src/core/file_sys/romfs_factory.h @@ -6,11 +6,17 @@ #include #include "common/common_types.h" +#include "core/file_sys/vfs.h" #include "core/hle/result.h" -#include "core/loader/loader.h" + +namespace Loader { +class AppLoader; +} // namespace Loader namespace FileSys { +enum class ContentRecordType : u8; + enum class StorageId : u8 { None = 0, Host = 1, From 477eee3993fe366bcc4cf937de30259ec359adf0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 20 Aug 2018 20:36:36 -0400 Subject: [PATCH 2/2] service/filesystem: Use forward declarations where applicable Avoids the need to rebuild multiple source files if the filesystem code headers change. This also gets rid of a few instances of indirect inclusions being relied upon --- src/core/file_sys/romfs_factory.cpp | 1 + src/core/hle/service/filesystem/filesystem.cpp | 2 ++ src/core/hle/service/filesystem/filesystem.h | 18 ++++++++++++++---- src/core/hle/service/filesystem/fsp_srv.cpp | 4 +++- .../loader/deconstructed_rom_directory.cpp | 1 + src/core/loader/nca.cpp | 1 + src/yuzu/game_list.cpp | 1 + src/yuzu/game_list_p.h | 3 +++ src/yuzu/main.cpp | 2 ++ 9 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index ab67bc7493..eb4e6c8653 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp @@ -7,6 +7,7 @@ #include "common/common_types.h" #include "common/logging/log.h" #include "core/file_sys/nca_metadata.h" +#include "core/file_sys/registered_cache.h" #include "core/file_sys/romfs_factory.h" #include "core/hle/kernel/process.h" #include "core/hle/service/filesystem/filesystem.h" diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index f374111c1f..0d2b1544f6 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -7,7 +7,9 @@ #include "common/assert.h" #include "common/file_util.h" #include "core/core.h" +#include "core/file_sys/bis_factory.h" #include "core/file_sys/errors.h" +#include "core/file_sys/romfs_factory.h" #include "core/file_sys/savedata_factory.h" #include "core/file_sys/sdmc_factory.h" #include "core/file_sys/vfs.h" diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h index 37a2878b00..572c16f4dd 100644 --- a/src/core/hle/service/filesystem/filesystem.h +++ b/src/core/hle/service/filesystem/filesystem.h @@ -6,14 +6,24 @@ #include #include "common/common_types.h" -#include "core/file_sys/bis_factory.h" #include "core/file_sys/directory.h" #include "core/file_sys/mode.h" -#include "core/file_sys/romfs_factory.h" -#include "core/file_sys/savedata_factory.h" -#include "core/file_sys/sdmc_factory.h" #include "core/hle/result.h" +namespace FileSys { +class BISFactory; +class RegisteredCache; +class RomFSFactory; +class SaveDataFactory; +class SDMCFactory; + +enum class ContentRecordType : u8; +enum class SaveDataSpaceId : u8; +enum class StorageId : u8; + +struct SaveDataDescriptor; +} // namespace FileSys + namespace Service { namespace SM { diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 2f8a7a3c1c..8ece74d7ed 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -13,9 +13,11 @@ #include "common/common_types.h" #include "common/logging/log.h" #include "common/string_util.h" -#include "core/core.h" #include "core/file_sys/directory.h" #include "core/file_sys/errors.h" +#include "core/file_sys/nca_metadata.h" +#include "core/file_sys/savedata_factory.h" +#include "core/file_sys/vfs.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/process.h" #include "core/hle/service/filesystem/filesystem.h" diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index d575a9beac..4c79d7902c 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp @@ -8,6 +8,7 @@ #include "common/logging/log.h" #include "core/file_sys/content_archive.h" #include "core/file_sys/control_metadata.h" +#include "core/file_sys/romfs_factory.h" #include "core/gdbstub/gdbstub.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp index 9d50c7d426..c036a8a1cd 100644 --- a/src/core/loader/nca.cpp +++ b/src/core/loader/nca.cpp @@ -7,6 +7,7 @@ #include "common/file_util.h" #include "common/logging/log.h" #include "core/file_sys/content_archive.h" +#include "core/file_sys/romfs_factory.h" #include "core/hle/kernel/process.h" #include "core/hle/service/filesystem/filesystem.h" #include "core/loader/deconstructed_rom_directory.h" diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index bc4b930333..a974fb9337 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -16,6 +16,7 @@ #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" #include "core/file_sys/romfs.h" #include "core/file_sys/vfs_real.h" #include "core/loader/loader.h" diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 10c2ef0758..c596137697 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h @@ -6,12 +6,15 @@ #include #include +#include +#include #include #include #include #include #include #include "common/string_util.h" +#include "core/file_sys/content_archive.h" #include "ui_settings.h" #include "yuzu/util/util.h" diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 11d2331dff..3db3f9d988 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -27,7 +27,9 @@ #include "common/string_util.h" #include "core/core.h" #include "core/crypto/key_manager.h" +#include "core/file_sys/bis_factory.h" #include "core/file_sys/card_image.h" +#include "core/file_sys/registered_cache.h" #include "core/file_sys/vfs_real.h" #include "core/gdbstub/gdbstub.h" #include "core/loader/loader.h"