From 6f8a06bac58790d20dae3c1adb4de3b441f07b30 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 18 Nov 2020 07:53:10 -0500 Subject: patch_manager: Remove usages of the global system instance With this, only 19 usages of the global system instance remain within the core library. We're almost there. --- src/core/hle/service/ns/ns.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/core/hle/service/ns/ns.cpp') diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 58ee1f712..2594e6839 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "common/logging/log.h" +#include "core/core.h" #include "core/file_sys/control_metadata.h" #include "core/file_sys/patch_manager.h" #include "core/file_sys/vfs.h" @@ -29,8 +30,8 @@ IAccountProxyInterface::IAccountProxyInterface() : ServiceFramework{"IAccountPro IAccountProxyInterface::~IAccountProxyInterface() = default; -IApplicationManagerInterface::IApplicationManagerInterface() - : ServiceFramework{"IApplicationManagerInterface"} { +IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_) + : ServiceFramework{"IApplicationManagerInterface"}, system{system_} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "ListApplicationRecord"}, @@ -298,7 +299,8 @@ void IApplicationManagerInterface::GetApplicationControlData(Kernel::HLERequestC const auto size = ctx.GetWriteBufferSize(); - const FileSys::PatchManager pm{title_id}; + const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), + system.GetContentProvider()}; const auto control = pm.GetControlMetadata(); std::vector out; @@ -538,14 +540,14 @@ IFactoryResetInterface::IFactoryResetInterface::IFactoryResetInterface() IFactoryResetInterface::~IFactoryResetInterface() = default; -NS::NS(const char* name) : ServiceFramework{name} { +NS::NS(const char* name, Core::System& system_) : ServiceFramework{name}, system{system_} { // clang-format off static const FunctionInfo functions[] = { {7992, &NS::PushInterface, "GetECommerceInterface"}, {7993, &NS::PushInterface, "GetApplicationVersionInterface"}, {7994, &NS::PushInterface, "GetFactoryResetInterface"}, {7995, &NS::PushInterface, "GetAccountProxyInterface"}, - {7996, &NS::PushInterface, "GetApplicationManagerInterface"}, + {7996, &NS::PushIApplicationManagerInterface, "GetApplicationManagerInterface"}, {7997, &NS::PushInterface, "GetDownloadTaskInterface"}, {7998, &NS::PushInterface, "GetContentManagementInterface"}, {7999, &NS::PushInterface, "GetDocumentInterface"}, @@ -558,7 +560,7 @@ NS::NS(const char* name) : ServiceFramework{name} { NS::~NS() = default; std::shared_ptr NS::GetApplicationManagerInterface() const { - return GetInterface(); + return GetInterface(system); } class NS_DEV final : public ServiceFramework { @@ -678,11 +680,11 @@ public: void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { - std::make_shared("ns:am2")->InstallAsService(service_manager); - std::make_shared("ns:ec")->InstallAsService(service_manager); - std::make_shared("ns:rid")->InstallAsService(service_manager); - std::make_shared("ns:rt")->InstallAsService(service_manager); - std::make_shared("ns:web")->InstallAsService(service_manager); + std::make_shared("ns:am2", system)->InstallAsService(service_manager); + std::make_shared("ns:ec", system)->InstallAsService(service_manager); + std::make_shared("ns:rid", system)->InstallAsService(service_manager); + std::make_shared("ns:rt", system)->InstallAsService(service_manager); + std::make_shared("ns:web", system)->InstallAsService(service_manager); std::make_shared()->InstallAsService(service_manager); std::make_shared()->InstallAsService(service_manager); -- cgit v1.2.3