diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/acc/acc.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.h | 1 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 9a377e86d..c9ab8311e 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -158,8 +158,9 @@ void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) { | |||
| 158 | void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) { | 158 | void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) { |
| 159 | LOG_INFO(Service_ACC, "called"); | 159 | LOG_INFO(Service_ACC, "called"); |
| 160 | ctx.WriteBuffer(profile_manager->GetOpenUsers()); | 160 | ctx.WriteBuffer(profile_manager->GetOpenUsers()); |
| 161 | IPC::ResponseBuilder rb{ctx, 2}; | 161 | IPC::ResponseBuilder rb{ctx, 3}; |
| 162 | rb.Push(RESULT_SUCCESS); | 162 | rb.Push(RESULT_SUCCESS); |
| 163 | rb.Push<u32>(static_cast<u32>(profile_manager->GetOpenUserCount())); | ||
| 163 | } | 164 | } |
| 164 | 165 | ||
| 165 | void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { | 166 | void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index ef793b311..e8f6884d1 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp | |||
| @@ -118,6 +118,11 @@ size_t ProfileManager::GetUserCount() const { | |||
| 118 | return user_count; | 118 | return user_count; |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | size_t ProfileManager::GetOpenUserCount() const { | ||
| 122 | return std::count_if(profiles.begin(), profiles.end(), | ||
| 123 | [](const ProfileInfo& p) { return p.is_open; }); | ||
| 124 | } | ||
| 125 | |||
| 121 | bool ProfileManager::UserExists(UUID uuid) const { | 126 | bool ProfileManager::UserExists(UUID uuid) const { |
| 122 | return (GetUserIndex(uuid) != std::numeric_limits<size_t>::max()); | 127 | return (GetUserIndex(uuid) != std::numeric_limits<size_t>::max()); |
| 123 | } | 128 | } |
| @@ -148,8 +153,12 @@ std::array<UUID, MAX_USERS> ProfileManager::GetAllUsers() const { | |||
| 148 | 153 | ||
| 149 | std::array<UUID, MAX_USERS> ProfileManager::GetOpenUsers() const { | 154 | std::array<UUID, MAX_USERS> ProfileManager::GetOpenUsers() const { |
| 150 | std::array<UUID, MAX_USERS> output; | 155 | std::array<UUID, MAX_USERS> output; |
| 151 | std::copy_if(profiles.begin(), profiles.end(), output.begin(), | 156 | std::transform(profiles.begin(), profiles.end(), output.begin(), [](const ProfileInfo& p) { |
| 152 | [](const ProfileInfo& p) { return p.is_open; }); | 157 | if (p.is_open) |
| 158 | return p.user_uuid; | ||
| 159 | return UUID{}; | ||
| 160 | }); | ||
| 161 | std::stable_partition(output.begin(), output.end(), [](const UUID& uuid) { return uuid; }); | ||
| 153 | return output; | 162 | return output; |
| 154 | } | 163 | } |
| 155 | 164 | ||
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h index 121206954..8ec1273e4 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h | |||
| @@ -92,6 +92,7 @@ public: | |||
| 92 | bool GetProfileBaseAndData(ProfileInfo user, ProfileBase& profile, | 92 | bool GetProfileBaseAndData(ProfileInfo user, ProfileBase& profile, |
| 93 | std::array<u8, MAX_DATA>& data); | 93 | std::array<u8, MAX_DATA>& data); |
| 94 | size_t GetUserCount() const; | 94 | size_t GetUserCount() const; |
| 95 | size_t GetOpenUserCount() const; | ||
| 95 | bool UserExists(UUID uuid) const; | 96 | bool UserExists(UUID uuid) const; |
| 96 | void OpenUser(UUID uuid); | 97 | void OpenUser(UUID uuid); |
| 97 | void CloseUser(UUID uuid); | 98 | void CloseUser(UUID uuid); |