Skip to content

Commit

Permalink
act: Add more command names and implement GetErrorCode
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniElectra authored and Gamer64ytb committed Sep 1, 2024
1 parent 604eb8c commit a608155
Show file tree
Hide file tree
Showing 8 changed files with 1,478 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/android/app/src/main/jni/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ void Config::ReadValues() {
ReadSetting("Renderer", Settings::values.use_vsync_new);
ReadSetting("Renderer", Settings::values.texture_filter);
ReadSetting("Renderer", Settings::values.texture_sampling);
ReadSetting("Renderer", Settings::values.delay_game_render_thread_us);
ReadSetting("Renderer", Settings::values.force_hw_vertex_shaders);
ReadSetting("Renderer", Settings::values.disable_surface_texture_copy);
ReadSetting("Renderer", Settings::values.disable_flush_cpu_write);

// Work around to map Android setting for enabling the frame limiter to the format Mandarine
// expects
Expand All @@ -177,10 +181,6 @@ void Config::ReadValues() {
ReadSetting("Renderer", Settings::values.bg_red);
ReadSetting("Renderer", Settings::values.bg_green);
ReadSetting("Renderer", Settings::values.bg_blue);
ReadSetting("Renderer", Settings::values.delay_game_render_thread_us);
ReadSetting("Renderer", Settings::values.force_hw_vertex_shaders);
ReadSetting("Renderer", Settings::values.disable_surface_texture_copy);
ReadSetting("Renderer", Settings::values.disable_flush_cpu_write);

// Layout
// Somewhat inelegant solution to ensure layout value is between 0 and 5 on read
Expand Down
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ add_library(mandarine_core STATIC
hle/service/ac/ac_u.h
hle/service/act/act.cpp
hle/service/act/act.h
hle/service/act/act_errors.cpp
hle/service/act/act_errors.h
hle/service/act/act_a.cpp
hle/service/act/act_a.h
hle/service/act/act_u.cpp
Expand Down
22 changes: 18 additions & 4 deletions src/core/hle/service/act/act.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#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 {
Expand All @@ -31,15 +32,28 @@ void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
rb.Push(ResultSuccess);
}

void Module::Interface::GetAccountDataBlock(Kernel::HLERequestContext& ctx) {
void Module::Interface::GetErrorCode(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx);
const auto unknown = rp.Pop<u8>();
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 unknown={:02X}, size={:08X}, block_id={:08X}", unknown,
size, block_id);
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);
Expand Down
16 changes: 13 additions & 3 deletions src/core/hle/service/act/act.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,27 @@ class Module final {
void Initialize(Kernel::HLERequestContext& ctx);

/**
* ACT::GetAccountDataBlock service function.
* ACT::GetErrorCode service function.
* Inputs:
* 1 : u8 Unknown
* 1 : Result code
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
* 2 : Error code
*/
void GetErrorCode(Kernel::HLERequestContext& ctx);

/**
* ACT::GetAccountInfo service function.
* Inputs:
* 1 : Account slot
* 2 : Size
* 3 : Block ID
* 4 : Output Buffer Mapping Translation Header ((Size << 4) | 0xC)
* 5 : Output Buffer Pointer
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
*/
void GetAccountDataBlock(Kernel::HLERequestContext& ctx);
void GetAccountInfo(Kernel::HLERequestContext& ctx);
};

private:
Expand Down
50 changes: 48 additions & 2 deletions src/core/hle/service/act/act_a.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,61 @@ ACT_A::ACT_A(std::shared_ptr<Module> act) : Module::Interface(std::move(act), "a
// act:u shared commands
// clang-format off
{0x0001, &ACT_A::Initialize, "Initialize"},
{0x0002, nullptr, "GetErrorCode"},
{0x0006, &ACT_A::GetAccountDataBlock, "GetAccountDataBlock"},
{0x0002, &ACT_A::GetErrorCode, "GetErrorCode"},
{0x0003, nullptr, "GetLastResponseCode"},
{0x0005, nullptr, "GetCommonInfo"},
{0x0006, &ACT_A::GetAccountInfo, "GetAccountInfo"},
{0x0007, nullptr, "GetResultAsync"},
{0x0008, nullptr, "GetMiiImageData"},
{0x0009, nullptr, "SetNfsPassword"},
{0x000B, nullptr, "AcquireEulaList"},
{0x000C, nullptr, "AcquireTimeZoneList"},
{0x000D, nullptr, "GenerateUuid"},
{0x000F, nullptr, "FindSlotNoByUuid"},
{0x0010, nullptr, "SaveData"},
{0x0011, nullptr, "GetTransferableId"},
{0x0012, nullptr, "AcquireNexServiceToken"},
{0x0013, nullptr, "GetNexServiceToken"},
{0x0014, nullptr, "AcquireIndependentServiceToken"},
{0x0015, nullptr, "GetIndependentServiceToken"},
{0x0016, nullptr, "AcquireAccountInfo"},
{0x0017, nullptr, "AcquireAccountIdByPrincipalId"},
{0x0018, nullptr, "AcquirePrincipalIdByAccountId"},
{0x0019, nullptr, "AcquireMii"},
{0x001A, nullptr, "AcquireAccountInfoEx"},
{0x001D, nullptr, "InquireMailAddress"},
{0x001E, nullptr, "AcquireEula"},
{0x001F, nullptr, "AcquireEulaLanguageList"},
// act:a
{0x0402, nullptr, "CreateConsoleAccount"},
{0x0403, nullptr, "CommitConsoleAccount"},
{0x0404, nullptr, "UnbindServerAccount"},
{0x0405, nullptr, "DeleteConsoleAccount"},
{0x0407, nullptr, "UnloadConsoleAccount"},
{0x0408, nullptr, "EnableAccountPasswordCache"},
{0x0409, nullptr, "SetDefaultAccount"},
{0x040A, nullptr, "ReplaceAccountId"},
{0x040B, nullptr, "GetSupportContext"},
{0x0412, nullptr, "UpdateMii"},
{0x0413, nullptr, "UpdateMiiImage"},
{0x0414, nullptr, "InquireAccountIdAvailability"},
{0x0415, nullptr, "BindToNewServerAccount"},
{0x0416, nullptr, "BindToExistentServerAccount"},
{0x0417, nullptr, "InquireBindingToExistentServerAccount"},
{0x041A, nullptr, "AcquireAccountTokenEx"},
{0x041B, nullptr, "AgreeEula"},
{0x041C, nullptr, "SyncAccountInfo"},
{0x041E, nullptr, "UpdateAccountPassword"},
{0x041F, nullptr, "ReissueAccountPassword"},
{0x0420, nullptr, "SetAccountPasswordInput"},
{0x0421, nullptr, "UploadMii"},
{0x0423, nullptr, "ValidateMailAddress"},
{0x0423, nullptr, "SendConfirmationMail"},
{0x0428, nullptr, "ApproveByCreditCard"},
{0x0428, nullptr, "SendCoppaCodeMail"},
{0x042F, nullptr, "UpdateAccountInfoEx"},
{0x0430, nullptr, "UpdateAccountMailAddress"},
{0x0435, nullptr, "DeleteServerAccount"},
// clang-format on
};
RegisterHandlers(functions);
Expand Down
Loading

0 comments on commit a608155

Please sign in to comment.