summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/acc/profile_manager.cpp
diff options
context:
space:
mode:
authorDavid Marcec <dmarcecguzman@gmail.com>2018-08-11 12:45:06 +0200
committerDavid Marcec <dmarcecguzman@gmail.com>2018-08-11 12:45:06 +0200
commitb8e70faa2df59086f04ad1d128c742ea23037dc3 (patch)
treea256c7129911279529c12644004549cd01ada140 /src/core/hle/service/acc/profile_manager.cpp
parentRemoved all for loops from the profile manager (diff)
downloadyuzu-b8e70faa2df59086f04ad1d128c742ea23037dc3.tar
yuzu-b8e70faa2df59086f04ad1d128c742ea23037dc3.tar.gz
yuzu-b8e70faa2df59086f04ad1d128c742ea23037dc3.tar.bz2
yuzu-b8e70faa2df59086f04ad1d128c742ea23037dc3.tar.lz
yuzu-b8e70faa2df59086f04ad1d128c742ea23037dc3.tar.xz
yuzu-b8e70faa2df59086f04ad1d128c742ea23037dc3.tar.zst
yuzu-b8e70faa2df59086f04ad1d128c742ea23037dc3.zip
Diffstat (limited to 'src/core/hle/service/acc/profile_manager.cpp')
-rw-r--r--src/core/hle/service/acc/profile_manager.cpp13
1 files changed, 11 insertions, 2 deletions
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 {
return user_count;
}
+size_t ProfileManager::GetOpenUserCount() const {
+ return std::count_if(profiles.begin(), profiles.end(),
+ [](const ProfileInfo& p) { return p.is_open; });
+}
+
bool ProfileManager::UserExists(UUID uuid) const {
return (GetUserIndex(uuid) != std::numeric_limits<size_t>::max());
}
@@ -148,8 +153,12 @@ std::array<UUID, MAX_USERS> ProfileManager::GetAllUsers() const {
std::array<UUID, MAX_USERS> ProfileManager::GetOpenUsers() const {
std::array<UUID, MAX_USERS> output;
- std::copy_if(profiles.begin(), profiles.end(), output.begin(),
- [](const ProfileInfo& p) { return p.is_open; });
+ std::transform(profiles.begin(), profiles.end(), output.begin(), [](const ProfileInfo& p) {
+ if (p.is_open)
+ return p.user_uuid;
+ return UUID{};
+ });
+ std::stable_partition(output.begin(), output.end(), [](const UUID& uuid) { return uuid; });
return output;
}