summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2019-04-22 17:56:56 -0400
committerGravatar Zach Hilman2019-09-21 16:43:10 -0400
commitc6ff4a6f4d05eb380616be57e4088003e7aedfcb (patch)
treea923240a1505dd0ebbf476f43fe7e653a07e3217 /src
parentsettings: Update LogSettings to show NAND/SDMC paths from FileUtil (diff)
downloadyuzu-c6ff4a6f4d05eb380616be57e4088003e7aedfcb.tar.gz
yuzu-c6ff4a6f4d05eb380616be57e4088003e7aedfcb.tar.xz
yuzu-c6ff4a6f4d05eb380616be57e4088003e7aedfcb.zip
yuzu: Port old usages of Filesystem namespace to FilesystemController
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/patch_manager.cpp24
-rw-r--r--src/core/file_sys/registered_cache.cpp1
-rw-r--r--src/core/file_sys/romfs_factory.cpp11
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp1
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp46
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.h4
-rw-r--r--src/core/hle/service/service.cpp2
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp4
-rw-r--r--src/core/loader/nca.cpp4
-rw-r--r--src/core/loader/nro.cpp4
-rw-r--r--src/core/loader/nsp.cpp4
-rw-r--r--src/core/loader/xci.cpp4
-rw-r--r--src/yuzu/main.cpp41
-rw-r--r--src/yuzu_cmd/yuzu.cpp2
14 files changed, 106 insertions, 46 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index e3ebaca03..c1dd0c6d7 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -63,7 +63,8 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
63 63
64 if (Settings::values.dump_exefs) { 64 if (Settings::values.dump_exefs) {
65 LOG_INFO(Loader, "Dumping ExeFS for title_id={:016X}", title_id); 65 LOG_INFO(Loader, "Dumping ExeFS for title_id={:016X}", title_id);
66 const auto dump_dir = Service::FileSystem::GetModificationDumpRoot(title_id); 66 const auto dump_dir =
67 Core::System::GetInstance().GetFileSystemController().GetModificationDumpRoot(title_id);
67 if (dump_dir != nullptr) { 68 if (dump_dir != nullptr) {
68 const auto exefs_dir = GetOrCreateDirectoryRelative(dump_dir, "/exefs"); 69 const auto exefs_dir = GetOrCreateDirectoryRelative(dump_dir, "/exefs");
69 VfsRawCopyD(exefs, exefs_dir); 70 VfsRawCopyD(exefs, exefs_dir);
@@ -88,7 +89,8 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
88 } 89 }
89 90
90 // LayeredExeFS 91 // LayeredExeFS
91 const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); 92 const auto load_dir =
93 Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id);
92 if (load_dir != nullptr && load_dir->GetSize() > 0) { 94 if (load_dir != nullptr && load_dir->GetSize() > 0) {
93 auto patch_dirs = load_dir->GetSubdirectories(); 95 auto patch_dirs = load_dir->GetSubdirectories();
94 std::sort( 96 std::sort(
@@ -174,7 +176,8 @@ std::vector<u8> PatchManager::PatchNSO(const std::vector<u8>& nso, const std::st
174 if (Settings::values.dump_nso) { 176 if (Settings::values.dump_nso) {
175 LOG_INFO(Loader, "Dumping NSO for name={}, build_id={}, title_id={:016X}", name, build_id, 177 LOG_INFO(Loader, "Dumping NSO for name={}, build_id={}, title_id={:016X}", name, build_id,
176 title_id); 178 title_id);
177 const auto dump_dir = Service::FileSystem::GetModificationDumpRoot(title_id); 179 const auto dump_dir =
180 Core::System::GetInstance().GetFileSystemController().GetModificationDumpRoot(title_id);
178 if (dump_dir != nullptr) { 181 if (dump_dir != nullptr) {
179 const auto nso_dir = GetOrCreateDirectoryRelative(dump_dir, "/nso"); 182 const auto nso_dir = GetOrCreateDirectoryRelative(dump_dir, "/nso");
180 const auto file = nso_dir->CreateFile(fmt::format("{}-{}.nso", name, build_id)); 183 const auto file = nso_dir->CreateFile(fmt::format("{}-{}.nso", name, build_id));
@@ -186,7 +189,8 @@ std::vector<u8> PatchManager::PatchNSO(const std::vector<u8>& nso, const std::st
186 189
187 LOG_INFO(Loader, "Patching NSO for name={}, build_id={}", name, build_id); 190 LOG_INFO(Loader, "Patching NSO for name={}, build_id={}", name, build_id);
188 191
189 const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); 192 const auto load_dir =
193 Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id);
190 if (load_dir == nullptr) { 194 if (load_dir == nullptr) {
191 LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id); 195 LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id);
192 return nso; 196 return nso;
@@ -229,7 +233,8 @@ bool PatchManager::HasNSOPatch(const std::array<u8, 32>& build_id_) const {
229 233
230 LOG_INFO(Loader, "Querying NSO patch existence for build_id={}", build_id); 234 LOG_INFO(Loader, "Querying NSO patch existence for build_id={}", build_id);
231 235
232 const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); 236 const auto load_dir =
237 Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id);
233 if (load_dir == nullptr) { 238 if (load_dir == nullptr) {
234 LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id); 239 LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id);
235 return false; 240 return false;
@@ -268,7 +273,8 @@ static std::optional<CheatList> ReadCheatFileFromFolder(const Core::System& syst
268 273
269std::vector<CheatList> PatchManager::CreateCheatList(const Core::System& system, 274std::vector<CheatList> PatchManager::CreateCheatList(const Core::System& system,
270 const std::array<u8, 32>& build_id_) const { 275 const std::array<u8, 32>& build_id_) const {
271 const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); 276 const auto load_dir =
277 Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id);
272 if (load_dir == nullptr) { 278 if (load_dir == nullptr) {
273 LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id); 279 LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id);
274 return {}; 280 return {};
@@ -299,7 +305,8 @@ std::vector<CheatList> PatchManager::CreateCheatList(const Core::System& system,
299} 305}
300 306
301static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType type) { 307static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType type) {
302 const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); 308 const auto load_dir =
309 Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id);
303 if ((type != ContentRecordType::Program && type != ContentRecordType::Data) || 310 if ((type != ContentRecordType::Program && type != ContentRecordType::Data) ||
304 load_dir == nullptr || load_dir->GetSize() <= 0) { 311 load_dir == nullptr || load_dir->GetSize() <= 0) {
305 return; 312 return;
@@ -440,7 +447,8 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam
440 } 447 }
441 448
442 // General Mods (LayeredFS and IPS) 449 // General Mods (LayeredFS and IPS)
443 const auto mod_dir = Service::FileSystem::GetModificationLoadRoot(title_id); 450 const auto mod_dir =
451 Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id);
444 if (mod_dir != nullptr && mod_dir->GetSize() > 0) { 452 if (mod_dir != nullptr && mod_dir->GetSize() > 0) {
445 for (const auto& mod : mod_dir->GetSubdirectories()) { 453 for (const auto& mod : mod_dir->GetSubdirectories()) {
446 std::string types; 454 std::string types;
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp
index afa87be9c..d1ef1e72d 100644
--- a/src/core/file_sys/registered_cache.cpp
+++ b/src/core/file_sys/registered_cache.cpp
@@ -3,6 +3,7 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm> 5#include <algorithm>
6#include <random>
6#include <regex> 7#include <regex>
7#include <mbedtls/sha256.h> 8#include <mbedtls/sha256.h>
8#include "common/assert.h" 9#include "common/assert.h"
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp
index b2ccb2926..c3ee4a158 100644
--- a/src/core/file_sys/romfs_factory.cpp
+++ b/src/core/file_sys/romfs_factory.cpp
@@ -7,6 +7,7 @@
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "core/core.h" 9#include "core/core.h"
10#include "core/file_sys/card_image.h"
10#include "core/file_sys/content_archive.h" 11#include "core/file_sys/content_archive.h"
11#include "core/file_sys/nca_metadata.h" 12#include "core/file_sys/nca_metadata.h"
12#include "core/file_sys/patch_manager.h" 13#include "core/file_sys/patch_manager.h"
@@ -51,13 +52,17 @@ ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, Conte
51 res = Core::System::GetInstance().GetContentProvider().GetEntry(title_id, type); 52 res = Core::System::GetInstance().GetContentProvider().GetEntry(title_id, type);
52 break; 53 break;
53 case StorageId::NandSystem: 54 case StorageId::NandSystem:
54 res = Service::FileSystem::GetSystemNANDContents()->GetEntry(title_id, type); 55 res =
56 Core::System::GetInstance().GetFileSystemController().GetSystemNANDContents()->GetEntry(
57 title_id, type);
55 break; 58 break;
56 case StorageId::NandUser: 59 case StorageId::NandUser:
57 res = Service::FileSystem::GetUserNANDContents()->GetEntry(title_id, type); 60 res = Core::System::GetInstance().GetFileSystemController().GetUserNANDContents()->GetEntry(
61 title_id, type);
58 break; 62 break;
59 case StorageId::SdCard: 63 case StorageId::SdCard:
60 res = Service::FileSystem::GetSDMCContents()->GetEntry(title_id, type); 64 res = Core::System::GetInstance().GetFileSystemController().GetSDMCContents()->GetEntry(
65 title_id, type);
61 break; 66 break;
62 default: 67 default:
63 UNIMPLEMENTED_MSG("Unimplemented storage_id={:02X}", static_cast<u8>(storage)); 68 UNIMPLEMENTED_MSG("Unimplemented storage_id={:02X}", static_cast<u8>(storage));
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index d8debf612..76a860c6d 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -26,6 +26,7 @@
26#include "core/hle/service/filesystem/fsp_pr.h" 26#include "core/hle/service/filesystem/fsp_pr.h"
27#include "core/hle/service/filesystem/fsp_srv.h" 27#include "core/hle/service/filesystem/fsp_srv.h"
28#include "core/loader/loader.h" 28#include "core/loader/loader.h"
29#include "core/settings.h"
29 30
30namespace Service::FileSystem { 31namespace Service::FileSystem {
31 32
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 85f8e4a63..525fda19f 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -19,6 +19,7 @@
19#include "core/file_sys/mode.h" 19#include "core/file_sys/mode.h"
20#include "core/file_sys/nca_metadata.h" 20#include "core/file_sys/nca_metadata.h"
21#include "core/file_sys/patch_manager.h" 21#include "core/file_sys/patch_manager.h"
22#include "core/file_sys/romfs_factory.h"
22#include "core/file_sys/savedata_factory.h" 23#include "core/file_sys/savedata_factory.h"
23#include "core/file_sys/system_archive/system_archive.h" 24#include "core/file_sys/system_archive/system_archive.h"
24#include "core/file_sys/vfs.h" 25#include "core/file_sys/vfs.h"
@@ -502,8 +503,8 @@ private:
502 503
503class ISaveDataInfoReader final : public ServiceFramework<ISaveDataInfoReader> { 504class ISaveDataInfoReader final : public ServiceFramework<ISaveDataInfoReader> {
504public: 505public:
505 explicit ISaveDataInfoReader(FileSys::SaveDataSpaceId space) 506 explicit ISaveDataInfoReader(FileSys::SaveDataSpaceId space, FileSystemController& fsc)
506 : ServiceFramework("ISaveDataInfoReader") { 507 : ServiceFramework("ISaveDataInfoReader"), fsc(fsc) {
507 static const FunctionInfo functions[] = { 508 static const FunctionInfo functions[] = {
508 {0, &ISaveDataInfoReader::ReadSaveDataInfo, "ReadSaveDataInfo"}, 509 {0, &ISaveDataInfoReader::ReadSaveDataInfo, "ReadSaveDataInfo"},
509 }; 510 };
@@ -549,8 +550,13 @@ private:
549 } 550 }
550 551
551 void FindAllSaves(FileSys::SaveDataSpaceId space) { 552 void FindAllSaves(FileSys::SaveDataSpaceId space) {
552 const auto save_root = OpenSaveDataSpace(space); 553 const auto save_root = fsc.OpenSaveDataSpace(space);
553 ASSERT(save_root.Succeeded()); 554
555 if (save_root.Failed() || *save_root == nullptr) {
556 LOG_ERROR(Service_FS, "The save root for the space_id={:02X} was invalid!",
557 static_cast<u8>(space));
558 return;
559 }
554 560
555 for (const auto& type : (*save_root)->GetSubdirectories()) { 561 for (const auto& type : (*save_root)->GetSubdirectories()) {
556 if (type->GetName() == "save") { 562 if (type->GetName() == "save") {
@@ -639,11 +645,12 @@ private:
639 }; 645 };
640 static_assert(sizeof(SaveDataInfo) == 0x60, "SaveDataInfo has incorrect size."); 646 static_assert(sizeof(SaveDataInfo) == 0x60, "SaveDataInfo has incorrect size.");
641 647
648 FileSystemController& fsc;
642 std::vector<SaveDataInfo> info; 649 std::vector<SaveDataInfo> info;
643 u64 next_entry_index = 0; 650 u64 next_entry_index = 0;
644}; 651};
645 652
646FSP_SRV::FSP_SRV(const Core::Reporter& reporter) : ServiceFramework("fsp-srv"), reporter(reporter) { 653FSP_SRV::FSP_SRV(FileSystemController& fsc) : ServiceFramework("fsp-srv"), fsc(fsc) {
647 // clang-format off 654 // clang-format off
648 static const FunctionInfo functions[] = { 655 static const FunctionInfo functions[] = {
649 {0, nullptr, "OpenFileSystem"}, 656 {0, nullptr, "OpenFileSystem"},
@@ -783,7 +790,8 @@ void FSP_SRV::OpenFileSystemWithPatch(Kernel::HLERequestContext& ctx) {
783void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) { 790void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) {
784 LOG_DEBUG(Service_FS, "called"); 791 LOG_DEBUG(Service_FS, "called");
785 792
786 IFileSystem filesystem(OpenSDMC().Unwrap()); 793 IFileSystem filesystem(fsc.OpenSDMC().Unwrap(),
794 SizeGetter::FromStorageId(fsc, FileSys::StorageId::SdCard));
787 795
788 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 796 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
789 rb.Push(RESULT_SUCCESS); 797 rb.Push(RESULT_SUCCESS);
@@ -797,8 +805,10 @@ void FSP_SRV::CreateSaveDataFileSystem(Kernel::HLERequestContext& ctx) {
797 auto save_create_struct = rp.PopRaw<std::array<u8, 0x40>>(); 805 auto save_create_struct = rp.PopRaw<std::array<u8, 0x40>>();
798 u128 uid = rp.PopRaw<u128>(); 806 u128 uid = rp.PopRaw<u128>();
799 807
800 LOG_WARNING(Service_FS, "(STUBBED) called save_struct = {}, uid = {:016X}{:016X}", 808 LOG_DEBUG(Service_FS, "called save_struct = {}, uid = {:016X}{:016X}", save_struct.DebugInfo(),
801 save_struct.DebugInfo(), uid[1], uid[0]); 809 uid[1], uid[0]);
810
811 fsc.CreateSaveData(FileSys::SaveDataSpaceId::NandUser, save_struct);
802 812
803 IPC::ResponseBuilder rb{ctx, 2}; 813 IPC::ResponseBuilder rb{ctx, 2};
804 rb.Push(RESULT_SUCCESS); 814 rb.Push(RESULT_SUCCESS);
@@ -815,14 +825,24 @@ void FSP_SRV::OpenSaveDataFileSystem(Kernel::HLERequestContext& ctx) {
815 IPC::RequestParser rp{ctx}; 825 IPC::RequestParser rp{ctx};
816 const auto parameters = rp.PopRaw<Parameters>(); 826 const auto parameters = rp.PopRaw<Parameters>();
817 827
818 auto dir = OpenSaveData(parameters.save_data_space_id, parameters.descriptor); 828 auto dir = fsc.OpenSaveData(parameters.save_data_space_id, parameters.descriptor);
819 if (dir.Failed()) { 829 if (dir.Failed()) {
820 IPC::ResponseBuilder rb{ctx, 2, 0, 0}; 830 IPC::ResponseBuilder rb{ctx, 2, 0, 0};
821 rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND); 831 rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND);
822 return; 832 return;
823 } 833 }
824 834
825 IFileSystem filesystem(std::move(dir.Unwrap())); 835 FileSys::StorageId id;
836 if (parameters.save_data_space_id == FileSys::SaveDataSpaceId::NandUser) {
837 id = FileSys::StorageId::NandUser;
838 } else if (parameters.save_data_space_id == FileSys::SaveDataSpaceId::SdCardSystem ||
839 parameters.save_data_space_id == FileSys::SaveDataSpaceId::SdCardUser) {
840 id = FileSys::StorageId::SdCard;
841 } else {
842 id = FileSys::StorageId::NandSystem;
843 }
844
845 IFileSystem filesystem(std::move(dir.Unwrap()), SizeGetter::FromStorageId(fsc, id));
826 846
827 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 847 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
828 rb.Push(RESULT_SUCCESS); 848 rb.Push(RESULT_SUCCESS);
@@ -841,7 +861,7 @@ void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(Kernel::HLERequestContext&
841 861
842 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 862 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
843 rb.Push(RESULT_SUCCESS); 863 rb.Push(RESULT_SUCCESS);
844 rb.PushIpcInterface<ISaveDataInfoReader>(std::make_shared<ISaveDataInfoReader>(space)); 864 rb.PushIpcInterface<ISaveDataInfoReader>(std::make_shared<ISaveDataInfoReader>(space, fsc));
845} 865}
846 866
847void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { 867void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
@@ -865,7 +885,7 @@ void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
865void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { 885void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
866 LOG_DEBUG(Service_FS, "called"); 886 LOG_DEBUG(Service_FS, "called");
867 887
868 auto romfs = OpenRomFSCurrentProcess(); 888 auto romfs = fsc.OpenRomFSCurrentProcess();
869 if (romfs.Failed()) { 889 if (romfs.Failed()) {
870 // TODO (bunnei): Find the right error code to use here 890 // TODO (bunnei): Find the right error code to use here
871 LOG_CRITICAL(Service_FS, "no file system interface available!"); 891 LOG_CRITICAL(Service_FS, "no file system interface available!");
@@ -890,7 +910,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) {
890 LOG_DEBUG(Service_FS, "called with storage_id={:02X}, unknown={:08X}, title_id={:016X}", 910 LOG_DEBUG(Service_FS, "called with storage_id={:02X}, unknown={:08X}, title_id={:016X}",
891 static_cast<u8>(storage_id), unknown, title_id); 911 static_cast<u8>(storage_id), unknown, title_id);
892 912
893 auto data = OpenRomFS(title_id, storage_id, FileSys::ContentRecordType::Data); 913 auto data = fsc.OpenRomFS(title_id, storage_id, FileSys::ContentRecordType::Data);
894 914
895 if (data.Failed()) { 915 if (data.Failed()) {
896 const auto archive = FileSys::SystemArchive::SynthesizeSystemArchive(title_id); 916 const auto archive = FileSys::SystemArchive::SynthesizeSystemArchive(title_id);
diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h
index b5486a193..494348598 100644
--- a/src/core/hle/service/filesystem/fsp_srv.h
+++ b/src/core/hle/service/filesystem/fsp_srv.h
@@ -32,7 +32,7 @@ enum class LogMode : u32 {
32 32
33class FSP_SRV final : public ServiceFramework<FSP_SRV> { 33class FSP_SRV final : public ServiceFramework<FSP_SRV> {
34public: 34public:
35 explicit FSP_SRV(const Core::Reporter& reporter); 35 explicit FSP_SRV(FileSystemController& fsc);
36 ~FSP_SRV() override; 36 ~FSP_SRV() override;
37 37
38private: 38private:
@@ -51,6 +51,8 @@ private:
51 void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx); 51 void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx);
52 void GetAccessLogVersionInfo(Kernel::HLERequestContext& ctx); 52 void GetAccessLogVersionInfo(Kernel::HLERequestContext& ctx);
53 53
54 FileSystemController& fsc;
55
54 FileSys::VirtualFile romfs; 56 FileSys::VirtualFile romfs;
55 u64 current_process_id = 0; 57 u64 current_process_id = 0;
56 u32 access_log_program_index = 0; 58 u32 access_log_program_index = 0;
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 8bf033c88..3d6a5990f 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -230,7 +230,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system) {
230 Migration::InstallInterfaces(*sm); 230 Migration::InstallInterfaces(*sm);
231 Mii::InstallInterfaces(*sm); 231 Mii::InstallInterfaces(*sm);
232 MM::InstallInterfaces(*sm); 232 MM::InstallInterfaces(*sm);
233 NCM::InstallInterfaces(*sm, fsc); 233 NCM::InstallInterfaces(*sm);
234 NFC::InstallInterfaces(*sm); 234 NFC::InstallInterfaces(*sm);
235 NFP::InstallInterfaces(*sm); 235 NFP::InstallInterfaces(*sm);
236 NIFM::InstallInterfaces(*sm); 236 NIFM::InstallInterfaces(*sm);
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index f9e88be2b..d19c3623c 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -7,6 +7,7 @@
7#include "common/common_funcs.h" 7#include "common/common_funcs.h"
8#include "common/file_util.h" 8#include "common/file_util.h"
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "core/core.h"
10#include "core/file_sys/content_archive.h" 11#include "core/file_sys/content_archive.h"
11#include "core/file_sys/control_metadata.h" 12#include "core/file_sys/control_metadata.h"
12#include "core/file_sys/patch_manager.h" 13#include "core/file_sys/patch_manager.h"
@@ -176,7 +177,8 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
176 // Register the RomFS if a ".romfs" file was found 177 // Register the RomFS if a ".romfs" file was found
177 if (romfs_iter != files.end() && *romfs_iter != nullptr) { 178 if (romfs_iter != files.end() && *romfs_iter != nullptr) {
178 romfs = *romfs_iter; 179 romfs = *romfs_iter;
179 Service::FileSystem::RegisterRomFS(std::make_unique<FileSys::RomFSFactory>(*this)); 180 Core::System::GetInstance().GetFileSystemController().RegisterRomFS(
181 std::make_unique<FileSys::RomFSFactory>(*this));
180 } 182 }
181 183
182 is_loaded = true; 184 is_loaded = true;
diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp
index 0f65fb637..5a0469978 100644
--- a/src/core/loader/nca.cpp
+++ b/src/core/loader/nca.cpp
@@ -6,6 +6,7 @@
6 6
7#include "common/file_util.h" 7#include "common/file_util.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "core/core.h"
9#include "core/file_sys/content_archive.h" 10#include "core/file_sys/content_archive.h"
10#include "core/file_sys/romfs_factory.h" 11#include "core/file_sys/romfs_factory.h"
11#include "core/hle/kernel/process.h" 12#include "core/hle/kernel/process.h"
@@ -57,7 +58,8 @@ AppLoader_NCA::LoadResult AppLoader_NCA::Load(Kernel::Process& process) {
57 } 58 }
58 59
59 if (nca->GetRomFS() != nullptr && nca->GetRomFS()->GetSize() > 0) { 60 if (nca->GetRomFS() != nullptr && nca->GetRomFS()->GetSize() > 0) {
60 Service::FileSystem::RegisterRomFS(std::make_unique<FileSys::RomFSFactory>(*this)); 61 Core::System::GetInstance().GetFileSystemController().RegisterRomFS(
62 std::make_unique<FileSys::RomFSFactory>(*this));
61 } 63 }
62 64
63 is_loaded = true; 65 is_loaded = true;
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp
index 3a5361fdd..175898b91 100644
--- a/src/core/loader/nro.cpp
+++ b/src/core/loader/nro.cpp
@@ -10,6 +10,7 @@
10#include "common/file_util.h" 10#include "common/file_util.h"
11#include "common/logging/log.h" 11#include "common/logging/log.h"
12#include "common/swap.h" 12#include "common/swap.h"
13#include "core/core.h"
13#include "core/file_sys/control_metadata.h" 14#include "core/file_sys/control_metadata.h"
14#include "core/file_sys/romfs_factory.h" 15#include "core/file_sys/romfs_factory.h"
15#include "core/file_sys/vfs_offset.h" 16#include "core/file_sys/vfs_offset.h"
@@ -214,7 +215,8 @@ AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::Process& process) {
214 } 215 }
215 216
216 if (romfs != nullptr) { 217 if (romfs != nullptr) {
217 Service::FileSystem::RegisterRomFS(std::make_unique<FileSys::RomFSFactory>(*this)); 218 Core::System::GetInstance().GetFileSystemController().RegisterRomFS(
219 std::make_unique<FileSys::RomFSFactory>(*this));
218 } 220 }
219 221
220 is_loaded = true; 222 is_loaded = true;
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp
index 35c82c99d..13950fc08 100644
--- a/src/core/loader/nsp.cpp
+++ b/src/core/loader/nsp.cpp
@@ -5,6 +5,7 @@
5#include <vector> 5#include <vector>
6 6
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "core/core.h"
8#include "core/file_sys/card_image.h" 9#include "core/file_sys/card_image.h"
9#include "core/file_sys/content_archive.h" 10#include "core/file_sys/content_archive.h"
10#include "core/file_sys/control_metadata.h" 11#include "core/file_sys/control_metadata.h"
@@ -105,7 +106,8 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::Process& process) {
105 106
106 FileSys::VirtualFile update_raw; 107 FileSys::VirtualFile update_raw;
107 if (ReadUpdateRaw(update_raw) == ResultStatus::Success && update_raw != nullptr) { 108 if (ReadUpdateRaw(update_raw) == ResultStatus::Success && update_raw != nullptr) {
108 Service::FileSystem::SetPackedUpdate(std::move(update_raw)); 109 Core::System::GetInstance().GetFileSystemController().SetPackedUpdate(
110 std::move(update_raw));
109 } 111 }
110 112
111 is_loaded = true; 113 is_loaded = true;
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp
index 5e8553db9..7186ad1ff 100644
--- a/src/core/loader/xci.cpp
+++ b/src/core/loader/xci.cpp
@@ -5,6 +5,7 @@
5#include <vector> 5#include <vector>
6 6
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "core/core.h"
8#include "core/file_sys/card_image.h" 9#include "core/file_sys/card_image.h"
9#include "core/file_sys/content_archive.h" 10#include "core/file_sys/content_archive.h"
10#include "core/file_sys/control_metadata.h" 11#include "core/file_sys/control_metadata.h"
@@ -72,7 +73,8 @@ AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::Process& process) {
72 73
73 FileSys::VirtualFile update_raw; 74 FileSys::VirtualFile update_raw;
74 if (ReadUpdateRaw(update_raw) == ResultStatus::Success && update_raw != nullptr) { 75 if (ReadUpdateRaw(update_raw) == ResultStatus::Success && update_raw != nullptr) {
75 Service::FileSystem::SetPackedUpdate(std::move(update_raw)); 76 Core::System::GetInstance().GetFileSystemController().SetPackedUpdate(
77 std::move(update_raw));
76 } 78 }
77 79
78 is_loaded = true; 80 is_loaded = true;
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 1dcfac258..e84811a64 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -221,7 +221,7 @@ GMainWindow::GMainWindow()
221 std::make_unique<FileSys::ContentProviderUnion>()); 221 std::make_unique<FileSys::ContentProviderUnion>());
222 Core::System::GetInstance().RegisterContentProvider( 222 Core::System::GetInstance().RegisterContentProvider(
223 FileSys::ContentProviderUnionSlot::FrontendManual, provider.get()); 223 FileSys::ContentProviderUnionSlot::FrontendManual, provider.get());
224 Service::FileSystem::CreateFactories(*vfs); 224 Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs);
225 225
226 // Gen keys if necessary 226 // Gen keys if necessary
227 OnReinitializeKeys(ReinitializeKeyBehavior::NoWarning); 227 OnReinitializeKeys(ReinitializeKeyBehavior::NoWarning);
@@ -1507,15 +1507,19 @@ void GMainWindow::OnMenuInstallToNAND() {
1507 failed(); 1507 failed();
1508 return; 1508 return;
1509 } 1509 }
1510 const auto res = 1510 const auto res = Core::System::GetInstance()
1511 Service::FileSystem::GetUserNANDContents()->InstallEntry(*nsp, false, qt_raw_copy); 1511 .GetFileSystemController()
1512 .GetUserNANDContents()
1513 ->InstallEntry(*nsp, false, qt_raw_copy);
1512 if (res == FileSys::InstallResult::Success) { 1514 if (res == FileSys::InstallResult::Success) {
1513 success(); 1515 success();
1514 } else { 1516 } else {
1515 if (res == FileSys::InstallResult::ErrorAlreadyExists) { 1517 if (res == FileSys::InstallResult::ErrorAlreadyExists) {
1516 if (overwrite()) { 1518 if (overwrite()) {
1517 const auto res2 = Service::FileSystem::GetUserNANDContents()->InstallEntry( 1519 const auto res2 = Core::System::GetInstance()
1518 *nsp, true, qt_raw_copy); 1520 .GetFileSystemController()
1521 .GetUserNANDContents()
1522 ->InstallEntry(*nsp, true, qt_raw_copy);
1519 if (res2 == FileSys::InstallResult::Success) { 1523 if (res2 == FileSys::InstallResult::Success) {
1520 success(); 1524 success();
1521 } else { 1525 } else {
@@ -1569,19 +1573,28 @@ void GMainWindow::OnMenuInstallToNAND() {
1569 1573
1570 FileSys::InstallResult res; 1574 FileSys::InstallResult res;
1571 if (index >= static_cast<size_t>(FileSys::TitleType::Application)) { 1575 if (index >= static_cast<size_t>(FileSys::TitleType::Application)) {
1572 res = Service::FileSystem::GetUserNANDContents()->InstallEntry( 1576 res = Core::System::GetInstance()
1573 *nca, static_cast<FileSys::TitleType>(index), false, qt_raw_copy); 1577 .GetFileSystemController()
1578 .GetUserNANDContents()
1579 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), false,
1580 qt_raw_copy);
1574 } else { 1581 } else {
1575 res = Service::FileSystem::GetSystemNANDContents()->InstallEntry( 1582 res = Core::System::GetInstance()
1576 *nca, static_cast<FileSys::TitleType>(index), false, qt_raw_copy); 1583 .GetFileSystemController()
1584 .GetSystemNANDContents()
1585 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), false,
1586 qt_raw_copy);
1577 } 1587 }
1578 1588
1579 if (res == FileSys::InstallResult::Success) { 1589 if (res == FileSys::InstallResult::Success) {
1580 success(); 1590 success();
1581 } else if (res == FileSys::InstallResult::ErrorAlreadyExists) { 1591 } else if (res == FileSys::InstallResult::ErrorAlreadyExists) {
1582 if (overwrite()) { 1592 if (overwrite()) {
1583 const auto res2 = Service::FileSystem::GetUserNANDContents()->InstallEntry( 1593 const auto res2 = Core::System::GetInstance()
1584 *nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy); 1594 .GetFileSystemController()
1595 .GetUserNANDContents()
1596 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index),
1597 true, qt_raw_copy);
1585 if (res2 == FileSys::InstallResult::Success) { 1598 if (res2 == FileSys::InstallResult::Success) {
1586 success(); 1599 success();
1587 } else { 1600 } else {
@@ -1611,7 +1624,7 @@ void GMainWindow::OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget target)
1611 FileUtil::GetUserPath(target == EmulatedDirectoryTarget::SDMC ? FileUtil::UserPath::SDMCDir 1624 FileUtil::GetUserPath(target == EmulatedDirectoryTarget::SDMC ? FileUtil::UserPath::SDMCDir
1612 : FileUtil::UserPath::NANDDir, 1625 : FileUtil::UserPath::NANDDir,
1613 dir_path.toStdString()); 1626 dir_path.toStdString());
1614 Service::FileSystem::CreateFactories(*vfs); 1627 Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs);
1615 game_list->PopulateAsync(UISettings::values.game_dirs); 1628 game_list->PopulateAsync(UISettings::values.game_dirs);
1616 } 1629 }
1617} 1630}
@@ -1996,7 +2009,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
1996 2009
1997 const auto function = [this, &keys, &pdm] { 2010 const auto function = [this, &keys, &pdm] {
1998 keys.PopulateFromPartitionData(pdm); 2011 keys.PopulateFromPartitionData(pdm);
1999 Service::FileSystem::CreateFactories(*vfs); 2012 Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs);
2000 keys.DeriveETicket(pdm); 2013 keys.DeriveETicket(pdm);
2001 }; 2014 };
2002 2015
@@ -2041,7 +2054,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
2041 prog.close(); 2054 prog.close();
2042 } 2055 }
2043 2056
2044 Service::FileSystem::CreateFactories(*vfs); 2057 Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs);
2045 2058
2046 if (behavior == ReinitializeKeyBehavior::Warning) { 2059 if (behavior == ReinitializeKeyBehavior::Warning) {
2047 game_list->PopulateAsync(UISettings::values.game_dirs); 2060 game_list->PopulateAsync(UISettings::values.game_dirs);
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index 129d8ca73..bac05b959 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -184,7 +184,7 @@ int main(int argc, char** argv) {
184 Core::System& system{Core::System::GetInstance()}; 184 Core::System& system{Core::System::GetInstance()};
185 system.SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>()); 185 system.SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>());
186 system.SetFilesystem(std::make_shared<FileSys::RealVfsFilesystem>()); 186 system.SetFilesystem(std::make_shared<FileSys::RealVfsFilesystem>());
187 Service::FileSystem::CreateFactories(*system.GetFilesystem()); 187 system.GetFileSystemController().CreateFactories(*system.GetFilesystem());
188 188
189 SCOPE_EXIT({ system.Shutdown(); }); 189 SCOPE_EXIT({ system.Shutdown(); });
190 190