diff options
| author | 2018-10-21 22:03:17 -0400 | |
|---|---|---|
| committer | 2018-10-21 22:03:25 -0400 | |
| commit | 314a9483732a2c9cb8861d4ae8b113ebb5ad9406 (patch) | |
| tree | ff2eb64c04d828c0161749c382e3bfc1f2da5c39 /src | |
| parent | psm: Stub GetBatteryChargePercentage (diff) | |
| download | yuzu-314a9483732a2c9cb8861d4ae8b113ebb5ad9406.tar.gz yuzu-314a9483732a2c9cb8861d4ae8b113ebb5ad9406.tar.xz yuzu-314a9483732a2c9cb8861d4ae8b113ebb5ad9406.zip | |
psm: Stub GetChargerType
Used by LovePotion Lua Homebrew. Stubbed as connected to official Nintendo Switch dock.
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/ptm/psm.cpp | 41 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/psm.h | 10 |
2 files changed, 27 insertions, 24 deletions
diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp index a8e3813c8..c2d5fda94 100644 --- a/src/core/hle/service/ptm/psm.cpp +++ b/src/core/hle/service/ptm/psm.cpp | |||
| @@ -12,13 +12,16 @@ | |||
| 12 | 12 | ||
| 13 | namespace Service::PSM { | 13 | namespace Service::PSM { |
| 14 | 14 | ||
| 15 | constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full | 15 | constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full |
| 16 | constexpr u32 BATTERY_CURRENTLY_CHARGING = 1; // Plugged into an official dock | ||
| 16 | 17 | ||
| 17 | PSM::PSM() : ServiceFramework{"psm"} { | 18 | class PSM final : public ServiceFramework<PSM> { |
| 18 | // clang-format off | 19 | public: |
| 20 | explicit PSM() : ServiceFramework{"psm"} { | ||
| 21 | // clang-format off | ||
| 19 | static const FunctionInfo functions[] = { | 22 | static const FunctionInfo functions[] = { |
| 20 | {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"}, | 23 | {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"}, |
| 21 | {1, nullptr, "GetChargerType"}, | 24 | {1, &PSM::GetChargerType, "GetChargerType"}, |
| 22 | {2, nullptr, "EnableBatteryCharging"}, | 25 | {2, nullptr, "EnableBatteryCharging"}, |
| 23 | {3, nullptr, "DisableBatteryCharging"}, | 26 | {3, nullptr, "DisableBatteryCharging"}, |
| 24 | {4, nullptr, "IsBatteryChargingEnabled"}, | 27 | {4, nullptr, "IsBatteryChargingEnabled"}, |
| @@ -36,20 +39,30 @@ PSM::PSM() : ServiceFramework{"psm"} { | |||
| 36 | {16, nullptr, "GetBatteryChargeInfoEvent"}, | 39 | {16, nullptr, "GetBatteryChargeInfoEvent"}, |
| 37 | {17, nullptr, "GetBatteryChargeInfoFields"}, | 40 | {17, nullptr, "GetBatteryChargeInfoFields"}, |
| 38 | }; | 41 | }; |
| 39 | // clang-format on | 42 | // clang-format on |
| 40 | 43 | ||
| 41 | RegisterHandlers(functions); | 44 | RegisterHandlers(functions); |
| 42 | } | 45 | } |
| 43 | 46 | ||
| 44 | PSM::~PSM() = default; | 47 | ~PSM() override = default; |
| 45 | 48 | ||
| 46 | void PSM::GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) { | 49 | private: |
| 47 | LOG_WARNING(Service_PSM, "(STUBBED) called"); | 50 | void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) { |
| 51 | LOG_WARNING(Service_PSM, "(STUBBED) called"); | ||
| 48 | 52 | ||
| 49 | IPC::ResponseBuilder rb{ctx, 3}; | 53 | IPC::ResponseBuilder rb{ctx, 3}; |
| 50 | rb.Push(RESULT_SUCCESS); | 54 | rb.Push(RESULT_SUCCESS); |
| 51 | rb.Push<u32>(BATTERY_FULLY_CHARGED); | 55 | rb.Push<u32>(BATTERY_FULLY_CHARGED); |
| 52 | } | 56 | } |
| 57 | |||
| 58 | void GetChargerType(Kernel::HLERequestContext& ctx) { | ||
| 59 | LOG_WARNING(Service_PSM, "(STUBBED) called"); | ||
| 60 | |||
| 61 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 62 | rb.Push(RESULT_SUCCESS); | ||
| 63 | rb.Push<u32>(BATTERY_CURRENTLY_CHARGING); | ||
| 64 | } | ||
| 65 | }; | ||
| 53 | 66 | ||
| 54 | void InstallInterfaces(SM::ServiceManager& sm) { | 67 | void InstallInterfaces(SM::ServiceManager& sm) { |
| 55 | std::make_shared<PSM>()->InstallAsService(sm); | 68 | std::make_shared<PSM>()->InstallAsService(sm); |
diff --git a/src/core/hle/service/ptm/psm.h b/src/core/hle/service/ptm/psm.h index 113878bb7..a286793ae 100644 --- a/src/core/hle/service/ptm/psm.h +++ b/src/core/hle/service/ptm/psm.h | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | #include "core/hle/service/service.h" | ||
| 7 | 6 | ||
| 8 | namespace Service::SM { | 7 | namespace Service::SM { |
| 9 | class ServiceManager; | 8 | class ServiceManager; |
| @@ -11,15 +10,6 @@ class ServiceManager; | |||
| 11 | 10 | ||
| 12 | namespace Service::PSM { | 11 | namespace Service::PSM { |
| 13 | 12 | ||
| 14 | class PSM final : public ServiceFramework<PSM> { | ||
| 15 | public: | ||
| 16 | explicit PSM(); | ||
| 17 | ~PSM() override; | ||
| 18 | |||
| 19 | private: | ||
| 20 | void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx); | ||
| 21 | }; | ||
| 22 | |||
| 23 | void InstallInterfaces(SM::ServiceManager& sm); | 13 | void InstallInterfaces(SM::ServiceManager& sm); |
| 24 | 14 | ||
| 25 | } // namespace Service::PSM | 15 | } // namespace Service::PSM |