From 4b91057688d6c388f7cbb71e23024d97233ab472 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Mon, 22 Apr 2019 17:53:58 -0400 Subject: services: Pass FileSystemController as reference to services that need it --- src/core/hle/service/am/am.cpp | 5 +++-- src/core/hle/service/am/applet_ae.cpp | 2 +- src/core/hle/service/am/applet_ae.h | 4 ++++ src/core/hle/service/am/applet_oe.cpp | 2 +- src/core/hle/service/am/applet_oe.h | 4 ++++ src/core/hle/service/ns/ns.cpp | 4 ++-- src/core/hle/service/ns/ns.h | 14 +++++++++++--- src/core/hle/service/ns/pl_u.cpp | 5 +++-- src/core/hle/service/ns/pl_u.h | 14 +++++++++++--- src/core/hle/service/service.cpp | 5 +++-- src/core/hle/service/service.h | 8 ++++---- 11 files changed, 47 insertions(+), 20 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index eae052ce0..7f8514b0d 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -1268,7 +1268,7 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) { "new_journal={:016X}", static_cast(type), user_id[1], user_id[0], new_normal_size, new_journal_size); - fsc.WriteSaveDataSize(type, Core::CurrentProcess()->GetTitleID(), user_id, + fsc.WriteSaveDataSize(type, system.CurrentProcess()->GetTitleID(), user_id, {new_normal_size, new_journal_size}); IPC::ResponseBuilder rb{ctx, 4}; @@ -1288,7 +1288,8 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called with type={:02X}, user_id={:016X}{:016X}", static_cast(type), user_id[1], user_id[0]); - const auto size = fsc.ReadSaveDataSize(type, Core::CurrentProcess()->GetTitleID(), user_id); + const auto size = system.FileSystemController().ReadSaveDataSize( + type, system.CurrentProcess()->GetTitleID(), user_id); IPC::ResponseBuilder rb{ctx, 6}; rb.Push(RESULT_SUCCESS); diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp index e454b77d8..d04476ae0 100644 --- a/src/core/hle/service/am/applet_ae.cpp +++ b/src/core/hle/service/am/applet_ae.cpp @@ -106,7 +106,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(system); + rb.PushIpcInterface(system.FileSystemController()); } std::shared_ptr nvflinger; diff --git a/src/core/hle/service/am/applet_ae.h b/src/core/hle/service/am/applet_ae.h index 9e006cd9d..0e0d10858 100644 --- a/src/core/hle/service/am/applet_ae.h +++ b/src/core/hle/service/am/applet_ae.h @@ -9,6 +9,10 @@ #include "core/hle/service/service.h" namespace Service { +namespace FileSystem { +class FileSystemController; +} + namespace NVFlinger { class NVFlinger; } diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp index a2ffaa440..2ee21620b 100644 --- a/src/core/hle/service/am/applet_oe.cpp +++ b/src/core/hle/service/am/applet_oe.cpp @@ -95,7 +95,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(system); + rb.PushIpcInterface(system.FileSystemController()); } std::shared_ptr nvflinger; diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h index 22c05419d..99a65e7b5 100644 --- a/src/core/hle/service/am/applet_oe.h +++ b/src/core/hle/service/am/applet_oe.h @@ -9,6 +9,10 @@ #include "core/hle/service/service.h" namespace Service { +namespace FileSystem { +class FileSystemController; +} + namespace NVFlinger { class NVFlinger; } diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index ce88a2941..13121c4f1 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -617,7 +617,7 @@ public: } }; -void InstallInterfaces(SM::ServiceManager& service_manager) { +void InstallInterfaces(SM::ServiceManager& service_manager, FileSystem::FileSystemController& fsc) { std::make_shared("ns:am2")->InstallAsService(service_manager); std::make_shared("ns:ec")->InstallAsService(service_manager); std::make_shared("ns:rid")->InstallAsService(service_manager); @@ -628,7 +628,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager) { std::make_shared()->InstallAsService(service_manager); std::make_shared()->InstallAsService(service_manager); - std::make_shared()->InstallAsService(service_manager); + std::make_shared(fsc)->InstallAsService(service_manager); } } // namespace Service::NS diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index 0e8256cb4..d067e7a9a 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h @@ -6,7 +6,13 @@ #include "core/hle/service/service.h" -namespace Service::NS { +namespace Service { + +namespace FileSystem { +class FileSystemController; +} // namespace FileSystem + +namespace NS { class IAccountProxyInterface final : public ServiceFramework { public: @@ -91,6 +97,8 @@ private: }; /// Registers all NS services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager); +void InstallInterfaces(SM::ServiceManager& service_manager, FileSystem::FileSystemController& fsc); + +} // namespace NS -} // namespace Service::NS +} // namespace Service diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp index 2a522136d..9d49f36e8 100644 --- a/src/core/hle/service/ns/pl_u.cpp +++ b/src/core/hle/service/ns/pl_u.cpp @@ -150,7 +150,8 @@ struct PL_U::Impl { std::vector shared_font_regions; }; -PL_U::PL_U() : ServiceFramework("pl:u"), impl{std::make_unique()} { +PL_U::PL_U(FileSystem::FileSystemController& fsc) + : ServiceFramework("pl:u"), impl{std::make_unique()} { static const FunctionInfo functions[] = { {0, &PL_U::RequestLoad, "RequestLoad"}, {1, &PL_U::GetLoadState, "GetLoadState"}, @@ -161,7 +162,7 @@ PL_U::PL_U() : ServiceFramework("pl:u"), impl{std::make_unique()} { }; RegisterHandlers(functions); // Attempt to load shared font data from disk - const auto* nand = FileSystem::GetSystemNANDContents(); + const auto* nand = fsc.GetSystemNANDContents(); std::size_t offset = 0; // Rebuild shared fonts from data ncas if (nand->HasEntry(static_cast(FontArchives::Standard), diff --git a/src/core/hle/service/ns/pl_u.h b/src/core/hle/service/ns/pl_u.h index 253f26a2a..35ca424d2 100644 --- a/src/core/hle/service/ns/pl_u.h +++ b/src/core/hle/service/ns/pl_u.h @@ -7,11 +7,17 @@ #include #include "core/hle/service/service.h" -namespace Service::NS { +namespace Service { + +namespace FileSystem { +class FileSystemController; +} // namespace FileSystem + +namespace NS { class PL_U final : public ServiceFramework { public: - PL_U(); + PL_U(FileSystem::FileSystemController& fsc); ~PL_U() override; private: @@ -26,4 +32,6 @@ private: std::unique_ptr impl; }; -} // namespace Service::NS +} // namespace NS + +} // namespace Service diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 3a0f8c3f6..8bf033c88 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -199,6 +199,7 @@ void Init(std::shared_ptr& sm, Core::System& system) { // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it // here and pass it into the respective InstallInterfaces functions. auto nv_flinger = std::make_shared(system.CoreTiming()); + fsc.CreateFactories(*system.GetFilesystem(), false); SM::ServiceManager::InstallInterfaces(sm); @@ -229,13 +230,13 @@ void Init(std::shared_ptr& sm, Core::System& system) { Migration::InstallInterfaces(*sm); Mii::InstallInterfaces(*sm); MM::InstallInterfaces(*sm); - NCM::InstallInterfaces(*sm); + NCM::InstallInterfaces(*sm, fsc); NFC::InstallInterfaces(*sm); NFP::InstallInterfaces(*sm); NIFM::InstallInterfaces(*sm); NIM::InstallInterfaces(*sm); NPNS::InstallInterfaces(*sm); - NS::InstallInterfaces(*sm); + NS::InstallInterfaces(*sm, fsc); Nvidia::InstallInterfaces(*sm, *nv_flinger, system); PCIe::InstallInterfaces(*sm); PCTL::InstallInterfaces(*sm); diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index c6c4bdae5..aef964861 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -18,10 +18,6 @@ namespace Core { class System; } -namespace FileSys { -class VfsFilesystem; -} - namespace Kernel { class ClientPort; class ServerPort; @@ -31,6 +27,10 @@ class HLERequestContext; namespace Service { +namespace FileSystem { +class FileSystemController; +} // namespace FileSystem + namespace SM { class ServiceManager; } -- cgit v1.2.3