summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/ptm
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-09-18 02:38:01 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-09-18 02:38:01 +0200
commitdc8479928c5aee4c6ad6fe4f59006fb604cee701 (patch)
tree569a7f13128450bbab973236615587ff00bced5f /src/core/hle/service/ptm
parentTravis: Import Dolphin’s clang-format hook. (diff)
downloadyuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.gz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.bz2
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.lz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.xz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.zst
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/ptm/ptm.cpp31
-rw-r--r--src/core/hle/service/ptm/ptm.h21
-rw-r--r--src/core/hle/service/ptm/ptm_play.cpp8
-rw-r--r--src/core/hle/service/ptm/ptm_play.h6
-rw-r--r--src/core/hle/service/ptm/ptm_sysm.cpp62
-rw-r--r--src/core/hle/service/ptm/ptm_u.cpp28
6 files changed, 82 insertions, 74 deletions
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp
index e2c17d93b..80fa09f5f 100644
--- a/src/core/hle/service/ptm/ptm.cpp
+++ b/src/core/hle/service/ptm/ptm.cpp
@@ -2,21 +2,21 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include "core/hle/service/ptm/ptm.h"
#include "common/logging/log.h"
-#include "core/settings.h"
#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_play.h"
#include "core/hle/service/ptm/ptm_sysm.h"
#include "core/hle/service/ptm/ptm_u.h"
#include "core/hle/service/service.h"
+#include "core/settings.h"
namespace Service {
namespace PTM {
/// Values for the default gamecoin.dat file
-static const GameCoin default_game_coin = { 0x4F00, 42, 0, 0, 0, 2014, 12, 29 };
+static const GameCoin default_game_coin = {0x4F00, 42, 0, 0, 0, 2014, 12, 29};
/// Id of the SharedExtData archive used by the PTM process
static const std::vector<u8> ptm_shared_extdata_id = {0, 0, 0, 0, 0x0B, 0, 0, 0xF0, 0, 0, 0, 0};
@@ -51,7 +51,8 @@ void GetBatteryLevel(Service::Interface* self) {
// it returns a valid result without implementing full functionality.
cmd_buff[1] = RESULT_SUCCESS.raw;
- cmd_buff[2] = static_cast<u32>(ChargeLevels::CompletelyFull); // Set to a completely full battery
+ cmd_buff[2] =
+ static_cast<u32>(ChargeLevels::CompletelyFull); // Set to a completely full battery
LOG_WARNING(Service_PTM, "(STUBBED) called");
}
@@ -94,7 +95,8 @@ void CheckNew3DS(Service::Interface* self) {
const bool is_new_3ds = Settings::values.is_new_3ds;
if (is_new_3ds) {
- LOG_CRITICAL(Service_PTM, "The option 'is_new_3ds' is enabled as part of the 'System' settings. Citra does not fully support New 3DS emulation yet!");
+ LOG_CRITICAL(Service_PTM, "The option 'is_new_3ds' is enabled as part of the 'System' "
+ "settings. Citra does not fully support New 3DS emulation yet!");
}
cmd_buff[1] = RESULT_SUCCESS.raw;
@@ -111,15 +113,19 @@ void Init() {
shell_open = true;
battery_is_charging = true;
- // Open the SharedExtSaveData archive 0xF000000B and create the gamecoin.dat file if it doesn't exist
+ // Open the SharedExtSaveData archive 0xF000000B and create the gamecoin.dat file if it doesn't
+ // exist
FileSys::Path archive_path(ptm_shared_extdata_id);
- auto archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path);
+ auto archive_result =
+ Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path);
// If the archive didn't exist, create the files inside
if (archive_result.Code().description == ErrorDescription::FS_NotFormatted) {
// Format the archive to create the directories
- Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, FileSys::ArchiveFormatInfo(), archive_path);
+ Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SharedExtSaveData,
+ FileSys::ArchiveFormatInfo(), archive_path);
// Open it again to get a valid archive now that the folder exists
- archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path);
+ archive_result =
+ Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path);
ASSERT_MSG(archive_result.Succeeded(), "Could not open the PTM SharedExtSaveData archive!");
FileSys::Path gamecoin_path("gamecoin.dat");
@@ -127,17 +133,18 @@ void Init() {
open_mode.write_flag.Assign(1);
open_mode.create_flag.Assign(1);
// Open the file and write the default gamecoin information
- auto gamecoin_result = Service::FS::OpenFileFromArchive(*archive_result, gamecoin_path, open_mode);
+ auto gamecoin_result =
+ 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, reinterpret_cast<const u8*>(&default_game_coin));
+ gamecoin->backend->Write(0, sizeof(GameCoin), 1,
+ reinterpret_cast<const u8*>(&default_game_coin));
gamecoin->backend->Close();
}
}
}
void Shutdown() {
-
}
} // namespace PTM
diff --git a/src/core/hle/service/ptm/ptm.h b/src/core/hle/service/ptm/ptm.h
index 7ef8877c7..6e163a6f9 100644
--- a/src/core/hle/service/ptm/ptm.h
+++ b/src/core/hle/service/ptm/ptm.h
@@ -14,23 +14,24 @@ namespace PTM {
/// Charge levels used by PTM functions
enum class ChargeLevels : u32 {
- CriticalBattery = 1,
- LowBattery = 2,
- HalfFull = 3,
- MostlyFull = 4,
- CompletelyFull = 5,
+ CriticalBattery = 1,
+ LowBattery = 2,
+ HalfFull = 3,
+ MostlyFull = 4,
+ CompletelyFull = 5,
};
/**
* Represents the gamecoin file structure in the SharedExtData archive
- * More information in 3dbrew (http://www.3dbrew.org/wiki/Extdata#Shared_Extdata_0xf000000b_gamecoin.dat)
+ * More information in 3dbrew
+ * (http://www.3dbrew.org/wiki/Extdata#Shared_Extdata_0xf000000b_gamecoin.dat)
*/
struct GameCoin {
- u32 magic; ///< Magic number: 0x4F00
- u16 total_coins; ///< Total Play Coins
+ u32 magic; ///< Magic number: 0x4F00
+ u16 total_coins; ///< Total Play Coins
u16 total_coins_on_date; ///< Total Play Coins obtained on the date stored below.
- u32 step_count; ///< Total step count at the time a new Play Coin was obtained.
- u32 last_step_count; ///< Step count for the day the last Play Coin was obtained
+ u32 step_count; ///< Total step count at the time a new Play Coin was obtained.
+ u32 last_step_count; ///< Step count for the day the last Play Coin was obtained
u16 year;
u8 month;
u8 day;
diff --git a/src/core/hle/service/ptm/ptm_play.cpp b/src/core/hle/service/ptm/ptm_play.cpp
index ca5dd0403..2e0c6e1a3 100644
--- a/src/core/hle/service/ptm/ptm_play.cpp
+++ b/src/core/hle/service/ptm/ptm_play.cpp
@@ -8,10 +8,10 @@ namespace Service {
namespace PTM {
const Interface::FunctionInfo FunctionTable[] = {
- {0x08070082, nullptr, "GetPlayHistory"},
- {0x08080000, nullptr, "GetPlayHistoryStart"},
- {0x08090000, nullptr, "GetPlayHistoryLength"},
- {0x080B0080, nullptr, "CalcPlayHistoryStart"},
+ {0x08070082, nullptr, "GetPlayHistory"},
+ {0x08080000, nullptr, "GetPlayHistoryStart"},
+ {0x08090000, nullptr, "GetPlayHistoryLength"},
+ {0x080B0080, nullptr, "CalcPlayHistoryStart"},
};
PTM_Play_Interface::PTM_Play_Interface() {
diff --git a/src/core/hle/service/ptm/ptm_play.h b/src/core/hle/service/ptm/ptm_play.h
index e5c3e04df..47f229581 100644
--- a/src/core/hle/service/ptm/ptm_play.h
+++ b/src/core/hle/service/ptm/ptm_play.h
@@ -13,9 +13,9 @@ class PTM_Play_Interface : public Service::Interface {
public:
PTM_Play_Interface();
-std::string GetPortName() const override {
- return "ptm:play";
-}
+ std::string GetPortName() const override {
+ return "ptm:play";
+ }
};
} // namespace PTM
diff --git a/src/core/hle/service/ptm/ptm_sysm.cpp b/src/core/hle/service/ptm/ptm_sysm.cpp
index cc4ef1101..693158dbf 100644
--- a/src/core/hle/service/ptm/ptm_sysm.cpp
+++ b/src/core/hle/service/ptm/ptm_sysm.cpp
@@ -9,37 +9,37 @@ namespace Service {
namespace PTM {
const Interface::FunctionInfo FunctionTable[] = {
- {0x040100C0, nullptr, "SetRtcAlarmEx"},
- {0x04020042, nullptr, "ReplySleepQuery"},
- {0x04030042, nullptr, "NotifySleepPreparationComplete"},
- {0x04040102, nullptr, "SetWakeupTrigger"},
- {0x04050000, nullptr, "GetAwakeReason"},
- {0x04060000, nullptr, "RequestSleep"},
- {0x040700C0, nullptr, "ShutdownAsync"},
- {0x04080000, nullptr, "Awake"},
- {0x04090080, nullptr, "RebootAsync"},
- {0x040A0000, CheckNew3DS, "CheckNew3DS"},
- {0x08010640, nullptr, "SetInfoLEDPattern"},
- {0x08020040, nullptr, "SetInfoLEDPatternHeader"},
- {0x08030000, nullptr, "GetInfoLEDStatus"},
- {0x08040040, nullptr, "SetBatteryEmptyLEDPattern"},
- {0x08050000, nullptr, "ClearStepHistory"},
- {0x080600C2, nullptr, "SetStepHistory"},
- {0x08070082, nullptr, "GetPlayHistory"},
- {0x08080000, nullptr, "GetPlayHistoryStart"},
- {0x08090000, nullptr, "GetPlayHistoryLength"},
- {0x080A0000, nullptr, "ClearPlayHistory"},
- {0x080B0080, nullptr, "CalcPlayHistoryStart"},
- {0x080C0080, nullptr, "SetUserTime"},
- {0x080D0000, nullptr, "InvalidateSystemTime"},
- {0x080E0140, nullptr, "NotifyPlayEvent"},
- {0x080F0000, IsLegacyPowerOff, "IsLegacyPowerOff"},
- {0x08100000, nullptr, "ClearLegacyPowerOff"},
- {0x08110000, GetShellState, "GetShellState"},
- {0x08120000, nullptr, "IsShutdownByBatteryEmpty"},
- {0x08130000, nullptr, "FormatSavedata"},
- {0x08140000, nullptr, "GetLegacyJumpProhibitedFlag"},
- {0x08180040, nullptr, "ConfigureNew3DSCPU"},
+ {0x040100C0, nullptr, "SetRtcAlarmEx"},
+ {0x04020042, nullptr, "ReplySleepQuery"},
+ {0x04030042, nullptr, "NotifySleepPreparationComplete"},
+ {0x04040102, nullptr, "SetWakeupTrigger"},
+ {0x04050000, nullptr, "GetAwakeReason"},
+ {0x04060000, nullptr, "RequestSleep"},
+ {0x040700C0, nullptr, "ShutdownAsync"},
+ {0x04080000, nullptr, "Awake"},
+ {0x04090080, nullptr, "RebootAsync"},
+ {0x040A0000, CheckNew3DS, "CheckNew3DS"},
+ {0x08010640, nullptr, "SetInfoLEDPattern"},
+ {0x08020040, nullptr, "SetInfoLEDPatternHeader"},
+ {0x08030000, nullptr, "GetInfoLEDStatus"},
+ {0x08040040, nullptr, "SetBatteryEmptyLEDPattern"},
+ {0x08050000, nullptr, "ClearStepHistory"},
+ {0x080600C2, nullptr, "SetStepHistory"},
+ {0x08070082, nullptr, "GetPlayHistory"},
+ {0x08080000, nullptr, "GetPlayHistoryStart"},
+ {0x08090000, nullptr, "GetPlayHistoryLength"},
+ {0x080A0000, nullptr, "ClearPlayHistory"},
+ {0x080B0080, nullptr, "CalcPlayHistoryStart"},
+ {0x080C0080, nullptr, "SetUserTime"},
+ {0x080D0000, nullptr, "InvalidateSystemTime"},
+ {0x080E0140, nullptr, "NotifyPlayEvent"},
+ {0x080F0000, IsLegacyPowerOff, "IsLegacyPowerOff"},
+ {0x08100000, nullptr, "ClearLegacyPowerOff"},
+ {0x08110000, GetShellState, "GetShellState"},
+ {0x08120000, nullptr, "IsShutdownByBatteryEmpty"},
+ {0x08130000, nullptr, "FormatSavedata"},
+ {0x08140000, nullptr, "GetLegacyJumpProhibitedFlag"},
+ {0x08180040, nullptr, "ConfigureNew3DSCPU"},
};
PTM_Sysm_Interface::PTM_Sysm_Interface() {
diff --git a/src/core/hle/service/ptm/ptm_u.cpp b/src/core/hle/service/ptm/ptm_u.cpp
index 17e764866..65e868393 100644
--- a/src/core/hle/service/ptm/ptm_u.cpp
+++ b/src/core/hle/service/ptm/ptm_u.cpp
@@ -9,21 +9,21 @@ namespace Service {
namespace PTM {
const Interface::FunctionInfo FunctionTable[] = {
- {0x00010002, nullptr, "RegisterAlarmClient"},
- {0x00020080, nullptr, "SetRtcAlarm"},
- {0x00030000, nullptr, "GetRtcAlarm"},
- {0x00040000, nullptr, "CancelRtcAlarm"},
- {0x00050000, GetAdapterState, "GetAdapterState"},
- {0x00060000, GetShellState, "GetShellState"},
- {0x00070000, GetBatteryLevel, "GetBatteryLevel"},
+ {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"},
+ {0x00090000, nullptr, "GetPedometerState"},
+ {0x000A0042, nullptr, "GetStepHistoryEntry"},
+ {0x000B00C2, nullptr, "GetStepHistory"},
+ {0x000C0000, GetTotalStepCount, "GetTotalStepCount"},
+ {0x000D0040, nullptr, "SetPedometerRecordingMode"},
+ {0x000E0000, nullptr, "GetPedometerRecordingMode"},
+ {0x000F0084, nullptr, "GetStepHistoryAll"},
};
PTM_U_Interface::PTM_U_Interface() {