VERY experimental Nintendo Switch 2 emulator
C++
psm: Stub GetBatteryChargePercentage Used by LovePotion Lua Homebrew. Stubbed to return 100% charge.
Zach Hilman1180af162713
diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cppindex f6186b8098..a8e3813c8a 100644--- a/src/core/hle/service/ptm/psm.cpp+++ b/src/core/hle/service/ptm/psm.cpp@@ -12,10 +12,12 @@namespace Service::PSM {+constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full+PSM::PSM() : ServiceFramework{"psm"} {// clang-format offstatic const FunctionInfo functions[] = {- {0, nullptr, "GetBatteryChargePercentage"},+ {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"},{1, nullptr, "GetChargerType"},{2, nullptr, "EnableBatteryCharging"},{3, nullptr, "DisableBatteryCharging"},@@ -41,6 +43,14 @@ PSM::PSM() : ServiceFramework{"psm"} {PSM::~PSM() = default;+void PSM::GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) {+ LOG_WARNING(Service_PSM, "(STUBBED) called");++ IPC::ResponseBuilder rb{ctx, 3};+ rb.Push(RESULT_SUCCESS);+ rb.Push<u32>(BATTERY_FULLY_CHARGED);+}+void InstallInterfaces(SM::ServiceManager& sm) {std::make_shared<PSM>()->InstallAsService(sm);}diff --git a/src/core/hle/service/ptm/psm.h b/src/core/hle/service/ptm/psm.hindex 21955aa229..113878bb72 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> {public:explicit PSM();~PSM() override;++private:+ void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx);};void InstallInterfaces(SM::ServiceManager& sm);