diff options
| author | bunnei <bunneidev@gmail.com> | 2022-10-30 16:37:28 -0700 |
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2022-11-02 16:09:30 -0700 |
| commit | 75ab52f05b39a625c039705f9290278efdad98f7 (patch) | |
| tree | 71671002c392744436411b25ecf56303c3b9d523 /src/core/hle/service/acc/profile_manager.cpp | |
| parent | 83f649240e7b9c2ba0346abe19cc9f388f469115 (diff) | |
core: hle: service: acc: Fix ListOpenContextStoredUsers/StoreOpenContext.
- These APIs are used to capture the opened users and allow that state to be persisted across processes.
- They are not intended to just return the system opened users, that is what ListOpenUsers is for.
- Fixes the launch hang with Bayonetta 3.
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 { |
