Added Service to ATP, and PTM

Added stubbed ATP::Uknown_0x01010000
Added PTM::CheckNew3Ds
This commit is contained in:
Gareth Higgins 2015-04-10 01:59:36 -04:00
parent b16fe21764
commit 8c16df695c
8 changed files with 60 additions and 1 deletions

View File

@ -16,6 +16,8 @@
#include "core/hle/kernel/shared_memory.h" #include "core/hle/kernel/shared_memory.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/service/ptm/ptm.h"
namespace Service { namespace Service {
namespace APT { namespace APT {
@ -278,6 +280,22 @@ void GetAppCpuTimeLimit(Service::Interface* self) {
LOG_WARNING(Service_APT, "(STUBBED) called value=%u", value); LOG_WARNING(Service_APT, "(STUBBED) called value=%u", value);
} }
void Unknown_0x01010000(Service::Interface* self){
u32* cmd_buff = Kernel::GetCommandBuffer();
cmd_buff[1] = RESULT_SUCCESS.raw;
// When a certain NS state field (internal NS state in .data/.bss.) is non-zero, the output value is zero
if (false){
cmd_buff[2] = 0;
}
else{
cmd_buff[2] = PTM::CheckNew3Ds();
}
LOG_WARNING(Service_APT, "(STUBBED) does not check internal NS state field");
}
void Init() { void Init() {
AddService(new APT_A_Interface); AddService(new APT_A_Interface);
AddService(new APT_S_Interface); AddService(new APT_S_Interface);

View File

@ -249,6 +249,15 @@ void SetAppCpuTimeLimit(Service::Interface* self);
*/ */
void GetAppCpuTimeLimit(Service::Interface* self); void GetAppCpuTimeLimit(Service::Interface* self);
/**
* From 3Ds Brew:
* This writes an output u8 to cmdreply indexword[2].
* This uses PTMSYSM:CheckNew3DS.
* When a certain NS state field (internal NS state in .data/.bss.) is non-zero, the output value is zero, otherwise the output is from PTMSYSM:CheckNew3DS.
* Normally this NS state field is zero, however this state field is set to 1 when APT:PrepareToStartApplication is used with flags bit8 is set.
*/
void Unknown_0x01010000(Service::Interface* self);
/// Initialize the APT service /// Initialize the APT service
void Init(); void Init();

View File

@ -94,6 +94,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x004E0000, nullptr, "HardwareResetAsync"}, {0x004E0000, nullptr, "HardwareResetAsync"},
{0x004F0080, nullptr, "SetApplicationCpuTimeLimit"}, {0x004F0080, nullptr, "SetApplicationCpuTimeLimit"},
{0x00500040, nullptr, "GetApplicationCpuTimeLimit"}, {0x00500040, nullptr, "GetApplicationCpuTimeLimit"},
{0x01010000, Unknown_0x01010000, "Unknown_0x01010000" },
}; };
APT_S_Interface::APT_S_Interface() { APT_S_Interface::APT_S_Interface() {

View File

@ -93,6 +93,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x004E0000, nullptr, "HardwareResetAsync"}, {0x004E0000, nullptr, "HardwareResetAsync"},
{0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit"}, {0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit"},
{0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit"}, {0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit"},
{0x01010000, Unknown_0x01010000, "Unknown_0x01010000"},
}; };
APT_U_Interface::APT_U_Interface() { APT_U_Interface::APT_U_Interface() {

View File

@ -38,6 +38,10 @@ ChargeLevels GetBatteryLevel() {
return ChargeLevels::CompletelyFull; // Set to a completely full battery return ChargeLevels::CompletelyFull; // Set to a completely full battery
} }
u8 CheckNew3Ds(){
return static_cast<u8>(PhysicalVersion::Old3Ds);
}
void Init() { void Init() {
AddService(new PTM_Play_Interface); AddService(new PTM_Play_Interface);
AddService(new PTM_Sysm_Interface); AddService(new PTM_Sysm_Interface);

View File

@ -55,6 +55,12 @@ u32 GetShellState();
*/ */
ChargeLevels GetBatteryLevel(); ChargeLevels GetBatteryLevel();
/**
* Checks the physical version of the 3Ds
* @returns The physical version of the 3Ds
*/
u8 CheckNew3Ds(void);
/// Initialize the PTM service /// Initialize the PTM service
void Init(); void Init();

View File

@ -6,6 +6,7 @@
#include "core/file_sys/archive_extsavedata.h" #include "core/file_sys/archive_extsavedata.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/service/ptm/ptm_sysm.h" #include "core/hle/service/ptm/ptm_sysm.h"
#include "core/hle/service/ptm/ptm.h"
namespace Service { namespace Service {
namespace PTM { namespace PTM {
@ -22,6 +23,19 @@ void IsLegacyPowerOff(Service::Interface* self) {
cmd_buff[2] = 0; cmd_buff[2] = 0;
} }
/**
* Checks the physical version of the 3Ds
* Outputs:
* 0 : Return header
* 1 : 0 if old 3Ds, 1 if new 3DS
*/
void CheckNew3Ds(Service::Interface* self){
u32* cmd_buff = Kernel::GetCommandBuffer();
cmd_buff[1] = RESULT_SUCCESS.raw;
cmd_buff[2] = PTM::CheckNew3Ds();
}
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {
{0x040100C0, nullptr, "SetRtcAlarmEx"}, {0x040100C0, nullptr, "SetRtcAlarmEx"},
{0x04020042, nullptr, "ReplySleepQuery"}, {0x04020042, nullptr, "ReplySleepQuery"},
@ -32,7 +46,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x040700C0, nullptr, "ShutdownAsync"}, {0x040700C0, nullptr, "ShutdownAsync"},
{0x04080000, nullptr, "Awake"}, {0x04080000, nullptr, "Awake"},
{0x04090080, nullptr, "RebootAsync"}, {0x04090080, nullptr, "RebootAsync"},
{0x040A0000, nullptr, "CheckNew3DS"}, {0x040A0000, CheckNew3Ds, "CheckNew3DS"},
{0x08010640, nullptr, "SetInfoLEDPattern"}, {0x08010640, nullptr, "SetInfoLEDPattern"},
{0x08020040, nullptr, "SetInfoLEDPatternHeader"}, {0x08020040, nullptr, "SetInfoLEDPatternHeader"},
{0x08030000, nullptr, "GetInfoLEDStatus"}, {0x08030000, nullptr, "GetInfoLEDStatus"},

View File

@ -9,6 +9,12 @@
namespace Service { namespace Service {
namespace PTM { namespace PTM {
/// Physical version of the 3Ds
enum class PhysicalVersion : u8 {
Old3Ds = 0,
New3Ds = 1,
};
class PTM_Sysm_Interface : public Interface { class PTM_Sysm_Interface : public Interface {
public: public:
PTM_Sysm_Interface(); PTM_Sysm_Interface();