From 1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 26 Nov 2020 15:19:08 -0500 Subject: service: Eliminate usages of the global system instance Completely removes all usages of the global system instance within the services code by passing in the using system instance to the services. --- src/core/hle/service/mm/mm_u.cpp | 7 ++++--- src/core/hle/service/mm/mm_u.h | 10 ++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/core/hle/service/mm') diff --git a/src/core/hle/service/mm/mm_u.cpp b/src/core/hle/service/mm/mm_u.cpp index 25c24e537..b0cb07d24 100644 --- a/src/core/hle/service/mm/mm_u.cpp +++ b/src/core/hle/service/mm/mm_u.cpp @@ -6,12 +6,13 @@ #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/client_session.h" #include "core/hle/service/mm/mm_u.h" +#include "core/hle/service/sm/sm.h" namespace Service::MM { class MM_U final : public ServiceFramework { public: - explicit MM_U() : ServiceFramework{"mm:u"} { + explicit MM_U(Core::System& system_) : ServiceFramework{system_, "mm:u"} { // clang-format off static const FunctionInfo functions[] = { {0, &MM_U::InitializeOld, "InitializeOld"}, @@ -104,8 +105,8 @@ private: u32 id{1}; }; -void InstallInterfaces(SM::ServiceManager& service_manager) { - std::make_shared()->InstallAsService(service_manager); +void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { + std::make_shared(system)->InstallAsService(service_manager); } } // namespace Service::MM diff --git a/src/core/hle/service/mm/mm_u.h b/src/core/hle/service/mm/mm_u.h index 5439fa653..49b6a3355 100644 --- a/src/core/hle/service/mm/mm_u.h +++ b/src/core/hle/service/mm/mm_u.h @@ -4,11 +4,17 @@ #pragma once -#include "core/hle/service/service.h" +namespace Core { +class System; +} + +namespace Service::SM { +class ServiceManager; +} namespace Service::MM { /// Registers all MM services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager); +void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system); } // namespace Service::MM -- cgit v1.2.3