diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/ptm/ptm.cpp | 15 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ptm.h | 7 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ptm_gets.cpp | 37 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ptm_gets.h | 22 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ptm_play.cpp | 20 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ptm_play.h | 4 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ptm_sets.cpp | 20 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ptm_sets.h | 22 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ptm_sysm.cpp | 27 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ptm_sysm.h | 13 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ptm_u.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/service/ptm/ptm_u.h | 4 |
12 files changed, 174 insertions, 19 deletions
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index cc859c14c..8ff808fd9 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp @@ -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" @@ -81,7 +83,7 @@ void GetTotalStepCount(Service::Interface* self) { LOG_WARNING(Service_PTM, "(STUBBED) called"); } -void IsLegacyPowerOff(Service::Interface* self) { +void GetSoftwareClosedFlag(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); cmd_buff[1] = RESULT_SUCCESS.raw; @@ -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; @@ -137,7 +142,7 @@ void Init() { Service::FS::OpenFileFromArchive(*archive_result, gamecoin_path, open_mode); if (gamecoin_result.Succeeded()) { auto gamecoin = gamecoin_result.MoveFrom(); - gamecoin->backend->Write(0, sizeof(GameCoin), 1, + gamecoin->backend->Write(0, sizeof(GameCoin), true, reinterpret_cast<const u8*>(&default_game_coin)); gamecoin->backend->Close(); } diff --git a/src/core/hle/service/ptm/ptm.h b/src/core/hle/service/ptm/ptm.h index 6e163a6f9..a1a628012 100644 --- a/src/core/hle/service/ptm/ptm.h +++ b/src/core/hle/service/ptm/ptm.h @@ -82,12 +82,13 @@ void GetBatteryChargeState(Interface* self); void GetTotalStepCount(Interface* self); /** - * PTM::IsLegacyPowerOff service function + * PTM::GetSoftwareClosedFlag service function * Outputs: * 1: Result code, 0 on success, otherwise error code - * 2: Whether the system is going through a power off + * 2: Whether or not the "software closed" dialog was requested by the last FIRM + * and should be displayed. */ -void IsLegacyPowerOff(Interface* self); +void GetSoftwareClosedFlag(Interface* self); /** * PTM::CheckNew3DS service function diff --git a/src/core/hle/service/ptm/ptm_gets.cpp b/src/core/hle/service/ptm/ptm_gets.cpp new file mode 100644 index 000000000..b23e508d6 --- /dev/null +++ b/src/core/hle/service/ptm/ptm_gets.cpp @@ -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 diff --git a/src/core/hle/service/ptm/ptm_gets.h b/src/core/hle/service/ptm/ptm_gets.h new file mode 100644 index 000000000..5552c9eff --- /dev/null +++ b/src/core/hle/service/ptm/ptm_gets.h @@ -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 diff --git a/src/core/hle/service/ptm/ptm_play.cpp b/src/core/hle/service/ptm/ptm_play.cpp index 2e0c6e1a3..bcb00e0d4 100644 --- a/src/core/hle/service/ptm/ptm_play.cpp +++ b/src/core/hle/service/ptm/ptm_play.cpp @@ -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); } diff --git a/src/core/hle/service/ptm/ptm_play.h b/src/core/hle/service/ptm/ptm_play.h index 47f229581..663faabee 100644 --- a/src/core/hle/service/ptm/ptm_play.h +++ b/src/core/hle/service/ptm/ptm_play.h @@ -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"; diff --git a/src/core/hle/service/ptm/ptm_sets.cpp b/src/core/hle/service/ptm/ptm_sets.cpp new file mode 100644 index 000000000..a8c6cf227 --- /dev/null +++ b/src/core/hle/service/ptm/ptm_sets.cpp @@ -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 diff --git a/src/core/hle/service/ptm/ptm_sets.h b/src/core/hle/service/ptm/ptm_sets.h new file mode 100644 index 000000000..d33b047e5 --- /dev/null +++ b/src/core/hle/service/ptm/ptm_sets.h @@ -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 diff --git a/src/core/hle/service/ptm/ptm_sysm.cpp b/src/core/hle/service/ptm/ptm_sysm.cpp index 693158dbf..f95dfdbb1 100644 --- a/src/core/hle/service/ptm/ptm_sysm.cpp +++ b/src/core/hle/service/ptm/ptm_sysm.cpp @@ -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"}, @@ -33,8 +50,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x080C0080, nullptr, "SetUserTime"}, {0x080D0000, nullptr, "InvalidateSystemTime"}, {0x080E0140, nullptr, "NotifyPlayEvent"}, - {0x080F0000, IsLegacyPowerOff, "IsLegacyPowerOff"}, - {0x08100000, nullptr, "ClearLegacyPowerOff"}, + {0x080F0000, GetSoftwareClosedFlag, "GetSoftwareClosedFlag"}, + {0x08100000, nullptr, "ClearSoftwareClosedFlag"}, {0x08110000, GetShellState, "GetShellState"}, {0x08120000, nullptr, "IsShutdownByBatteryEmpty"}, {0x08130000, nullptr, "FormatSavedata"}, @@ -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); } diff --git a/src/core/hle/service/ptm/ptm_sysm.h b/src/core/hle/service/ptm/ptm_sysm.h index e37f20546..8afcebbba 100644 --- a/src/core/hle/service/ptm/ptm_sysm.h +++ b/src/core/hle/service/ptm/ptm_sysm.h @@ -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"; diff --git a/src/core/hle/service/ptm/ptm_u.cpp b/src/core/hle/service/ptm/ptm_u.cpp index 65e868393..e0b65ba89 100644 --- a/src/core/hle/service/ptm/ptm_u.cpp +++ b/src/core/hle/service/ptm/ptm_u.cpp @@ -26,7 +26,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x000F0084, nullptr, "GetStepHistoryAll"}, }; -PTM_U_Interface::PTM_U_Interface() { +PTM_U::PTM_U() { Register(FunctionTable); } diff --git a/src/core/hle/service/ptm/ptm_u.h b/src/core/hle/service/ptm/ptm_u.h index bf132f610..7b75d6e49 100644 --- a/src/core/hle/service/ptm/ptm_u.h +++ b/src/core/hle/service/ptm/ptm_u.h @@ -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"; |