From 791d6b8b3a0d88ccef3ded20361f495e8cb7eccb Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 19 Jul 2018 16:51:55 -0500 Subject: [PATCH 1/2] HLE/ACC: Change the default user id to be consistent with what we tell games on startup. In IApplicationFunctions::PopLaunchParameter we tell the games that they were launched as user id 1. --- src/core/hle/service/acc/acc.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 6bafb2dce5..83c7233792 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -30,8 +30,7 @@ struct ProfileBase { }; static_assert(sizeof(ProfileBase) == 0x38, "ProfileBase structure has incorrect size"); -using Uid = std::array; -static constexpr Uid DEFAULT_USER_ID{0x10ull, 0x20ull}; +static constexpr u128 DEFAULT_USER_ID{1ull, 0ull}; class IProfile final : public ServiceFramework { public: From 5bad464f7b5117c31da31231ca7e96968418a39e Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 19 Jul 2018 16:53:42 -0500 Subject: [PATCH 2/2] HLE/ACC: Return an IProfile that is consistent with what was requested. The default username for now is "yuzu". We should eventually allow the creation of users in the emulator and have the ability to modify their parameters. --- src/core/hle/service/acc/acc.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 83c7233792..1a32faf0f8 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include "common/logging/log.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/acc/acc.h" @@ -24,9 +25,9 @@ struct UserData { static_assert(sizeof(UserData) == 0x80, "UserData structure has incorrect size"); struct ProfileBase { - u8 user_id[0x10]; + u128 user_id; u64 timestamp; - u8 username[0x20]; + std::array username; }; static_assert(sizeof(ProfileBase) == 0x38, "ProfileBase structure has incorrect size"); @@ -34,7 +35,7 @@ static constexpr u128 DEFAULT_USER_ID{1ull, 0ull}; class IProfile final : public ServiceFramework { public: - IProfile() : ServiceFramework("IProfile") { + IProfile(u128 user_id) : ServiceFramework("IProfile"), user_id(user_id) { static const FunctionInfo functions[] = { {0, nullptr, "Get"}, {1, &IProfile::GetBase, "GetBase"}, @@ -47,11 +48,18 @@ public: private: void GetBase(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_ACC, "(STUBBED) called"); + + // TODO(Subv): Retrieve this information from somewhere. ProfileBase profile_base{}; + profile_base.user_id = user_id; + profile_base.username = {'y', 'u', 'z', 'u'}; + IPC::ResponseBuilder rb{ctx, 16}; rb.Push(RESULT_SUCCESS); rb.PushRaw(profile_base); } + + u128 user_id; ///< The user id this profile refers to. }; class IManagerForApplication final : public ServiceFramework { @@ -109,10 +117,12 @@ void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) { } void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + u128 user_id = rp.PopRaw(); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); - LOG_DEBUG(Service_ACC, "called"); + rb.PushIpcInterface(user_id); + LOG_DEBUG(Service_ACC, "called user_id=0x{:016X}{:016X}", user_id[1], user_id[0]); } void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) {