summaryrefslogtreecommitdiff
path: root/src/core/hle/service/apm
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/apm')
-rw-r--r--src/core/hle/service/apm/apm.cpp9
-rw-r--r--src/core/hle/service/apm/apm.h4
-rw-r--r--src/core/hle/service/apm/interface.cpp15
-rw-r--r--src/core/hle/service/apm/interface.h5
4 files changed, 20 insertions, 13 deletions
diff --git a/src/core/hle/service/apm/apm.cpp b/src/core/hle/service/apm/apm.cpp
index e2d8f0027..97d6619dd 100644
--- a/src/core/hle/service/apm/apm.cpp
+++ b/src/core/hle/service/apm/apm.cpp
@@ -14,13 +14,14 @@ Module::~Module() = default;
14 14
15void InstallInterfaces(Core::System& system) { 15void InstallInterfaces(Core::System& system) {
16 auto module_ = std::make_shared<Module>(); 16 auto module_ = std::make_shared<Module>();
17 std::make_shared<APM>(module_, system.GetAPMController(), "apm") 17 std::make_shared<APM>(system, module_, system.GetAPMController(), "apm")
18 ->InstallAsService(system.ServiceManager()); 18 ->InstallAsService(system.ServiceManager());
19 std::make_shared<APM>(module_, system.GetAPMController(), "apm:p") 19 std::make_shared<APM>(system, module_, system.GetAPMController(), "apm:p")
20 ->InstallAsService(system.ServiceManager()); 20 ->InstallAsService(system.ServiceManager());
21 std::make_shared<APM>(module_, system.GetAPMController(), "apm:am") 21 std::make_shared<APM>(system, module_, system.GetAPMController(), "apm:am")
22 ->InstallAsService(system.ServiceManager());
23 std::make_shared<APM_Sys>(system, system.GetAPMController())
22 ->InstallAsService(system.ServiceManager()); 24 ->InstallAsService(system.ServiceManager());
23 std::make_shared<APM_Sys>(system.GetAPMController())->InstallAsService(system.ServiceManager());
24} 25}
25 26
26} // namespace Service::APM 27} // namespace Service::APM
diff --git a/src/core/hle/service/apm/apm.h b/src/core/hle/service/apm/apm.h
index cf4c2bb11..691fe6c16 100644
--- a/src/core/hle/service/apm/apm.h
+++ b/src/core/hle/service/apm/apm.h
@@ -4,7 +4,9 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "core/hle/service/service.h" 7namespace Core {
8class System;
9}
8 10
9namespace Service::APM { 11namespace Service::APM {
10 12
diff --git a/src/core/hle/service/apm/interface.cpp b/src/core/hle/service/apm/interface.cpp
index 06f0f8edd..89442e21e 100644
--- a/src/core/hle/service/apm/interface.cpp
+++ b/src/core/hle/service/apm/interface.cpp
@@ -12,7 +12,8 @@ namespace Service::APM {
12 12
13class ISession final : public ServiceFramework<ISession> { 13class ISession final : public ServiceFramework<ISession> {
14public: 14public:
15 ISession(Controller& controller) : ServiceFramework("ISession"), controller(controller) { 15 explicit ISession(Core::System& system_, Controller& controller_)
16 : ServiceFramework{system_, "ISession"}, controller{controller_} {
16 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
17 {0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"}, 18 {0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"},
18 {1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"}, 19 {1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"},
@@ -50,8 +51,9 @@ private:
50 Controller& controller; 51 Controller& controller;
51}; 52};
52 53
53APM::APM(std::shared_ptr<Module> apm, Controller& controller, const char* name) 54APM::APM(Core::System& system_, std::shared_ptr<Module> apm_, Controller& controller_,
54 : ServiceFramework(name), apm(std::move(apm)), controller(controller) { 55 const char* name)
56 : ServiceFramework{system_, name}, apm(std::move(apm_)), controller{controller_} {
55 static const FunctionInfo functions[] = { 57 static const FunctionInfo functions[] = {
56 {0, &APM::OpenSession, "OpenSession"}, 58 {0, &APM::OpenSession, "OpenSession"},
57 {1, &APM::GetPerformanceMode, "GetPerformanceMode"}, 59 {1, &APM::GetPerformanceMode, "GetPerformanceMode"},
@@ -67,7 +69,7 @@ void APM::OpenSession(Kernel::HLERequestContext& ctx) {
67 69
68 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 70 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
69 rb.Push(RESULT_SUCCESS); 71 rb.Push(RESULT_SUCCESS);
70 rb.PushIpcInterface<ISession>(controller); 72 rb.PushIpcInterface<ISession>(system, controller);
71} 73}
72 74
73void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) { 75void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
@@ -77,7 +79,8 @@ void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
77 rb.PushEnum(controller.GetCurrentPerformanceMode()); 79 rb.PushEnum(controller.GetCurrentPerformanceMode());
78} 80}
79 81
80APM_Sys::APM_Sys(Controller& controller) : ServiceFramework{"apm:sys"}, controller(controller) { 82APM_Sys::APM_Sys(Core::System& system_, Controller& controller_)
83 : ServiceFramework{system_, "apm:sys"}, controller{controller_} {
81 // clang-format off 84 // clang-format off
82 static const FunctionInfo functions[] = { 85 static const FunctionInfo functions[] = {
83 {0, nullptr, "RequestPerformanceMode"}, 86 {0, nullptr, "RequestPerformanceMode"},
@@ -101,7 +104,7 @@ void APM_Sys::GetPerformanceEvent(Kernel::HLERequestContext& ctx) {
101 104
102 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 105 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
103 rb.Push(RESULT_SUCCESS); 106 rb.Push(RESULT_SUCCESS);
104 rb.PushIpcInterface<ISession>(controller); 107 rb.PushIpcInterface<ISession>(system, controller);
105} 108}
106 109
107void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { 110void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) {
diff --git a/src/core/hle/service/apm/interface.h b/src/core/hle/service/apm/interface.h
index de1b89437..7d57c4978 100644
--- a/src/core/hle/service/apm/interface.h
+++ b/src/core/hle/service/apm/interface.h
@@ -13,7 +13,8 @@ class Module;
13 13
14class APM final : public ServiceFramework<APM> { 14class APM final : public ServiceFramework<APM> {
15public: 15public:
16 explicit APM(std::shared_ptr<Module> apm, Controller& controller, const char* name); 16 explicit APM(Core::System& system_, std::shared_ptr<Module> apm_, Controller& controller_,
17 const char* name);
17 ~APM() override; 18 ~APM() override;
18 19
19private: 20private:
@@ -26,7 +27,7 @@ private:
26 27
27class APM_Sys final : public ServiceFramework<APM_Sys> { 28class APM_Sys final : public ServiceFramework<APM_Sys> {
28public: 29public:
29 explicit APM_Sys(Controller& controller); 30 explicit APM_Sys(Core::System& system_, Controller& controller);
30 ~APM_Sys() override; 31 ~APM_Sys() override;
31 32
32 void SetCpuBoostMode(Kernel::HLERequestContext& ctx); 33 void SetCpuBoostMode(Kernel::HLERequestContext& ctx);