Daniel López Guimaraes 0d40b13828 act: Add more command names and implement GetErrorCode (#237)
* act: Add more command names and implement GetErrorCode

The command names have been extracted from 3dbrew and the JavaScript
bindings that the NNID settings uses internally.

The error names have been extracted from the Wii U implementation
(102-XXXX), which are compatible with the 3DS ones except for 022-5XXX,
which are error codes specific to the 3DS.

* act: Split error codes into separate file
2024-11-07 14:47:29 +01:00

70 lines
2.3 KiB
C++

// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/core.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/shared_memory.h"
#include "core/hle/service/act/act.h"
#include "core/hle/service/act/act_a.h"
#include "core/hle/service/act/act_errors.h"
#include "core/hle/service/act/act_u.h"
namespace Service::ACT {
Module::Interface::Interface(std::shared_ptr<Module> act, const char* name)
: ServiceFramework(name, 3), act(std::move(act)) {}
Module::Interface::~Interface() = default;
void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx);
const auto sdk_version = rp.Pop<u32>();
const auto shared_memory_size = rp.Pop<u32>();
const auto caller_pid = rp.PopPID();
[[maybe_unused]] const auto shared_memory = rp.PopObject<Kernel::SharedMemory>();
LOG_DEBUG(Service_ACT,
"(STUBBED) called sdk_version={:08X}, shared_memory_size={:08X}, caller_pid={}",
sdk_version, shared_memory_size, caller_pid);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultSuccess);
}
void Module::Interface::GetErrorCode(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx);
const auto result = rp.Pop<Result>();
LOG_DEBUG(Service_ACT, "called result={:08X}", result.raw);
const u32 error_code = GetACTErrorCode(result);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(ResultSuccess);
rb.Push(error_code);
}
void Module::Interface::GetAccountInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx);
const auto account_slot = rp.Pop<u8>();
const auto size = rp.Pop<u32>();
const auto block_id = rp.Pop<u32>();
[[maybe_unused]] auto output_buffer = rp.PopMappedBuffer();
LOG_DEBUG(Service_ACT, "(STUBBED) called account_slot={:02X}, size={:08X}, block_id={:08X}",
account_slot, size, block_id);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultSuccess);
}
void InstallInterfaces(Core::System& system) {
auto& service_manager = system.ServiceManager();
auto act = std::make_shared<Module>();
std::make_shared<ACT_A>(act)->InstallAsService(service_manager);
std::make_shared<ACT_U>(act)->InstallAsService(service_manager);
}
} // namespace Service::ACT