summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/ptm/ptm.cpp50
-rw-r--r--src/core/hle/service/ptm/ptm.h42
-rw-r--r--src/core/hle/service/ptm/ptm_play.cpp8
-rw-r--r--src/core/hle/service/ptm/ptm_sysm.cpp75
-rw-r--r--src/core/hle/service/ptm/ptm_u.cpp62
5 files changed, 112 insertions, 125 deletions
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp
index 6480a323d..2c7d49c9f 100644
--- a/src/core/hle/service/ptm/ptm.cpp
+++ b/src/core/hle/service/ptm/ptm.cpp
@@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include "common/logging/log.h"
+
#include "core/file_sys/file_backend.h"
#include "core/hle/service/fs/archive.h"
#include "core/hle/service/ptm/ptm.h"
@@ -23,20 +25,56 @@ static bool shell_open;
static bool battery_is_charging;
-u32 GetAdapterState() {
+void GetAdapterState(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
// TODO(purpasmart96): This function is only a stub,
// it returns a valid result without implementing full functionality.
- return battery_is_charging ? 1 : 0;
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ cmd_buff[2] = battery_is_charging ? 1 : 0;
+
+ LOG_WARNING(Service_PTM, "(STUBBED) called");
}
-u32 GetShellState() {
- return shell_open ? 1 : 0;
+void GetShellState(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ cmd_buff[2] = shell_open ? 1 : 0;
}
-ChargeLevels GetBatteryLevel() {
+void GetBatteryLevel(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
// TODO(purpasmart96): This function is only a stub,
// it returns a valid result without implementing full functionality.
- return ChargeLevels::CompletelyFull; // Set to a completely full battery
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ cmd_buff[2] = static_cast<u32>(ChargeLevels::CompletelyFull); // Set to a completely full battery
+
+ LOG_WARNING(Service_PTM, "(STUBBED) called");
+}
+
+void GetBatteryChargeState(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ // TODO(purpasmart96): This function is only a stub,
+ // it returns a valid result without implementing full functionality.
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ cmd_buff[2] = battery_is_charging ? 1 : 0;
+
+ LOG_WARNING(Service_PTM, "(STUBBED) called");
+}
+
+void IsLegacyPowerOff(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ cmd_buff[2] = 0;
+
+ LOG_WARNING(Service_PTM, "(STUBBED) called");
}
void Init() {
diff --git a/src/core/hle/service/ptm/ptm.h b/src/core/hle/service/ptm/ptm.h
index 3c776aa8a..493e6a11f 100644
--- a/src/core/hle/service/ptm/ptm.h
+++ b/src/core/hle/service/ptm/ptm.h
@@ -5,6 +5,7 @@
#pragma once
#include <array>
+#include "core/hle/service/service.h"
#include "core/hle/result.h"
namespace Service {
@@ -35,25 +36,48 @@ struct GameCoin {
};
/**
- * Returns whether the battery is charging or not.
* It is unknown if GetAdapterState is the same as GetBatteryChargeState,
* it is likely to just be a duplicate function of GetBatteryChargeState
* that controls another part of the HW.
- * @returns 1 if the battery is charging, and 0 otherwise.
+ * PTM::GetAdapterState service function
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ * 2 : Output of function, 0 = not charging, 1 = charging.
*/
-u32 GetAdapterState();
+void GetAdapterState(Interface* self);
/**
- * Returns whether the 3DS's physical shell casing is open or closed
- * @returns 1 if the shell is open, and 0 if otherwise
+ * PTM::GetShellState service function.
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ * 2 : Whether the 3DS's physical shell casing is open (1) or closed (0)
*/
-u32 GetShellState();
+void GetShellState(Interface* self);
/**
- * Get the current battery's charge level.
- * @returns The battery's charge level.
+ * PTM::GetBatteryLevel service function
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ * 2 : Battery level, 5 = completely full battery, 4 = mostly full battery,
+ * 3 = half full battery, 2 = low battery, 1 = critical battery.
*/
-ChargeLevels GetBatteryLevel();
+void GetBatteryLevel(Interface* self);
+
+/**
+ * PTM::GetBatteryChargeState service function
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ * 2 : Output of function, 0 = not charging, 1 = charging.
+ */
+void GetBatteryChargeState(Interface* self);
+
+/**
+ * PTM::IsLegacyPowerOff service function
+ * Outputs:
+ * 1: Result code, 0 on success, otherwise error code
+ * 2: Whether the system is going through a power off
+ */
+void IsLegacyPowerOff(Interface* self);
/// Initialize the PTM service
void Init();
diff --git a/src/core/hle/service/ptm/ptm_play.cpp b/src/core/hle/service/ptm/ptm_play.cpp
index 8e8ae8558..48e68a3d8 100644
--- a/src/core/hle/service/ptm/ptm_play.cpp
+++ b/src/core/hle/service/ptm/ptm_play.cpp
@@ -9,10 +9,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_sysm.cpp b/src/core/hle/service/ptm/ptm_sysm.cpp
index 13322bdbb..655658f3b 100644
--- a/src/core/hle/service/ptm/ptm_sysm.cpp
+++ b/src/core/hle/service/ptm/ptm_sysm.cpp
@@ -2,57 +2,44 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "common/make_unique.h"
-#include "core/file_sys/archive_extsavedata.h"
#include "core/hle/hle.h"
+#include "core/hle/service/ptm/ptm.h"
#include "core/hle/service/ptm/ptm_sysm.h"
namespace Service {
namespace PTM {
-/**
- * Returns whether the system is powering off (?)
- * Outputs:
- * 1: Result code, 0 on success, otherwise error code
- * 2: Whether the system is going through a power off
- */
-static void IsLegacyPowerOff(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
- cmd_buff[1] = RESULT_SUCCESS.raw;
- cmd_buff[2] = 0;
-}
-
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, nullptr, "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, nullptr, "GetShellStatus"},
- {0x08120000, nullptr, "IsShutdownByBatteryEmpty"},
- {0x08130000, nullptr, "FormatSavedata"},
- {0x08140000, nullptr, "GetLegacyJumpProhibitedFlag"}
+ {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, nullptr, "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, nullptr, "GetShellStatus"},
+ {0x08120000, nullptr, "IsShutdownByBatteryEmpty"},
+ {0x08130000, nullptr, "FormatSavedata"},
+ {0x08140000, nullptr, "GetLegacyJumpProhibitedFlag"}
};
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 9d6a5b0d7..3f5e9c7c1 100644
--- a/src/core/hle/service/ptm/ptm_u.cpp
+++ b/src/core/hle/service/ptm/ptm_u.cpp
@@ -11,68 +11,6 @@
namespace Service {
namespace PTM {
-/**
- * PTM_U::GetAdapterState service function
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- * 2 : Output of function, 0 = not charging, 1 = charging.
- */
-static void GetAdapterState(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
-
- cmd_buff[1] = RESULT_SUCCESS.raw;
- cmd_buff[2] = GetAdapterState();
-
- LOG_WARNING(Service_PTM, "(STUBBED) called");
-}
-
-/*
- * PTM_User::GetShellState service function.
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- * 2 : Whether the 3DS's physical shell casing is open (1) or closed (0)
- */
-static void GetShellState(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
-
- cmd_buff[1] = RESULT_SUCCESS.raw;
- cmd_buff[2] = GetShellState();
-}
-
-/**
- * PTM_U::GetBatteryLevel service function
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- * 2 : Battery level, 5 = completely full battery, 4 = mostly full battery,
- * 3 = half full battery, 2 = low battery, 1 = critical battery.
- */
-static void GetBatteryLevel(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
-
- cmd_buff[1] = RESULT_SUCCESS.raw;
- cmd_buff[2] = static_cast<u32>(GetBatteryLevel());
-
- LOG_WARNING(Service_PTM, "(STUBBED) called");
-}
-
-/**
- * PTM_U::GetBatteryChargeState service function
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- * 2 : Output of function, 0 = not charging, 1 = charging.
- */
-static void GetBatteryChargeState(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
-
- // TODO(purpasmart96): This function is only a stub,
- // it returns a valid result without implementing full functionality.
-
- cmd_buff[1] = RESULT_SUCCESS.raw;
- cmd_buff[2] = GetAdapterState();
-
- LOG_WARNING(Service_PTM, "(STUBBED) called");
-}
-
const Interface::FunctionInfo FunctionTable[] = {
{0x00010002, nullptr, "RegisterAlarmClient"},
{0x00020080, nullptr, "SetRtcAlarm"},