diff --git a/src/xenia/kernel/xam/apps/xgi_app.cc b/src/xenia/kernel/xam/apps/xgi_app.cc index ae85f0a9aa..1c06f61bbd 100644 --- a/src/xenia/kernel/xam/apps/xgi_app.cc +++ b/src/xenia/kernel/xam/apps/xgi_app.cc @@ -493,10 +493,46 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, const std::string desc = title_xdbf.GetStringTableEntry( title_language, property_xdbf.string_id); - Property property = Property(XGISetPropertyBuffer->property_id, - XGISetPropertyBuffer->data_size, - memory_->TranslateVirtual( - XGISetPropertyBuffer->data_address)); + // 58410821 & 58410AC2 use input size smaller than expected + if (XGISetPropertyBuffer->data_size != property_xdbf.data_size) { + XELOGD("Property 0x{:08X} Input Size: {} Expected Size {}!", + XGISetPropertyBuffer->property_id.get(), + XGISetPropertyBuffer->data_size.get(), + property_xdbf.data_size.get()); + } + + const AttributeKey attribute = + static_cast(XGISetPropertyBuffer->property_id); + + const X_USER_DATA_TYPE property_type = + static_cast(attribute.type); + + uint32_t property_size = property_xdbf.data_size; + + switch (property_type) { + case xe::X_USER_DATA_TYPE::CONTEXT: + case xe::X_USER_DATA_TYPE::INT32: + case xe::X_USER_DATA_TYPE::FLOAT: + property_size = sizeof(uint32_t); + break; + case xe::X_USER_DATA_TYPE::INT64: + case xe::X_USER_DATA_TYPE::DOUBLE: + case xe::X_USER_DATA_TYPE::DATETIME: + property_size = sizeof(uint64_t); + break; + case xe::X_USER_DATA_TYPE::WSTRING: + case xe::X_USER_DATA_TYPE::BINARY: + property_size = XGISetPropertyBuffer->data_size; + break; + } + + // 58410821 + // Properties are ad-hoc therefore should be updated on backend, only + // update if value changed to reduce POST requests. + Property property = + Property(XGISetPropertyBuffer->property_id, property_size, + memory_->TranslateVirtual( + XGISetPropertyBuffer->data_address)); auto user_profile = kernel_state_->xam_state()->GetUserProfile( XGISetPropertyBuffer->user_index); diff --git a/src/xenia/kernel/xam/user_profile.cc b/src/xenia/kernel/xam/user_profile.cc index d7ef71d75f..83ac4c16fa 100644 --- a/src/xenia/kernel/xam/user_profile.cc +++ b/src/xenia/kernel/xam/user_profile.cc @@ -164,7 +164,7 @@ UserProfile::UserProfile(uint64_t xuid, X_XAMACCOUNTINFO* account_info) Property GAMER_SIGMA = Property(X_PROPERTY_GAMER_SIGMA, sizeof(uint64_t), reinterpret_cast(&gamer_sigma)); - AddProperty(&PUID); // Required + AddProperty(&PUID); // Required - 58410AC2 sets this manually AddProperty(&GAMER_HOST_NAME); // Required AddProperty(&GAMER_NAME); AddProperty(&GAMER_ZONE); diff --git a/src/xenia/kernel/xsession.cc b/src/xenia/kernel/xsession.cc index 95b57cd843..8a0982b6db 100644 --- a/src/xenia/kernel/xsession.cc +++ b/src/xenia/kernel/xsession.cc @@ -166,6 +166,9 @@ X_RESULT XSession::CreateHostSession(XSESSION_INFO* session_info, XELOGI("Creating xbox live session"); session_id_ = GenerateSessionId(XNKID_ONLINE); + // 58410821 adds properties after session creation + // Properties are ad-hoc therefore should be updated on backend, only + // update if value changed to reduce POST requests. XLiveAPI::XSessionCreate(session_id_, session_data); XLiveAPI::SessionPropertiesAdd(session_id_, properties_); }