[XAM] Implemented SPA XMAT

This commit is contained in:
Adrian
2025-11-08 15:28:18 +00:00
committed by Radosław Gliński
parent 520353e95a
commit 6783bea223
5 changed files with 59 additions and 3 deletions

View File

@@ -25,6 +25,7 @@ void SpaInfo::Load() {
LoadProperties();
LoadContexts();
LoadPresenceModes();
LoadMatchmaking();
LoadStatsViews();
}
@@ -329,6 +330,41 @@ void SpaInfo::LoadPresenceModes() {
}
}
void SpaInfo::LoadMatchmaking() {
auto matchmaking_schema =
GetEntry(static_cast<uint16_t>(SpaSection::kMetadata), kXdbfIdXmat);
if (!matchmaking_schema) {
return;
}
auto xrpt_head = reinterpret_cast<const XdbfSectionHeader*>(
matchmaking_schema->data.data());
assert_true(xrpt_head->magic == kXdbfSignatureXmat);
assert_true(xrpt_head->version == 1);
auto xpbm_head = reinterpret_cast<const XdbfSectionHeader*>(xrpt_head + 1);
assert_true(xpbm_head->magic == kXdbfSignatureXpbm);
assert_true(xpbm_head->version == 1);
const PropertyBagEntry* property_bag_header_ptr =
reinterpret_cast<const PropertyBagEntry*>(xpbm_head + 1);
auto contexts_ptr =
reinterpret_cast<const xe::be<uint32_t>*>(property_bag_header_ptr + 1);
auto properties_ptr = reinterpret_cast<const xe::be<uint32_t>*>(
contexts_ptr + property_bag_header_ptr->contexts_count);
for (uint32_t i = 0; i < property_bag_header_ptr->contexts_count; i++) {
matchmaking_.contexts.insert(contexts_ptr[i]);
}
for (uint32_t i = 0; i < property_bag_header_ptr->properties_count; i++) {
matchmaking_.properties.insert(properties_ptr[i]);
}
}
const uint8_t* SpaInfo::ReadXLast(uint32_t& compressed_size,
uint32_t& decompressed_size) {
auto xlast_table =

View File

@@ -297,6 +297,8 @@ class SpaInfo : public XdbfFile {
const PresenceTableEntry* GetPresence() const { return &presence_; }
const PropertyBag* GetMatchCollection() const { return &matchmaking_; }
const XdbfContextTableEntry* GetContext(uint32_t id);
const XdbfPropertyTableEntry* GetProperty(uint32_t id);
const std::optional<ViewTable> GetStatsView(uint32_t id);
@@ -328,6 +330,7 @@ class SpaInfo : public XdbfFile {
std::vector<const XdbfPropertyTableEntry*> properties_;
std::vector<ViewTable> stats_views_;
PresenceTableEntry presence_;
PropertyBag matchmaking_;
using XdbfLanguageStrings = std::map<uint16_t, std::string>;
@@ -342,8 +345,8 @@ class SpaInfo : public XdbfFile {
void LoadProperties();
void LoadStatsViews();
void LoadPresenceModes();
void LoadMatchmaking();
template <typename T>
static T GetSpaEntry(std::vector<T>& container, uint32_t id);