diff options
| author | bunnei <bunneidev@gmail.com> | 2022-11-02 19:42:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-02 19:42:04 -0700 |
| commit | 846b6fba820dcdb1d76f26eab739c0d33a0bc9d4 (patch) | |
| tree | 71671002c392744436411b25ecf56303c3b9d523 /src/core/hle/service/acc/profile_manager.cpp | |
| parent | 83f649240e7b9c2ba0346abe19cc9f388f469115 (diff) | |
| parent | 75ab52f05b39a625c039705f9290278efdad98f7 (diff) | |
Merge pull request #9157 from yuzu-emu/acc-stored-users
core: hle: service: acc: Fix ListOpenContextStoredUsers/StoreOpenContext.
Diffstat (limited to 'src/core/hle/service/acc/profile_manager.cpp')
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index a58da4d5f..481e0d141 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp @@ -261,6 +261,31 @@ UUID ProfileManager::GetLastOpenedUser() const { return last_opened_user; } +/// Gets the list of stored opened users. +UserIDArray ProfileManager::GetStoredOpenedUsers() const { + UserIDArray output{}; + std::ranges::transform(stored_opened_profiles, output.begin(), [](const ProfileInfo& p) { + if (p.is_open) + return p.user_uuid; + return Common::InvalidUUID; + }); + std::stable_partition(output.begin(), output.end(), + [](const UUID& uuid) { return uuid.IsValid(); }); + return output; +} + +/// Captures the opened users, which can be queried across process launches with +/// ListOpenContextStoredUsers. +void ProfileManager::StoreOpenedUsers() { + size_t profile_index{}; + stored_opened_profiles = {}; + std::for_each(profiles.begin(), profiles.end(), [&](const auto& profile) { + if (profile.is_open) { + stored_opened_profiles[profile_index++] = profile; + } + }); +} + /// Return the users profile base and the unknown arbitary data. bool ProfileManager::GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile, UserData& data) const { |
