diff options
| author | 2018-07-19 16:15:01 -0700 | |
|---|---|---|
| committer | 2018-07-19 16:15:01 -0700 | |
| commit | af08034c714996aaf87c7ba2461acd29af592f11 (patch) | |
| tree | 8e9eec2298b48df3573cda74694f9b0cf8e0306d | |
| parent | Merge pull request #727 from Subv/acc_users (diff) | |
| parent | HLE/ACC: Return an IProfile that is consistent with what was requested. (diff) | |
| download | yuzu-af08034c714996aaf87c7ba2461acd29af592f11.tar.gz yuzu-af08034c714996aaf87c7ba2461acd29af592f11.tar.xz yuzu-af08034c714996aaf87c7ba2461acd29af592f11.zip | |
Merge pull request #728 from Subv/acc_profile
HLE/ACC: Change the default user id and small improvements to the way we handle profiles
| -rw-r--r-- | src/core/hle/service/acc/acc.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 0b17c7d5d..8ee39b54c 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <array> | ||
| 5 | #include "common/logging/log.h" | 6 | #include "common/logging/log.h" |
| 6 | #include "core/hle/ipc_helpers.h" | 7 | #include "core/hle/ipc_helpers.h" |
| 7 | #include "core/hle/service/acc/acc.h" | 8 | #include "core/hle/service/acc/acc.h" |
| @@ -24,18 +25,17 @@ struct UserData { | |||
| 24 | static_assert(sizeof(UserData) == 0x80, "UserData structure has incorrect size"); | 25 | static_assert(sizeof(UserData) == 0x80, "UserData structure has incorrect size"); |
| 25 | 26 | ||
| 26 | struct ProfileBase { | 27 | struct ProfileBase { |
| 27 | u8 user_id[0x10]; | 28 | u128 user_id; |
| 28 | u64 timestamp; | 29 | u64 timestamp; |
| 29 | u8 username[0x20]; | 30 | std::array<u8, 0x20> username; |
| 30 | }; | 31 | }; |
| 31 | static_assert(sizeof(ProfileBase) == 0x38, "ProfileBase structure has incorrect size"); | 32 | static_assert(sizeof(ProfileBase) == 0x38, "ProfileBase structure has incorrect size"); |
| 32 | 33 | ||
| 33 | using Uid = std::array<u64, 2>; | 34 | static constexpr u128 DEFAULT_USER_ID{1ull, 0ull}; |
| 34 | static constexpr Uid DEFAULT_USER_ID{0x10ull, 0x20ull}; | ||
| 35 | 35 | ||
| 36 | class IProfile final : public ServiceFramework<IProfile> { | 36 | class IProfile final : public ServiceFramework<IProfile> { |
| 37 | public: | 37 | public: |
| 38 | IProfile() : ServiceFramework("IProfile") { | 38 | IProfile(u128 user_id) : ServiceFramework("IProfile"), user_id(user_id) { |
| 39 | static const FunctionInfo functions[] = { | 39 | static const FunctionInfo functions[] = { |
| 40 | {0, nullptr, "Get"}, | 40 | {0, nullptr, "Get"}, |
| 41 | {1, &IProfile::GetBase, "GetBase"}, | 41 | {1, &IProfile::GetBase, "GetBase"}, |
| @@ -48,11 +48,18 @@ public: | |||
| 48 | private: | 48 | private: |
| 49 | void GetBase(Kernel::HLERequestContext& ctx) { | 49 | void GetBase(Kernel::HLERequestContext& ctx) { |
| 50 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | 50 | LOG_WARNING(Service_ACC, "(STUBBED) called"); |
| 51 | |||
| 52 | // TODO(Subv): Retrieve this information from somewhere. | ||
| 51 | ProfileBase profile_base{}; | 53 | ProfileBase profile_base{}; |
| 54 | profile_base.user_id = user_id; | ||
| 55 | profile_base.username = {'y', 'u', 'z', 'u'}; | ||
| 56 | |||
| 52 | IPC::ResponseBuilder rb{ctx, 16}; | 57 | IPC::ResponseBuilder rb{ctx, 16}; |
| 53 | rb.Push(RESULT_SUCCESS); | 58 | rb.Push(RESULT_SUCCESS); |
| 54 | rb.PushRaw(profile_base); | 59 | rb.PushRaw(profile_base); |
| 55 | } | 60 | } |
| 61 | |||
| 62 | u128 user_id; ///< The user id this profile refers to. | ||
| 56 | }; | 63 | }; |
| 57 | 64 | ||
| 58 | class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { | 65 | class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { |
| @@ -112,10 +119,12 @@ void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) { | |||
| 112 | } | 119 | } |
| 113 | 120 | ||
| 114 | void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { | 121 | void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { |
| 122 | IPC::RequestParser rp{ctx}; | ||
| 123 | u128 user_id = rp.PopRaw<u128>(); | ||
| 115 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 124 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 116 | rb.Push(RESULT_SUCCESS); | 125 | rb.Push(RESULT_SUCCESS); |
| 117 | rb.PushIpcInterface<IProfile>(); | 126 | rb.PushIpcInterface<IProfile>(user_id); |
| 118 | LOG_DEBUG(Service_ACC, "called"); | 127 | LOG_DEBUG(Service_ACC, "called user_id=0x{:016X}{:016X}", user_id[1], user_id[0]); |
| 119 | } | 128 | } |
| 120 | 129 | ||
| 121 | void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { | 130 | void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { |