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/mii/mii.cpp | 18 ++++++++++-------- src/core/hle/service/mii/mii.h | 6 +++++- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'src/core/hle/service/mii') diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp index d7080b715..26be9e45b 100644 --- a/src/core/hle/service/mii/mii.cpp +++ b/src/core/hle/service/mii/mii.cpp @@ -18,7 +18,8 @@ constexpr ResultCode ERROR_INVALID_ARGUMENT{ErrorModule::Mii, 1}; class IDatabaseService final : public ServiceFramework { public: - explicit IDatabaseService() : ServiceFramework{"IDatabaseService"} { + explicit IDatabaseService(Core::System& system_) + : ServiceFramework{system_, "IDatabaseService"} { // clang-format off static const FunctionInfo functions[] = { {0, &IDatabaseService::IsUpdated, "IsUpdated"}, @@ -252,7 +253,8 @@ private: class MiiDBModule final : public ServiceFramework { public: - explicit MiiDBModule(const char* name) : ServiceFramework{name} { + explicit MiiDBModule(Core::System& system_, const char* name) + : ServiceFramework{system_, name} { // clang-format off static const FunctionInfo functions[] = { {0, &MiiDBModule::GetDatabaseService, "GetDatabaseService"}, @@ -266,7 +268,7 @@ private: void GetDatabaseService(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); LOG_DEBUG(Service_Mii, "called"); } @@ -274,7 +276,7 @@ private: class MiiImg final : public ServiceFramework { public: - explicit MiiImg() : ServiceFramework{"miiimg"} { + explicit MiiImg(Core::System& system_) : ServiceFramework{system_, "miiimg"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "Initialize"}, @@ -298,11 +300,11 @@ public: } }; -void InstallInterfaces(SM::ServiceManager& sm) { - std::make_shared("mii:e")->InstallAsService(sm); - std::make_shared("mii:u")->InstallAsService(sm); +void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { + std::make_shared(system, "mii:e")->InstallAsService(sm); + std::make_shared(system, "mii:u")->InstallAsService(sm); - std::make_shared()->InstallAsService(sm); + std::make_shared(system)->InstallAsService(sm); } } // namespace Service::Mii diff --git a/src/core/hle/service/mii/mii.h b/src/core/hle/service/mii/mii.h index 7ce9be50e..9d3238e72 100644 --- a/src/core/hle/service/mii/mii.h +++ b/src/core/hle/service/mii/mii.h @@ -4,12 +4,16 @@ #pragma once +namespace Core { +class System; +} + namespace Service::SM { class ServiceManager; } namespace Service::Mii { -void InstallInterfaces(SM::ServiceManager& sm); +void InstallInterfaces(SM::ServiceManager& sm, Core::System& system); } // namespace Service::Mii -- cgit v1.2.3