Implement APT command 0x0103 (#5478)

* WIP implement apt 0x0103

* Update src/core/hle/service/apt/apt.cpp

Co-authored-by: Pengfei Zhu <zhupf321@gmail.com>

* Names

Co-authored-by: Pengfei Zhu <zhupf321@gmail.com>
This commit is contained in:
xperia64 2021-01-26 20:27:52 +00:00 committed by GitHub
parent 7c6d7905a4
commit 8df502a688
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 0 deletions

View file

@ -28,6 +28,7 @@
#include "core/hle/service/service.h"
#include "core/hw/aes/ccm.h"
#include "core/hw/aes/key.h"
#include "core/settings.h"
SERVICE_CONSTRUCT_IMPL(Service::APT::Module)
@ -1007,6 +1008,16 @@ void Module::APTInterface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APT, "(STUBBED) called");
}
void Module::APTInterface::Unknown0x0103(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x103, 0, 0); // 0x01030000
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
rb.Push<u8>(Settings::values.is_new_3ds ? 2 : 1);
LOG_WARNING(Service_APT, "(STUBBED) called");
}
void Module::APTInterface::IsTitleAllowed(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x105, 4, 0); // 0x01050100
const u64 program_id = rp.Pop<u64>();

View file

@ -690,6 +690,14 @@ public:
*/
void CheckNew3DS(Kernel::HLERequestContext& ctx);
/**
* APT::Unknown0x0103 service function. Determines whether Smash 4 allows C-Stick
* Outputs:
* 1: Result code, 0 on success otherwise error code
* 2: u8 output: 2 = New3DS+valid/initialized (in Smash 4), 1 = Old3DS or invalid
*/
void Unknown0x0103(Kernel::HLERequestContext& ctx);
/**
* APT::IsTitleAllowed service function
* Inputs:

View file

@ -99,6 +99,7 @@ APT_A::APT_A(std::shared_ptr<Module> apt)
{0x00580002, nullptr, "GetProgramID"},
{0x01010000, &APT_A::CheckNew3DSApp, "CheckNew3DSApp"},
{0x01020000, &APT_A::CheckNew3DS, "CheckNew3DS"},
{0x01030000, &APT_A::Unknown0x0103, "Unknown0x0103"},
{0x01040000, nullptr, "IsStandardMemoryLayout"},
{0x01050100, &APT_A::IsTitleAllowed, "IsTitleAllowed"},
};

View file

@ -99,6 +99,7 @@ APT_S::APT_S(std::shared_ptr<Module> apt)
{0x00580002, nullptr, "GetProgramID"},
{0x01010000, &APT_S::CheckNew3DSApp, "CheckNew3DSApp"},
{0x01020000, &APT_S::CheckNew3DS, "CheckNew3DS"},
{0x01030000, &APT_S::Unknown0x0103, "Unknown0x0103"},
{0x01040000, nullptr, "IsStandardMemoryLayout"},
{0x01050100, &APT_S::IsTitleAllowed, "IsTitleAllowed"},
};

View file

@ -98,6 +98,7 @@ APT_U::APT_U(std::shared_ptr<Module> apt)
{0x00580002, nullptr, "GetProgramID"},
{0x01010000, &APT_U::CheckNew3DSApp, "CheckNew3DSApp"},
{0x01020000, &APT_U::CheckNew3DS, "CheckNew3DS"},
{0x01030000, &APT_U::Unknown0x0103, "Unknown0x0103"},
};
RegisterHandlers(functions);
}