From dc0a137e5b502329cd130c70bea093852233d1df Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 5 Feb 2018 23:24:47 -0500 Subject: [PATCH] acc_u0: Implement ListAllUsers. --- src/core/hle/service/acc/acc_u0.cpp | 16 ++++++++++++++-- src/core/hle/service/acc/acc_u0.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cpp index ff9f6cca80..ee7d07aa7a 100644 --- a/src/core/hle/service/acc/acc_u0.cpp +++ b/src/core/hle/service/acc/acc_u0.cpp @@ -9,6 +9,9 @@ namespace Service { namespace Account { +using Uid = std::array; +static constexpr Uid DEFAULT_USER_ID{0x10ull, 0x20ull}; + class IProfile final : public ServiceFramework { public: IProfile() : ServiceFramework("IProfile") { @@ -61,6 +64,15 @@ void ACC_U0::GetUserExistence(Kernel::HLERequestContext& ctx) { rb.Push(true); // TODO: Check when this is supposed to return true and when not } +void ACC_U0::ListAllUsers(Kernel::HLERequestContext& ctx) { + constexpr std::array user_ids{DEFAULT_USER_ID}; + const auto& output_buffer = ctx.BufferDescriptorC()[0]; + Memory::WriteBlock(output_buffer.Address(), user_ids.data(), user_ids.size()); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); + LOG_DEBUG(Service_ACC, "called"); +} + void ACC_U0::GetProfile(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); @@ -85,13 +97,13 @@ void ACC_U0::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_ACC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 6}; rb.Push(RESULT_SUCCESS); - rb.Push(0x0); - rb.Push(0x0); + rb.PushRaw(DEFAULT_USER_ID); } ACC_U0::ACC_U0() : ServiceFramework("acc:u0") { static const FunctionInfo functions[] = { {1, &ACC_U0::GetUserExistence, "GetUserExistence"}, + {2, &ACC_U0::ListAllUsers, "ListAllUsers"}, {4, &ACC_U0::GetLastOpenedUser, "GetLastOpenedUser"}, {5, &ACC_U0::GetProfile, "GetProfile"}, {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, diff --git a/src/core/hle/service/acc/acc_u0.h b/src/core/hle/service/acc/acc_u0.h index b38c2f95ec..d7732e75b7 100644 --- a/src/core/hle/service/acc/acc_u0.h +++ b/src/core/hle/service/acc/acc_u0.h @@ -28,6 +28,7 @@ public: private: void GetUserExistence(Kernel::HLERequestContext& ctx); + void ListAllUsers(Kernel::HLERequestContext& ctx); void GetLastOpenedUser(Kernel::HLERequestContext& ctx); void GetProfile(Kernel::HLERequestContext& ctx); void InitializeApplicationInfo(Kernel::HLERequestContext& ctx);