diff options
| author | 2020-11-26 15:19:08 -0500 | |
|---|---|---|
| committer | 2020-11-26 20:03:11 -0500 | |
| commit | 1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f (patch) | |
| tree | 3593cd42e0ba676c3919561983f7e9766fcb641c /src/core/hle/service/pctl | |
| parent | Merge pull request #4975 from comex/invalid-syncpoint-id (diff) | |
| download | yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.gz yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.xz yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.zip | |
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.
Diffstat (limited to 'src/core/hle/service/pctl')
| -rw-r--r-- | src/core/hle/service/pctl/module.cpp | 21 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/module.h | 9 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/pctl.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/pctl.h | 6 |
4 files changed, 25 insertions, 15 deletions
diff --git a/src/core/hle/service/pctl/module.cpp b/src/core/hle/service/pctl/module.cpp index caf14ed61..6ab1e4124 100644 --- a/src/core/hle/service/pctl/module.cpp +++ b/src/core/hle/service/pctl/module.cpp | |||
| @@ -11,7 +11,8 @@ namespace Service::PCTL { | |||
| 11 | 11 | ||
| 12 | class IParentalControlService final : public ServiceFramework<IParentalControlService> { | 12 | class IParentalControlService final : public ServiceFramework<IParentalControlService> { |
| 13 | public: | 13 | public: |
| 14 | IParentalControlService() : ServiceFramework("IParentalControlService") { | 14 | explicit IParentalControlService(Core::System& system_) |
| 15 | : ServiceFramework{system_, "IParentalControlService"} { | ||
| 15 | // clang-format off | 16 | // clang-format off |
| 16 | static const FunctionInfo functions[] = { | 17 | static const FunctionInfo functions[] = { |
| 17 | {1, &IParentalControlService::Initialize, "Initialize"}, | 18 | {1, &IParentalControlService::Initialize, "Initialize"}, |
| @@ -137,7 +138,7 @@ void Module::Interface::CreateService(Kernel::HLERequestContext& ctx) { | |||
| 137 | 138 | ||
| 138 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 139 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 139 | rb.Push(RESULT_SUCCESS); | 140 | rb.Push(RESULT_SUCCESS); |
| 140 | rb.PushIpcInterface<IParentalControlService>(); | 141 | rb.PushIpcInterface<IParentalControlService>(system); |
| 141 | } | 142 | } |
| 142 | 143 | ||
| 143 | void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) { | 144 | void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) { |
| @@ -145,20 +146,20 @@ void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext | |||
| 145 | 146 | ||
| 146 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 147 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 147 | rb.Push(RESULT_SUCCESS); | 148 | rb.Push(RESULT_SUCCESS); |
| 148 | rb.PushIpcInterface<IParentalControlService>(); | 149 | rb.PushIpcInterface<IParentalControlService>(system); |
| 149 | } | 150 | } |
| 150 | 151 | ||
| 151 | Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) | 152 | Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_, const char* name) |
| 152 | : ServiceFramework(name), module(std::move(module)) {} | 153 | : ServiceFramework{system_, name}, module{std::move(module_)} {} |
| 153 | 154 | ||
| 154 | Module::Interface::~Interface() = default; | 155 | Module::Interface::~Interface() = default; |
| 155 | 156 | ||
| 156 | void InstallInterfaces(SM::ServiceManager& service_manager) { | 157 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { |
| 157 | auto module = std::make_shared<Module>(); | 158 | auto module = std::make_shared<Module>(); |
| 158 | std::make_shared<PCTL>(module, "pctl")->InstallAsService(service_manager); | 159 | std::make_shared<PCTL>(system, module, "pctl")->InstallAsService(service_manager); |
| 159 | std::make_shared<PCTL>(module, "pctl:a")->InstallAsService(service_manager); | 160 | std::make_shared<PCTL>(system, module, "pctl:a")->InstallAsService(service_manager); |
| 160 | std::make_shared<PCTL>(module, "pctl:r")->InstallAsService(service_manager); | 161 | std::make_shared<PCTL>(system, module, "pctl:r")->InstallAsService(service_manager); |
| 161 | std::make_shared<PCTL>(module, "pctl:s")->InstallAsService(service_manager); | 162 | std::make_shared<PCTL>(system, module, "pctl:s")->InstallAsService(service_manager); |
| 162 | } | 163 | } |
| 163 | 164 | ||
| 164 | } // namespace Service::PCTL | 165 | } // namespace Service::PCTL |
diff --git a/src/core/hle/service/pctl/module.h b/src/core/hle/service/pctl/module.h index 3e449110d..4c7e09a3b 100644 --- a/src/core/hle/service/pctl/module.h +++ b/src/core/hle/service/pctl/module.h | |||
| @@ -6,13 +6,18 @@ | |||
| 6 | 6 | ||
| 7 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 8 | 8 | ||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 9 | namespace Service::PCTL { | 13 | namespace Service::PCTL { |
| 10 | 14 | ||
| 11 | class Module final { | 15 | class Module final { |
| 12 | public: | 16 | public: |
| 13 | class Interface : public ServiceFramework<Interface> { | 17 | class Interface : public ServiceFramework<Interface> { |
| 14 | public: | 18 | public: |
| 15 | explicit Interface(std::shared_ptr<Module> module, const char* name); | 19 | explicit Interface(Core::System& system_, std::shared_ptr<Module> module_, |
| 20 | const char* name); | ||
| 16 | ~Interface() override; | 21 | ~Interface() override; |
| 17 | 22 | ||
| 18 | void CreateService(Kernel::HLERequestContext& ctx); | 23 | void CreateService(Kernel::HLERequestContext& ctx); |
| @@ -24,6 +29,6 @@ public: | |||
| 24 | }; | 29 | }; |
| 25 | 30 | ||
| 26 | /// Registers all PCTL services with the specified service manager. | 31 | /// Registers all PCTL services with the specified service manager. |
| 27 | void InstallInterfaces(SM::ServiceManager& service_manager); | 32 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system); |
| 28 | 33 | ||
| 29 | } // namespace Service::PCTL | 34 | } // namespace Service::PCTL |
diff --git a/src/core/hle/service/pctl/pctl.cpp b/src/core/hle/service/pctl/pctl.cpp index af9d1433a..16dd34f90 100644 --- a/src/core/hle/service/pctl/pctl.cpp +++ b/src/core/hle/service/pctl/pctl.cpp | |||
| @@ -6,8 +6,8 @@ | |||
| 6 | 6 | ||
| 7 | namespace Service::PCTL { | 7 | namespace Service::PCTL { |
| 8 | 8 | ||
| 9 | PCTL::PCTL(std::shared_ptr<Module> module, const char* name) | 9 | PCTL::PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name) |
| 10 | : Module::Interface(std::move(module), name) { | 10 | : Interface{system_, std::move(module_), name} { |
| 11 | static const FunctionInfo functions[] = { | 11 | static const FunctionInfo functions[] = { |
| 12 | {0, &PCTL::CreateService, "CreateService"}, | 12 | {0, &PCTL::CreateService, "CreateService"}, |
| 13 | {1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"}, | 13 | {1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"}, |
diff --git a/src/core/hle/service/pctl/pctl.h b/src/core/hle/service/pctl/pctl.h index c33ea80b6..275d23007 100644 --- a/src/core/hle/service/pctl/pctl.h +++ b/src/core/hle/service/pctl/pctl.h | |||
| @@ -6,11 +6,15 @@ | |||
| 6 | 6 | ||
| 7 | #include "core/hle/service/pctl/module.h" | 7 | #include "core/hle/service/pctl/module.h" |
| 8 | 8 | ||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 9 | namespace Service::PCTL { | 13 | namespace Service::PCTL { |
| 10 | 14 | ||
| 11 | class PCTL final : public Module::Interface { | 15 | class PCTL final : public Module::Interface { |
| 12 | public: | 16 | public: |
| 13 | explicit PCTL(std::shared_ptr<Module> module, const char* name); | 17 | explicit PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name); |
| 14 | ~PCTL() override; | 18 | ~PCTL() override; |
| 15 | }; | 19 | }; |
| 16 | 20 | ||