[XAM] Implemented SPA XRPT

This commit is contained in:
Adrian
2025-11-19 12:41:32 +00:00
committed by Radosław Gliński
parent 605bfd0e72
commit d915dd808d
6 changed files with 192 additions and 1 deletions

View File

@@ -102,6 +102,7 @@ GameInfoDatabase::Context GameInfoDatabase::GetContext(
context.default_value = xdbf_context->default_value;
context.max_value = xdbf_context->max_value;
context.is_system = xam::UserData::is_system_property(xdbf_context->id);
context.is_presence = GetPresence().property_bag.contexts.contains(id);
context.description = GetLocalizedString(xdbf_context->string_id);
return context;
}
@@ -122,6 +123,7 @@ GameInfoDatabase::Property GameInfoDatabase::GetProperty(
property.id = xdbf_property->id;
property.data_size = xdbf_property->data_size;
property.is_system = xam::UserData::is_system_property(xdbf_property->id);
property.is_presence = GetPresence().property_bag.properties.contains(id);
property.description = GetLocalizedString(xdbf_property->string_id);
return property;
}
@@ -231,6 +233,41 @@ GameInfoDatabase::StatsView GameInfoDatabase::GetStatsView(
return stats_view;
}
GameInfoDatabase::Presence GameInfoDatabase::GetPresence() const {
Presence presence;
if (!is_valid_) {
return presence;
}
const auto xdbf_presence = spa_gamedata_->GetPresence();
presence.property_bag = GetPropertyBag(xdbf_presence->property_bag);
presence.presence_modes = GetPresenceModes();
return presence;
}
GameInfoDatabase::PresenceMode GameInfoDatabase::GetPresenceMode(
const uint32_t context_value) const {
PresenceMode presence_mode = {};
if (!is_valid_) {
return presence_mode;
}
const auto xdbf_presence_mode = spa_gamedata_->GetPresenceMode(context_value);
if (!xdbf_presence_mode.has_value()) {
return presence_mode;
}
presence_mode.context_value = context_value;
presence_mode.property_bag = GetPropertyBag(xdbf_presence_mode.value());
return presence_mode;
}
std::vector<uint32_t> GameInfoDatabase::GetMatchmakingAttributes(
const uint32_t id) const {
// TODO(Gliniak): Implement when we will fully understand how to read it from
@@ -378,6 +415,25 @@ std::vector<GameInfoDatabase::StatsView> GameInfoDatabase::GetStatsViews()
return stats_views;
}
std::vector<GameInfoDatabase::PresenceMode> GameInfoDatabase::GetPresenceModes()
const {
std::vector<PresenceMode> presence_modes;
if (!is_valid_) {
return presence_modes;
}
const auto& xdbf_presence_modes =
spa_gamedata_->GetPresence()->presence_modes;
for (uint32_t context_value = 0; context_value < xdbf_presence_modes.size();
context_value++) {
presence_modes.push_back(GetPresenceMode(context_value));
}
return presence_modes;
}
} // namespace util
} // namespace kernel
} // namespace xe