Merge pull request #2287 from lioncash/svc

service: Minor PTM changes
This commit is contained in:
Yuri Kunde Schlesner 2016-12-08 19:34:32 -08:00 committed by GitHub
commit 18bf4acb9b
12 changed files with 170 additions and 12 deletions

View File

@ -123,7 +123,9 @@ set(SRCS
hle/service/nwm_uds.cpp
hle/service/pm_app.cpp
hle/service/ptm/ptm.cpp
hle/service/ptm/ptm_gets.cpp
hle/service/ptm/ptm_play.cpp
hle/service/ptm/ptm_sets.cpp
hle/service/ptm/ptm_sysm.cpp
hle/service/ptm/ptm_u.cpp
hle/service/qtm/qtm.cpp
@ -283,7 +285,9 @@ set(HEADERS
hle/service/nwm_uds.h
hle/service/pm_app.h
hle/service/ptm/ptm.h
hle/service/ptm/ptm_gets.h
hle/service/ptm/ptm_play.h
hle/service/ptm/ptm_sets.h
hle/service/ptm/ptm_sysm.h
hle/service/ptm/ptm_u.h
hle/service/qtm/qtm.h

View File

@ -6,7 +6,9 @@
#include "core/file_sys/file_backend.h"
#include "core/hle/service/fs/archive.h"
#include "core/hle/service/ptm/ptm.h"
#include "core/hle/service/ptm/ptm_gets.h"
#include "core/hle/service/ptm/ptm_play.h"
#include "core/hle/service/ptm/ptm_sets.h"
#include "core/hle/service/ptm/ptm_sysm.h"
#include "core/hle/service/ptm/ptm_u.h"
#include "core/hle/service/service.h"
@ -106,9 +108,12 @@ void CheckNew3DS(Service::Interface* self) {
}
void Init() {
AddService(new PTM_Play_Interface);
AddService(new PTM_Sysm_Interface);
AddService(new PTM_U_Interface);
AddService(new PTM_Gets);
AddService(new PTM_Play);
AddService(new PTM_S);
AddService(new PTM_Sets);
AddService(new PTM_Sysm);
AddService(new PTM_U);
shell_open = true;
battery_is_charging = true;

View File

@ -0,0 +1,37 @@
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/service/ptm/ptm.h"
#include "core/hle/service/ptm/ptm_gets.h"
namespace Service {
namespace PTM {
const Interface::FunctionInfo FunctionTable[] = {
// ptm:u common commands
{0x00010002, nullptr, "RegisterAlarmClient"},
{0x00020080, nullptr, "SetRtcAlarm"},
{0x00030000, nullptr, "GetRtcAlarm"},
{0x00040000, nullptr, "CancelRtcAlarm"},
{0x00050000, GetAdapterState, "GetAdapterState"},
{0x00060000, GetShellState, "GetShellState"},
{0x00070000, GetBatteryLevel, "GetBatteryLevel"},
{0x00080000, GetBatteryChargeState, "GetBatteryChargeState"},
{0x00090000, nullptr, "GetPedometerState"},
{0x000A0042, nullptr, "GetStepHistoryEntry"},
{0x000B00C2, nullptr, "GetStepHistory"},
{0x000C0000, GetTotalStepCount, "GetTotalStepCount"},
{0x000D0040, nullptr, "SetPedometerRecordingMode"},
{0x000E0000, nullptr, "GetPedometerRecordingMode"},
{0x000F0084, nullptr, "GetStepHistoryAll"},
// ptm:gets
{0x04010000, nullptr, "GetSystemTime"},
};
PTM_Gets::PTM_Gets() {
Register(FunctionTable);
}
} // namespace PTM
} // namespace Service

View File

@ -0,0 +1,22 @@
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "core/hle/service/service.h"
namespace Service {
namespace PTM {
class PTM_Gets final : public Interface {
public:
PTM_Gets();
std::string GetPortName() const override {
return "ptm:gets";
}
};
} // namespace PTM
} // namespace Service

View File

@ -2,19 +2,37 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/service/ptm/ptm.h"
#include "core/hle/service/ptm/ptm_play.h"
namespace Service {
namespace PTM {
const Interface::FunctionInfo FunctionTable[] = {
// ptm:u common commands
{0x00010002, nullptr, "RegisterAlarmClient"},
{0x00020080, nullptr, "SetRtcAlarm"},
{0x00030000, nullptr, "GetRtcAlarm"},
{0x00040000, nullptr, "CancelRtcAlarm"},
{0x00050000, GetAdapterState, "GetAdapterState"},
{0x00060000, GetShellState, "GetShellState"},
{0x00070000, GetBatteryLevel, "GetBatteryLevel"},
{0x00080000, GetBatteryChargeState, "GetBatteryChargeState"},
{0x00090000, nullptr, "GetPedometerState"},
{0x000A0042, nullptr, "GetStepHistoryEntry"},
{0x000B00C2, nullptr, "GetStepHistory"},
{0x000C0000, GetTotalStepCount, "GetTotalStepCount"},
{0x000D0040, nullptr, "SetPedometerRecordingMode"},
{0x000E0000, nullptr, "GetPedometerRecordingMode"},
{0x000F0084, nullptr, "GetStepHistoryAll"},
// ptm:play
{0x08070082, nullptr, "GetPlayHistory"},
{0x08080000, nullptr, "GetPlayHistoryStart"},
{0x08090000, nullptr, "GetPlayHistoryLength"},
{0x080B0080, nullptr, "CalcPlayHistoryStart"},
};
PTM_Play_Interface::PTM_Play_Interface() {
PTM_Play::PTM_Play() {
Register(FunctionTable);
}

View File

@ -9,9 +9,9 @@
namespace Service {
namespace PTM {
class PTM_Play_Interface : public Service::Interface {
class PTM_Play final : public Interface {
public:
PTM_Play_Interface();
PTM_Play();
std::string GetPortName() const override {
return "ptm:play";

View File

@ -0,0 +1,20 @@
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/service/ptm/ptm_sets.h"
namespace Service {
namespace PTM {
const Interface::FunctionInfo FunctionTable[] = {
// Note that this service does not have access to ptm:u's common commands
{0x00010080, nullptr, "SetSystemTime"},
};
PTM_Sets::PTM_Sets() {
Register(FunctionTable);
}
} // namespace PTM
} // namespace Service

View File

@ -0,0 +1,22 @@
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "core/hle/service/service.h"
namespace Service {
namespace PTM {
class PTM_Sets final : public Interface {
public:
PTM_Sets();
std::string GetPortName() const override {
return "ptm:sets";
}
};
} // namespace PTM
} // namespace Service

View File

@ -9,6 +9,23 @@ namespace Service {
namespace PTM {
const Interface::FunctionInfo FunctionTable[] = {
// ptm:u common commands
{0x00010002, nullptr, "RegisterAlarmClient"},
{0x00020080, nullptr, "SetRtcAlarm"},
{0x00030000, nullptr, "GetRtcAlarm"},
{0x00040000, nullptr, "CancelRtcAlarm"},
{0x00050000, GetAdapterState, "GetAdapterState"},
{0x00060000, GetShellState, "GetShellState"},
{0x00070000, GetBatteryLevel, "GetBatteryLevel"},
{0x00080000, GetBatteryChargeState, "GetBatteryChargeState"},
{0x00090000, nullptr, "GetPedometerState"},
{0x000A0042, nullptr, "GetStepHistoryEntry"},
{0x000B00C2, nullptr, "GetStepHistory"},
{0x000C0000, GetTotalStepCount, "GetTotalStepCount"},
{0x000D0040, nullptr, "SetPedometerRecordingMode"},
{0x000E0000, nullptr, "GetPedometerRecordingMode"},
{0x000F0084, nullptr, "GetStepHistoryAll"},
// ptm:sysm
{0x040100C0, nullptr, "SetRtcAlarmEx"},
{0x04020042, nullptr, "ReplySleepQuery"},
{0x04030042, nullptr, "NotifySleepPreparationComplete"},
@ -42,7 +59,11 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x08180040, nullptr, "ConfigureNew3DSCPU"},
};
PTM_Sysm_Interface::PTM_Sysm_Interface() {
PTM_S::PTM_S() {
Register(FunctionTable);
}
PTM_Sysm::PTM_Sysm() {
Register(FunctionTable);
}

View File

@ -9,9 +9,18 @@
namespace Service {
namespace PTM {
class PTM_Sysm_Interface : public Interface {
class PTM_S final : public Interface {
public:
PTM_Sysm_Interface();
PTM_S();
std::string GetPortName() const override {
return "ptm:s";
}
};
class PTM_Sysm final : public Interface {
public:
PTM_Sysm();
std::string GetPortName() const override {
return "ptm:sysm";

View File

@ -26,7 +26,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x000F0084, nullptr, "GetStepHistoryAll"},
};
PTM_U_Interface::PTM_U_Interface() {
PTM_U::PTM_U() {
Register(FunctionTable);
}

View File

@ -9,9 +9,9 @@
namespace Service {
namespace PTM {
class PTM_U_Interface : public Interface {
class PTM_U final : public Interface {
public:
PTM_U_Interface();
PTM_U();
std::string GetPortName() const override {
return "ptm:u";