summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/am/applet_oe.cpp3
-rw-r--r--src/core/hle/service/apm/apm.cpp44
-rw-r--r--src/core/hle/service/apm/apm.h8
3 files changed, 53 insertions, 2 deletions
diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp
index ff0390b58..03d9991b9 100644
--- a/src/core/hle/service/am/applet_oe.cpp
+++ b/src/core/hle/service/am/applet_oe.cpp
@@ -6,6 +6,7 @@
6#include "core/hle/ipc_helpers.h" 6#include "core/hle/ipc_helpers.h"
7#include "core/hle/kernel/event.h" 7#include "core/hle/kernel/event.h"
8#include "core/hle/service/am/applet_oe.h" 8#include "core/hle/service/am/applet_oe.h"
9#include "core/hle/service/apm/apm.h"
9 10
10namespace Service { 11namespace Service {
11namespace AM { 12namespace AM {
@@ -184,7 +185,7 @@ private:
184 void GetOperationMode(Kernel::HLERequestContext& ctx) { 185 void GetOperationMode(Kernel::HLERequestContext& ctx) {
185 IPC::RequestBuilder rb{ctx, 3}; 186 IPC::RequestBuilder rb{ctx, 3};
186 rb.Push(RESULT_SUCCESS); 187 rb.Push(RESULT_SUCCESS);
187 rb.Push(static_cast<u8>(OperationMode::Handheld)); 188 rb.Push(static_cast<u32>(APM::PerformanceMode::Handheld));
188 189
189 LOG_WARNING(Service, "(STUBBED) called"); 190 LOG_WARNING(Service, "(STUBBED) called");
190 } 191 }
diff --git a/src/core/hle/service/apm/apm.cpp b/src/core/hle/service/apm/apm.cpp
index 957abdd66..66d94ff52 100644
--- a/src/core/hle/service/apm/apm.cpp
+++ b/src/core/hle/service/apm/apm.cpp
@@ -13,12 +13,54 @@ void InstallInterfaces(SM::ServiceManager& service_manager) {
13 std::make_shared<APM>()->InstallAsService(service_manager); 13 std::make_shared<APM>()->InstallAsService(service_manager);
14} 14}
15 15
16class ISession final : public ServiceFramework<ISession> {
17public:
18 ISession() : ServiceFramework("ISession") {
19 static const FunctionInfo functions[] = {
20 {0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"},
21 {1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"},
22 };
23 RegisterHandlers(functions);
24 }
25
26private:
27 void SetPerformanceConfiguration(Kernel::HLERequestContext& ctx) {
28 IPC::RequestParser rp{ctx};
29
30 auto mode = static_cast<PerformanceMode>(rp.Pop<u32>());
31 u32 config = rp.Pop<u32>();
32
33 IPC::RequestBuilder rb{ctx, 2};
34 rb.Push(RESULT_SUCCESS);
35
36 LOG_WARNING(Service, "(STUBBED) called mode=%u config=%u", static_cast<u32>(mode), config);
37 }
38
39 void GetPerformanceConfiguration(Kernel::HLERequestContext& ctx) {
40 IPC::RequestParser rp{ctx};
41
42 auto mode = static_cast<PerformanceMode>(rp.Pop<u32>());
43
44 IPC::RequestBuilder rb{ctx, 3};
45 rb.Push(RESULT_SUCCESS);
46 rb.Push<u32>(0); // Performance configuration
47
48 LOG_WARNING(Service, "(STUBBED) called mode=%u", static_cast<u32>(mode));
49 }
50};
51
16APM::APM() : ServiceFramework("apm") { 52APM::APM() : ServiceFramework("apm") {
17 static const FunctionInfo functions[] = { 53 static const FunctionInfo functions[] = {
18 {0x00000000, nullptr, "OpenSession"}, {0x00000001, nullptr, "GetPerformanceMode"}, 54 {0x00000000, &APM::OpenSession, "OpenSession"}, {0x00000001, nullptr, "GetPerformanceMode"},
19 }; 55 };
20 RegisterHandlers(functions); 56 RegisterHandlers(functions);
21} 57}
22 58
59void APM::OpenSession(Kernel::HLERequestContext& ctx) {
60 IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
61 rb.Push(RESULT_SUCCESS);
62 rb.PushIpcInterface<ISession>();
63}
64
23} // namespace APM 65} // namespace APM
24} // namespace Service 66} // namespace Service
diff --git a/src/core/hle/service/apm/apm.h b/src/core/hle/service/apm/apm.h
index 377db71a4..90a1afbbc 100644
--- a/src/core/hle/service/apm/apm.h
+++ b/src/core/hle/service/apm/apm.h
@@ -9,10 +9,18 @@
9namespace Service { 9namespace Service {
10namespace APM { 10namespace APM {
11 11
12enum class PerformanceMode : u8 {
13 Handheld = 0,
14 Docked = 1,
15};
16
12class APM final : public ServiceFramework<APM> { 17class APM final : public ServiceFramework<APM> {
13public: 18public:
14 APM(); 19 APM();
15 ~APM() = default; 20 ~APM() = default;
21
22private:
23 void OpenSession(Kernel::HLERequestContext& ctx);
16}; 24};
17 25
18/// Registers all AM services with the specified service manager. 26/// Registers all AM services with the specified service manager.