Merge pull request #2969 from mailwl/ptm_step
Service/PTM: Stub GetStepHistory function
This commit is contained in:
commit
5eabe60aa3
@ -30,7 +30,7 @@ static bool battery_is_charging;
|
||||
|
||||
static bool pedometer_is_counting;
|
||||
|
||||
void GetAdapterState(Service::Interface* self) {
|
||||
void GetAdapterState(Interface* self) {
|
||||
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x5, 0, 0);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
@ -40,7 +40,7 @@ void GetAdapterState(Service::Interface* self) {
|
||||
LOG_WARNING(Service_PTM, "(STUBBED) called");
|
||||
}
|
||||
|
||||
void GetShellState(Service::Interface* self) {
|
||||
void GetShellState(Interface* self) {
|
||||
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x6, 0, 0);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
@ -48,7 +48,7 @@ void GetShellState(Service::Interface* self) {
|
||||
rb.Push(shell_open);
|
||||
}
|
||||
|
||||
void GetBatteryLevel(Service::Interface* self) {
|
||||
void GetBatteryLevel(Interface* self) {
|
||||
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x7, 0, 0);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
@ -58,7 +58,7 @@ void GetBatteryLevel(Service::Interface* self) {
|
||||
LOG_WARNING(Service_PTM, "(STUBBED) called");
|
||||
}
|
||||
|
||||
void GetBatteryChargeState(Service::Interface* self) {
|
||||
void GetBatteryChargeState(Interface* self) {
|
||||
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x8, 0, 0);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
@ -68,7 +68,7 @@ void GetBatteryChargeState(Service::Interface* self) {
|
||||
LOG_WARNING(Service_PTM, "(STUBBED) called");
|
||||
}
|
||||
|
||||
void GetPedometerState(Service::Interface* self) {
|
||||
void GetPedometerState(Interface* self) {
|
||||
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x9, 0, 0);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
@ -78,7 +78,29 @@ void GetPedometerState(Service::Interface* self) {
|
||||
LOG_WARNING(Service_PTM, "(STUBBED) called");
|
||||
}
|
||||
|
||||
void GetTotalStepCount(Service::Interface* self) {
|
||||
void GetStepHistory(Interface* self) {
|
||||
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0xB, 3, 2);
|
||||
|
||||
u32 hours = rp.Pop<u32>();
|
||||
u64 start_time = rp.Pop<u64>();
|
||||
size_t steps_buff_size;
|
||||
const VAddr steps_buff_addr = rp.PopMappedBuffer(&steps_buff_size);
|
||||
ASSERT_MSG(sizeof(u16) * hours == steps_buff_size, "Buffer for steps count has incorrect size");
|
||||
|
||||
// Stub: set zero steps count for every hour
|
||||
for (u32 i = 0; i < hours; ++i) {
|
||||
const u16 steps_per_hour = 0;
|
||||
Memory::Write16(steps_buff_addr + i * sizeof(u16), steps_per_hour);
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
|
||||
LOG_WARNING(Service_PTM, "(STUBBED) called, from time(raw): 0x%llx, for %d hours", start_time,
|
||||
hours);
|
||||
}
|
||||
|
||||
void GetTotalStepCount(Interface* self) {
|
||||
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0xC, 0, 0);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
@ -88,7 +110,7 @@ void GetTotalStepCount(Service::Interface* self) {
|
||||
LOG_WARNING(Service_PTM, "(STUBBED) called");
|
||||
}
|
||||
|
||||
void GetSoftwareClosedFlag(Service::Interface* self) {
|
||||
void GetSoftwareClosedFlag(Interface* self) {
|
||||
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x80F, 0, 0);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
@ -112,7 +134,7 @@ void CheckNew3DS(IPC::RequestBuilder& rb) {
|
||||
LOG_WARNING(Service_PTM, "(STUBBED) called isNew3DS = 0x%08x", static_cast<u32>(is_new_3ds));
|
||||
}
|
||||
|
||||
void CheckNew3DS(Service::Interface* self) {
|
||||
void CheckNew3DS(Interface* self) {
|
||||
IPC::RequestBuilder rb(Kernel::GetCommandBuffer(), 0x40A, 0, 0); // 0x040A0000
|
||||
CheckNew3DS(rb);
|
||||
}
|
||||
|
@ -82,6 +82,18 @@ void GetBatteryChargeState(Interface* self);
|
||||
*/
|
||||
void GetPedometerState(Interface* self);
|
||||
|
||||
/**
|
||||
* PTM::GetStepHistory service function
|
||||
* Inputs:
|
||||
* 1 : Number of hours
|
||||
* 2-3 : Start time
|
||||
* 4 : Buffer mapping descriptor
|
||||
* 5 : (short*) Buffer for step counts
|
||||
* Outputs:
|
||||
* 1 : Result of function, 0 on success, otherwise error code
|
||||
*/
|
||||
void GetStepHistory(Interface* self);
|
||||
|
||||
/**
|
||||
* PTM::GetTotalStepCount service function
|
||||
* Outputs:
|
||||
|
@ -20,7 +20,7 @@ const Interface::FunctionInfo FunctionTable[] = {
|
||||
{0x00080000, GetBatteryChargeState, "GetBatteryChargeState"},
|
||||
{0x00090000, nullptr, "GetPedometerState"},
|
||||
{0x000A0042, nullptr, "GetStepHistoryEntry"},
|
||||
{0x000B00C2, nullptr, "GetStepHistory"},
|
||||
{0x000B00C2, GetStepHistory, "GetStepHistory"},
|
||||
{0x000C0000, GetTotalStepCount, "GetTotalStepCount"},
|
||||
{0x000D0040, nullptr, "SetPedometerRecordingMode"},
|
||||
{0x000E0000, nullptr, "GetPedometerRecordingMode"},
|
||||
|
@ -20,7 +20,7 @@ const Interface::FunctionInfo FunctionTable[] = {
|
||||
{0x00080000, GetBatteryChargeState, "GetBatteryChargeState"},
|
||||
{0x00090000, nullptr, "GetPedometerState"},
|
||||
{0x000A0042, nullptr, "GetStepHistoryEntry"},
|
||||
{0x000B00C2, nullptr, "GetStepHistory"},
|
||||
{0x000B00C2, GetStepHistory, "GetStepHistory"},
|
||||
{0x000C0000, GetTotalStepCount, "GetTotalStepCount"},
|
||||
{0x000D0040, nullptr, "SetPedometerRecordingMode"},
|
||||
{0x000E0000, nullptr, "GetPedometerRecordingMode"},
|
||||
|
@ -20,7 +20,7 @@ const Interface::FunctionInfo FunctionTable[] = {
|
||||
{0x00080000, GetBatteryChargeState, "GetBatteryChargeState"},
|
||||
{0x00090000, nullptr, "GetPedometerState"},
|
||||
{0x000A0042, nullptr, "GetStepHistoryEntry"},
|
||||
{0x000B00C2, nullptr, "GetStepHistory"},
|
||||
{0x000B00C2, GetStepHistory, "GetStepHistory"},
|
||||
{0x000C0000, GetTotalStepCount, "GetTotalStepCount"},
|
||||
{0x000D0040, nullptr, "SetPedometerRecordingMode"},
|
||||
{0x000E0000, nullptr, "GetPedometerRecordingMode"},
|
||||
|
@ -19,7 +19,7 @@ const Interface::FunctionInfo FunctionTable[] = {
|
||||
{0x00080000, GetBatteryChargeState, "GetBatteryChargeState"},
|
||||
{0x00090000, GetPedometerState, "GetPedometerState"},
|
||||
{0x000A0042, nullptr, "GetStepHistoryEntry"},
|
||||
{0x000B00C2, nullptr, "GetStepHistory"},
|
||||
{0x000B00C2, GetStepHistory, "GetStepHistory"},
|
||||
{0x000C0000, GetTotalStepCount, "GetTotalStepCount"},
|
||||
{0x000D0040, nullptr, "SetPedometerRecordingMode"},
|
||||
{0x000E0000, nullptr, "GetPedometerRecordingMode"},
|
||||
|
Loading…
Reference in New Issue
Block a user