From 45efe4c0a12368ea6942af3528e24bd79a0fe548 Mon Sep 17 00:00:00 2001 From: emmaus Date: Wed, 17 May 2017 15:16:59 +0000 Subject: [PATCH] stub pedometer state --- src/core/hle/service/ptm/ptm.cpp | 15 +++++++++++++++ src/core/hle/service/ptm/ptm.h | 8 ++++++++ src/core/hle/service/ptm/ptm_u.cpp | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index e373ed47a..51228656f 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp @@ -27,6 +27,8 @@ static bool shell_open; static bool battery_is_charging; +static bool counting_steps; + void GetAdapterState(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); @@ -71,6 +73,18 @@ void GetBatteryChargeState(Service::Interface* self) { LOG_WARNING(Service_PTM, "(STUBBED) called"); } +void GetPedometerState(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + + // TODO: This function is only a stub, + // it returns 0 as the total step count + + cmd_buff[1] = RESULT_SUCCESS.raw; + cmd_buff[2] = counting_steps ? 1 : 0; + + LOG_WARNING(Service_PTM, "(STUBBED) called"); +} + void GetTotalStepCount(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); @@ -121,6 +135,7 @@ void Init() { shell_open = true; battery_is_charging = true; + counting_steps = false; // Open the SharedExtSaveData archive 0xF000000B and create the gamecoin.dat file if it doesn't // exist diff --git a/src/core/hle/service/ptm/ptm.h b/src/core/hle/service/ptm/ptm.h index 683fb445b..47c90b392 100644 --- a/src/core/hle/service/ptm/ptm.h +++ b/src/core/hle/service/ptm/ptm.h @@ -74,6 +74,14 @@ void GetBatteryLevel(Interface* self); */ void GetBatteryChargeState(Interface* self); +/** +* PTM::GetPedometerState service function +* Outputs: +* 1 : Result of function, 0 on success, otherwise error code +* 2 : Output of function, 0 = not counting steps, 1 = counting steps +*/ +void GetPedometerState(Interface* self); + /** * PTM::GetTotalStepCount service function * Outputs: diff --git a/src/core/hle/service/ptm/ptm_u.cpp b/src/core/hle/service/ptm/ptm_u.cpp index e0b65ba89..696a58a36 100644 --- a/src/core/hle/service/ptm/ptm_u.cpp +++ b/src/core/hle/service/ptm/ptm_u.cpp @@ -17,7 +17,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00060000, GetShellState, "GetShellState"}, {0x00070000, GetBatteryLevel, "GetBatteryLevel"}, {0x00080000, GetBatteryChargeState, "GetBatteryChargeState"}, - {0x00090000, nullptr, "GetPedometerState"}, + {0x00090000, GetPedometerState, "GetPedometerState"}, {0x000A0042, nullptr, "GetStepHistoryEntry"}, {0x000B00C2, nullptr, "GetStepHistory"}, {0x000C0000, GetTotalStepCount, "GetTotalStepCount"},