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 committed by Zaneo
parent 0ea2319f3c
commit 7ca9bdb3fe
9 changed files with 62 additions and 1 deletions

View File

@ -19,6 +19,8 @@
#include "core/hle/kernel/shared_memory.h"
#include "core/hle/kernel/thread.h"
#include "core/hle/service/ptm/ptm.h"
namespace Service {
namespace APT {
@ -327,6 +329,23 @@ void GetAppCpuTimeLimit(Service::Interface* self) {
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/Else is to indicate that a check should occur here.
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 PrepareToStartLibraryApplet(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
AppletId applet_id = static_cast<AppletId>(cmd_buff[1]);

View File

@ -299,6 +299,15 @@ void PrepareToStartLibraryApplet(Service::Interface* self);
*/
void StartLibraryApplet(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
void Init();

View File

@ -28,6 +28,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00440000, GetSharedFont, "GetSharedFont?"},
{0x004B00C2, AppletUtility, "AppletUtility?"},
{0x00550040, nullptr, "WriteInputToNsState?"},
{0x01010000, Unknown_0x01010000, "Unknown_0x01010000"},
};
APT_A_Interface::APT_A_Interface() {

View File

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

View File

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

View File

@ -77,6 +77,10 @@ void IsLegacyPowerOff(Service::Interface* self) {
LOG_WARNING(Service_PTM, "(STUBBED) called");
}
u8 CheckNew3DS(){
return static_cast<u8>(PhysicalVersion::Old3DS);
}
void Init() {
AddService(new PTM_Play_Interface);
AddService(new PTM_Sysm_Interface);

View File

@ -79,6 +79,12 @@ void GetBatteryChargeState(Interface* self);
*/
void IsLegacyPowerOff(Interface* self);
/**
* Checks the physical version of the 3Ds
* @returns The physical version of the 3Ds
*/
u8 CheckNew3DS(void);
/// Initialize the PTM service
void Init();

View File

@ -5,10 +5,24 @@
#include "core/hle/hle.h"
#include "core/hle/service/ptm/ptm.h"
#include "core/hle/service/ptm/ptm_sysm.h"
#include "core/hle/service/ptm/ptm.h"
namespace Service {
namespace PTM {
/**
* Returns whether the system is an Old3DS, or a New3DS
* Outputs:
* 1: Result code, 0 on success, otherwise error code
* 2: Result of function, 0 for Old3DS, or 1 for New3DS
*/
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[] = {
{0x040100C0, nullptr, "SetRtcAlarmEx"},
{0x04020042, nullptr, "ReplySleepQuery"},
@ -19,7 +33,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x040700C0, nullptr, "ShutdownAsync"},
{0x04080000, nullptr, "Awake"},
{0x04090080, nullptr, "RebootAsync"},
{0x040A0000, nullptr, "CheckNew3DS"},
{0x040A0000, CheckNew3DS, "CheckNew3DS"},
{0x08010640, nullptr, "SetInfoLEDPattern"},
{0x08020040, nullptr, "SetInfoLEDPatternHeader"},
{0x08030000, nullptr, "GetInfoLEDStatus"},

View File

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