[XAM] Store XGI contexts

This commit is contained in:
Gliniak
2023-12-23 22:21:18 +01:00
parent a246c81e3b
commit eb2298c412
2 changed files with 14 additions and 0 deletions

View File

@@ -53,6 +53,11 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
title_xdbf.GetStringTableEntry(title_language, context.string_id); title_xdbf.GetStringTableEntry(title_language, context.string_id);
XELOGD("XGIUserSetContextEx: {} - Set to value: {}", desc, XELOGD("XGIUserSetContextEx: {} - Set to value: {}", desc,
context_value); 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; return X_E_SUCCESS;
} }
@@ -155,6 +160,13 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
context_ptr, context_id); context_ptr, context_id);
uint32_t value = 0; uint32_t value = 0;
if (context) { 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<uint32_t>(context + 4, value); xe::store_and_swap<uint32_t>(context + 4, value);
} }
return X_E_FAIL; return X_E_FAIL;

View File

@@ -232,6 +232,8 @@ class UserProfile {
void AddSetting(std::unique_ptr<Setting> setting); void AddSetting(std::unique_ptr<Setting> setting);
Setting* GetSetting(uint32_t setting_id); Setting* GetSetting(uint32_t setting_id);
std::map<uint32_t, uint32_t> contexts_;
private: private:
uint64_t xuid_; uint64_t xuid_;
std::string name_; std::string name_;