diff options
| author | 2018-01-15 17:19:32 -0500 | |
|---|---|---|
| committer | 2018-01-16 19:00:32 -0500 | |
| commit | c5a0408ccca4af6dc27e627a077d5480a3784e84 (patch) | |
| tree | 2fc577a9889dcf605e21ef66768bd177fe1a5674 | |
| parent | AppletOE: Stub a bunch of functions required by libnx homebrew. (diff) | |
| download | yuzu-c5a0408ccca4af6dc27e627a077d5480a3784e84.tar.gz yuzu-c5a0408ccca4af6dc27e627a077d5480a3784e84.tar.xz yuzu-c5a0408ccca4af6dc27e627a077d5480a3784e84.zip | |
Services: Stubbed APM::OpenSession and the ISession interface.
# Conflicts:
# src/core/hle/service/am/applet_oe.cpp
# src/core/hle/service/apm/apm.cpp
| -rw-r--r-- | src/core/hle/service/am/applet_oe.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/apm/apm.cpp | 44 | ||||
| -rw-r--r-- | src/core/hle/service/apm/apm.h | 8 |
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 | ||
| 10 | namespace Service { | 11 | namespace Service { |
| 11 | namespace AM { | 12 | namespace 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 | ||
| 16 | class ISession final : public ServiceFramework<ISession> { | ||
| 17 | public: | ||
| 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 | |||
| 26 | private: | ||
| 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 | |||
| 16 | APM::APM() : ServiceFramework("apm") { | 52 | APM::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 | ||
| 59 | void 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 @@ | |||
| 9 | namespace Service { | 9 | namespace Service { |
| 10 | namespace APM { | 10 | namespace APM { |
| 11 | 11 | ||
| 12 | enum class PerformanceMode : u8 { | ||
| 13 | Handheld = 0, | ||
| 14 | Docked = 1, | ||
| 15 | }; | ||
| 16 | |||
| 12 | class APM final : public ServiceFramework<APM> { | 17 | class APM final : public ServiceFramework<APM> { |
| 13 | public: | 18 | public: |
| 14 | APM(); | 19 | APM(); |
| 15 | ~APM() = default; | 20 | ~APM() = default; |
| 21 | |||
| 22 | private: | ||
| 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. |