From eb2298c41226d43d8cd8a1c33a466d8b75350536 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Sat, 23 Dec 2023 22:21:18 +0100 Subject: [PATCH] [XAM] Store XGI contexts --- src/xenia/kernel/xam/apps/xgi_app.cc | 12 ++++++++++++ src/xenia/kernel/xam/user_profile.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/xenia/kernel/xam/apps/xgi_app.cc b/src/xenia/kernel/xam/apps/xgi_app.cc index 1b850e8bb..b15e3c459 100644 --- a/src/xenia/kernel/xam/apps/xgi_app.cc +++ b/src/xenia/kernel/xam/apps/xgi_app.cc @@ -53,6 +53,11 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, title_xdbf.GetStringTableEntry(title_language, context.string_id); XELOGD("XGIUserSetContextEx: {} - Set to value: {}", desc, context_value); + + UserProfile* user_profile = kernel_state_->user_profile(user_index); + if (user_profile) { + user_profile->contexts_[context_id] = context_value; + } } return X_E_SUCCESS; } @@ -155,6 +160,13 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, context_ptr, context_id); uint32_t value = 0; if (context) { + UserProfile* user_profile = kernel_state_->user_profile(user_index); + if (user_profile) { + if (user_profile->contexts_.find(context_id) != + user_profile->contexts_.cend()) { + value = user_profile->contexts_[context_id]; + } + } xe::store_and_swap(context + 4, value); } return X_E_FAIL; diff --git a/src/xenia/kernel/xam/user_profile.h b/src/xenia/kernel/xam/user_profile.h index 0d0d001ca..d0dd85882 100644 --- a/src/xenia/kernel/xam/user_profile.h +++ b/src/xenia/kernel/xam/user_profile.h @@ -232,6 +232,8 @@ class UserProfile { void AddSetting(std::unique_ptr setting); Setting* GetSetting(uint32_t setting_id); + std::map contexts_; + private: uint64_t xuid_; std::string name_;