diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/acc/acc.cpp | 34 | ||||
| -rw-r--r-- | src/core/hle/service/acc/acc.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/acc/acc_u0.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.cpp | 25 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.h | 3 |
5 files changed, 42 insertions, 23 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index bb838e285..85a3f0802 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -512,10 +512,11 @@ protected: | |||
| 512 | 512 | ||
| 513 | class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { | 513 | class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { |
| 514 | public: | 514 | public: |
| 515 | explicit IManagerForApplication(Core::System& system_, Common::UUID user_id_) | 515 | explicit IManagerForApplication(Core::System& system_, |
| 516 | const std::shared_ptr<ProfileManager>& profile_manager_) | ||
| 516 | : ServiceFramework{system_, "IManagerForApplication"}, | 517 | : ServiceFramework{system_, "IManagerForApplication"}, |
| 517 | ensure_token_id{std::make_shared<EnsureTokenIdCacheAsyncInterface>(system)}, | 518 | ensure_token_id{std::make_shared<EnsureTokenIdCacheAsyncInterface>(system)}, |
| 518 | user_id{user_id_} { | 519 | profile_manager{profile_manager_} { |
| 519 | // clang-format off | 520 | // clang-format off |
| 520 | static const FunctionInfo functions[] = { | 521 | static const FunctionInfo functions[] = { |
| 521 | {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, | 522 | {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, |
| @@ -545,7 +546,7 @@ private: | |||
| 545 | 546 | ||
| 546 | IPC::ResponseBuilder rb{ctx, 4}; | 547 | IPC::ResponseBuilder rb{ctx, 4}; |
| 547 | rb.Push(ResultSuccess); | 548 | rb.Push(ResultSuccess); |
| 548 | rb.PushRaw<u64>(user_id.Hash()); | 549 | rb.PushRaw<u64>(profile_manager->GetLastOpenedUser().Hash()); |
| 549 | } | 550 | } |
| 550 | 551 | ||
| 551 | void EnsureIdTokenCacheAsync(Kernel::HLERequestContext& ctx) { | 552 | void EnsureIdTokenCacheAsync(Kernel::HLERequestContext& ctx) { |
| @@ -575,17 +576,20 @@ private: | |||
| 575 | 576 | ||
| 576 | IPC::ResponseBuilder rb{ctx, 4}; | 577 | IPC::ResponseBuilder rb{ctx, 4}; |
| 577 | rb.Push(ResultSuccess); | 578 | rb.Push(ResultSuccess); |
| 578 | rb.PushRaw<u64>(user_id.Hash()); | 579 | rb.PushRaw<u64>(profile_manager->GetLastOpenedUser().Hash()); |
| 579 | } | 580 | } |
| 580 | 581 | ||
| 581 | void StoreOpenContext(Kernel::HLERequestContext& ctx) { | 582 | void StoreOpenContext(Kernel::HLERequestContext& ctx) { |
| 582 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | 583 | LOG_DEBUG(Service_ACC, "called"); |
| 584 | |||
| 585 | profile_manager->StoreOpenedUsers(); | ||
| 586 | |||
| 583 | IPC::ResponseBuilder rb{ctx, 2}; | 587 | IPC::ResponseBuilder rb{ctx, 2}; |
| 584 | rb.Push(ResultSuccess); | 588 | rb.Push(ResultSuccess); |
| 585 | } | 589 | } |
| 586 | 590 | ||
| 587 | std::shared_ptr<EnsureTokenIdCacheAsyncInterface> ensure_token_id{}; | 591 | std::shared_ptr<EnsureTokenIdCacheAsyncInterface> ensure_token_id{}; |
| 588 | Common::UUID user_id{}; | 592 | std::shared_ptr<ProfileManager> profile_manager; |
| 589 | }; | 593 | }; |
| 590 | 594 | ||
| 591 | // 6.0.0+ | 595 | // 6.0.0+ |
| @@ -790,7 +794,7 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo | |||
| 790 | LOG_DEBUG(Service_ACC, "called"); | 794 | LOG_DEBUG(Service_ACC, "called"); |
| 791 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 795 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 792 | rb.Push(ResultSuccess); | 796 | rb.Push(ResultSuccess); |
| 793 | rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser()); | 797 | rb.PushIpcInterface<IManagerForApplication>(system, profile_manager); |
| 794 | } | 798 | } |
| 795 | 799 | ||
| 796 | void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { | 800 | void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { |
| @@ -849,22 +853,10 @@ void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) { | |||
| 849 | rb.Push(ResultSuccess); | 853 | rb.Push(ResultSuccess); |
| 850 | } | 854 | } |
| 851 | 855 | ||
| 852 | void Module::Interface::LoadOpenContext(Kernel::HLERequestContext& ctx) { | ||
| 853 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | ||
| 854 | |||
| 855 | // This is similar to GetBaasAccountManagerForApplication | ||
| 856 | // This command is used concurrently with ListOpenContextStoredUsers | ||
| 857 | // TODO: Find the differences between this and GetBaasAccountManagerForApplication | ||
| 858 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 859 | rb.Push(ResultSuccess); | ||
| 860 | rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser()); | ||
| 861 | } | ||
| 862 | |||
| 863 | void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) { | 856 | void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) { |
| 864 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | 857 | LOG_DEBUG(Service_ACC, "called"); |
| 865 | 858 | ||
| 866 | // TODO(ogniK): Handle open contexts | 859 | ctx.WriteBuffer(profile_manager->GetStoredOpenedUsers()); |
| 867 | ctx.WriteBuffer(profile_manager->GetOpenUsers()); | ||
| 868 | IPC::ResponseBuilder rb{ctx, 2}; | 860 | IPC::ResponseBuilder rb{ctx, 2}; |
| 869 | rb.Push(ResultSuccess); | 861 | rb.Push(ResultSuccess); |
| 870 | } | 862 | } |
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h index 1621e7c0a..9411b0b92 100644 --- a/src/core/hle/service/acc/acc.h +++ b/src/core/hle/service/acc/acc.h | |||
| @@ -35,7 +35,6 @@ public: | |||
| 35 | void InitializeApplicationInfoV2(Kernel::HLERequestContext& ctx); | 35 | void InitializeApplicationInfoV2(Kernel::HLERequestContext& ctx); |
| 36 | void GetProfileEditor(Kernel::HLERequestContext& ctx); | 36 | void GetProfileEditor(Kernel::HLERequestContext& ctx); |
| 37 | void ListQualifiedUsers(Kernel::HLERequestContext& ctx); | 37 | void ListQualifiedUsers(Kernel::HLERequestContext& ctx); |
| 38 | void LoadOpenContext(Kernel::HLERequestContext& ctx); | ||
| 39 | void ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx); | 38 | void ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx); |
| 40 | void StoreSaveDataThumbnailApplication(Kernel::HLERequestContext& ctx); | 39 | void StoreSaveDataThumbnailApplication(Kernel::HLERequestContext& ctx); |
| 41 | void StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& ctx); | 40 | void StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& ctx); |
diff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cpp index 65023b8c2..54844bfe7 100644 --- a/src/core/hle/service/acc/acc_u0.cpp +++ b/src/core/hle/service/acc/acc_u0.cpp | |||
| @@ -28,7 +28,7 @@ ACC_U0::ACC_U0(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager> | |||
| 28 | {110, &ACC_U0::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, | 28 | {110, &ACC_U0::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, |
| 29 | {111, nullptr, "ClearSaveDataThumbnail"}, | 29 | {111, nullptr, "ClearSaveDataThumbnail"}, |
| 30 | {120, nullptr, "CreateGuestLoginRequest"}, | 30 | {120, nullptr, "CreateGuestLoginRequest"}, |
| 31 | {130, &ACC_U0::LoadOpenContext, "LoadOpenContext"}, // 5.0.0+ | 31 | {130, nullptr, "LoadOpenContext"}, // 5.0.0+ |
| 32 | {131, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 6.0.0+ | 32 | {131, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 6.0.0+ |
| 33 | {140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, // 6.0.0+ | 33 | {140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, // 6.0.0+ |
| 34 | {141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ | 34 | {141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ |
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 { | |||
| 261 | return last_opened_user; | 261 | return last_opened_user; |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | /// Gets the list of stored opened users. | ||
| 265 | UserIDArray ProfileManager::GetStoredOpenedUsers() const { | ||
| 266 | UserIDArray output{}; | ||
| 267 | std::ranges::transform(stored_opened_profiles, output.begin(), [](const ProfileInfo& p) { | ||
| 268 | if (p.is_open) | ||
| 269 | return p.user_uuid; | ||
| 270 | return Common::InvalidUUID; | ||
| 271 | }); | ||
| 272 | std::stable_partition(output.begin(), output.end(), | ||
| 273 | [](const UUID& uuid) { return uuid.IsValid(); }); | ||
| 274 | return output; | ||
| 275 | } | ||
| 276 | |||
| 277 | /// Captures the opened users, which can be queried across process launches with | ||
| 278 | /// ListOpenContextStoredUsers. | ||
| 279 | void ProfileManager::StoreOpenedUsers() { | ||
| 280 | size_t profile_index{}; | ||
| 281 | stored_opened_profiles = {}; | ||
| 282 | std::for_each(profiles.begin(), profiles.end(), [&](const auto& profile) { | ||
| 283 | if (profile.is_open) { | ||
| 284 | stored_opened_profiles[profile_index++] = profile; | ||
| 285 | } | ||
| 286 | }); | ||
| 287 | } | ||
| 288 | |||
| 264 | /// Return the users profile base and the unknown arbitary data. | 289 | /// Return the users profile base and the unknown arbitary data. |
| 265 | bool ProfileManager::GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile, | 290 | bool ProfileManager::GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile, |
| 266 | UserData& data) const { | 291 | UserData& data) const { |
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h index 135f7d0d5..993a5a57a 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h | |||
| @@ -86,6 +86,8 @@ public: | |||
| 86 | UserIDArray GetOpenUsers() const; | 86 | UserIDArray GetOpenUsers() const; |
| 87 | UserIDArray GetAllUsers() const; | 87 | UserIDArray GetAllUsers() const; |
| 88 | Common::UUID GetLastOpenedUser() const; | 88 | Common::UUID GetLastOpenedUser() const; |
| 89 | UserIDArray GetStoredOpenedUsers() const; | ||
| 90 | void StoreOpenedUsers(); | ||
| 89 | 91 | ||
| 90 | bool CanSystemRegisterUser() const; | 92 | bool CanSystemRegisterUser() const; |
| 91 | 93 | ||
| @@ -101,6 +103,7 @@ private: | |||
| 101 | bool RemoveProfileAtIndex(std::size_t index); | 103 | bool RemoveProfileAtIndex(std::size_t index); |
| 102 | 104 | ||
| 103 | std::array<ProfileInfo, MAX_USERS> profiles{}; | 105 | std::array<ProfileInfo, MAX_USERS> profiles{}; |
| 106 | std::array<ProfileInfo, MAX_USERS> stored_opened_profiles{}; | ||
| 104 | std::size_t user_count{}; | 107 | std::size_t user_count{}; |
| 105 | Common::UUID last_opened_user{}; | 108 | Common::UUID last_opened_user{}; |
| 106 | }; | 109 | }; |