summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-10-20 17:23:43 -0400
committerGravatar Zach Hilman2018-10-20 18:01:11 -0400
commit10a2d20e26e8f43dc15be0e13c570ab28bb57242 (patch)
tree99c84b8d54b56d3edde2af7abf4aa9dce2a69fd8 /src
parentservice: Add skeleton for psm service (diff)
downloadyuzu-10a2d20e26e8f43dc15be0e13c570ab28bb57242.tar.gz
yuzu-10a2d20e26e8f43dc15be0e13c570ab28bb57242.tar.xz
yuzu-10a2d20e26e8f43dc15be0e13c570ab28bb57242.zip
psm: Stub GetBatteryChargePercentage
Used by LovePotion Lua Homebrew. Stubbed to return 100% charge.
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/ptm/psm.cpp12
-rw-r--r--src/core/hle/service/ptm/psm.h3
2 files changed, 14 insertions, 1 deletions
diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp
index f6186b809..a8e3813c8 100644
--- a/src/core/hle/service/ptm/psm.cpp
+++ b/src/core/hle/service/ptm/psm.cpp
@@ -12,10 +12,12 @@
12 12
13namespace Service::PSM { 13namespace Service::PSM {
14 14
15constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full
16
15PSM::PSM() : ServiceFramework{"psm"} { 17PSM::PSM() : ServiceFramework{"psm"} {
16 // clang-format off 18 // clang-format off
17 static const FunctionInfo functions[] = { 19 static const FunctionInfo functions[] = {
18 {0, nullptr, "GetBatteryChargePercentage"}, 20 {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"},
19 {1, nullptr, "GetChargerType"}, 21 {1, nullptr, "GetChargerType"},
20 {2, nullptr, "EnableBatteryCharging"}, 22 {2, nullptr, "EnableBatteryCharging"},
21 {3, nullptr, "DisableBatteryCharging"}, 23 {3, nullptr, "DisableBatteryCharging"},
@@ -41,6 +43,14 @@ PSM::PSM() : ServiceFramework{"psm"} {
41 43
42PSM::~PSM() = default; 44PSM::~PSM() = default;
43 45
46void PSM::GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) {
47 LOG_WARNING(Service_PSM, "(STUBBED) called");
48
49 IPC::ResponseBuilder rb{ctx, 3};
50 rb.Push(RESULT_SUCCESS);
51 rb.Push<u32>(BATTERY_FULLY_CHARGED);
52}
53
44void InstallInterfaces(SM::ServiceManager& sm) { 54void InstallInterfaces(SM::ServiceManager& sm) {
45 std::make_shared<PSM>()->InstallAsService(sm); 55 std::make_shared<PSM>()->InstallAsService(sm);
46} 56}
diff --git a/src/core/hle/service/ptm/psm.h b/src/core/hle/service/ptm/psm.h
index 21955aa22..113878bb7 100644
--- a/src/core/hle/service/ptm/psm.h
+++ b/src/core/hle/service/ptm/psm.h
@@ -15,6 +15,9 @@ class PSM final : public ServiceFramework<PSM> {
15public: 15public:
16 explicit PSM(); 16 explicit PSM();
17 ~PSM() override; 17 ~PSM() override;
18
19private:
20 void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx);
18}; 21};
19 22
20void InstallInterfaces(SM::ServiceManager& sm); 23void InstallInterfaces(SM::ServiceManager& sm);