VERY experimental Nintendo Switch 2 emulator
C++
psm: Stub GetChargerType
Zach Hilman157368b56b85
diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cppindex a8e3813c8a..c2d5fda94d 100644--- a/src/core/hle/service/ptm/psm.cpp+++ b/src/core/hle/service/ptm/psm.cpp@@ -12,13 +12,16 @@namespace Service::PSM {-constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full+constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full+constexpr u32 BATTERY_CURRENTLY_CHARGING = 1; // Plugged into an official dock-PSM::PSM() : ServiceFramework{"psm"} {- // clang-format off+class PSM final : public ServiceFramework<PSM> {+public:+ explicit PSM() : ServiceFramework{"psm"} {+ // clang-format offstatic const FunctionInfo functions[] = {{0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"},- {1, nullptr, "GetChargerType"},+ {1, &PSM::GetChargerType, "GetChargerType"},{2, nullptr, "EnableBatteryCharging"},{3, nullptr, "DisableBatteryCharging"},{4, nullptr, "IsBatteryChargingEnabled"},@@ -36,20 +39,30 @@ PSM::PSM() : ServiceFramework{"psm"} {{16, nullptr, "GetBatteryChargeInfoEvent"},{17, nullptr, "GetBatteryChargeInfoFields"},};- // clang-format on+ // clang-format on- RegisterHandlers(functions);-}+ RegisterHandlers(functions);+ }-PSM::~PSM() = default;+ ~PSM() override = default;-void PSM::GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) {- LOG_WARNING(Service_PSM, "(STUBBED) called");+private:+ void 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);-}+ IPC::ResponseBuilder rb{ctx, 3};+ rb.Push(RESULT_SUCCESS);+ rb.Push<u32>(BATTERY_FULLY_CHARGED);+ }++ void GetChargerType(Kernel::HLERequestContext& ctx) {+ LOG_WARNING(Service_PSM, "(STUBBED) called");++ IPC::ResponseBuilder rb{ctx, 3};+ rb.Push(RESULT_SUCCESS);+ rb.Push<u32>(BATTERY_CURRENTLY_CHARGING);+ }+};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 113878bb72..a286793aee 100644--- a/src/core/hle/service/ptm/psm.h+++ b/src/core/hle/service/ptm/psm.h@@ -3,7 +3,6 @@// Refer to the license.txt file included.#pragma once-#include "core/hle/service/service.h"namespace Service::SM {class ServiceManager;@@ -11,15 +10,6 @@ class ServiceManager;namespace Service::PSM {-class PSM final : public ServiceFramework<PSM> {-public:- explicit PSM();- ~PSM() override;--private:- void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx);-};-void InstallInterfaces(SM::ServiceManager& sm);} // namespace Service::PSM