summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/ptm/psm.cpp
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-10-22 04:03:17 +0200
committerZach Hilman <zachhilman@gmail.com>2018-10-22 04:03:25 +0200
commit314a9483732a2c9cb8861d4ae8b113ebb5ad9406 (patch)
treeff2eb64c04d828c0161749c382e3bfc1f2da5c39 /src/core/hle/service/ptm/psm.cpp
parentpsm: Stub GetBatteryChargePercentage (diff)
downloadyuzu-314a9483732a2c9cb8861d4ae8b113ebb5ad9406.tar
yuzu-314a9483732a2c9cb8861d4ae8b113ebb5ad9406.tar.gz
yuzu-314a9483732a2c9cb8861d4ae8b113ebb5ad9406.tar.bz2
yuzu-314a9483732a2c9cb8861d4ae8b113ebb5ad9406.tar.lz
yuzu-314a9483732a2c9cb8861d4ae8b113ebb5ad9406.tar.xz
yuzu-314a9483732a2c9cb8861d4ae8b113ebb5ad9406.tar.zst
yuzu-314a9483732a2c9cb8861d4ae8b113ebb5ad9406.zip
Diffstat (limited to 'src/core/hle/service/ptm/psm.cpp')
-rw-r--r--src/core/hle/service/ptm/psm.cpp41
1 files changed, 27 insertions, 14 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 @@
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 off
static 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);