[XAM] Implemented SPA Stats Views

This commit is contained in:
Adrian
2025-11-02 18:54:42 +00:00
committed by Radosław Gliński
parent 4ebf8994de
commit 243178a310
7 changed files with 428 additions and 22 deletions

View File

@@ -7,6 +7,8 @@
******************************************************************************
*/
#include <ranges>
#include "xenia/emulator.h"
#include "config.h"
@@ -1538,7 +1540,7 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
entry.description, type,
fmt::format("{}", entry.gamerscore)});
}
XELOGI("-------------------- ACHIEVEMENTS --------------------\n{}",
XELOGI("\n-------------------- ACHIEVEMENTS --------------------\n{}",
table.str());
const std::vector<kernel::util::GameInfoDatabase::Property>
@@ -1555,7 +1557,7 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
table.add_row({fmt::format("{:08X}", entry.id), label,
fmt::format("{}", entry.data_size)});
}
XELOGI("-------------------- PROPERTIES --------------------\n{}",
XELOGI("\n-------------------- PROPERTIES --------------------\n{}",
table.str());
const std::vector<kernel::util::GameInfoDatabase::Context> contexts_list =
@@ -1573,9 +1575,46 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
fmt::format("{}", entry.default_value),
fmt::format("{}", entry.max_value)});
}
XELOGI("-------------------- CONTEXTS --------------------\n{}",
XELOGI("\n-------------------- CONTEXTS --------------------\n{}",
table.str());
const std::vector<kernel::util::GameInfoDatabase::StatsView> stats_views =
game_info_database_->GetStatsViews();
// 4D5307EA SPA contains a lot of stats, limit views to log.
const auto stats_views_limit = stats_views | std::views::take(100);
table = tabulate::Table();
table.format().multi_byte_characters(true);
table.add_row({"ID", "View Type", "Name", "Skilled", "Arbitrated",
"Hidden", "Team View", "Online Only"});
for (const kernel::util::GameInfoDatabase::StatsView& entry :
stats_views_limit) {
const std::string name =
string_util::remove_eol(string_util::trim(entry.view.name));
const std::string view_type =
kernel::xam::GetViewTypeName(entry.view.view_type);
table.add_row({fmt::format("{:08X}", entry.view.id), view_type, name,
entry.view.skilled ? "True" : "False",
entry.view.arbitrated ? "True" : "False",
entry.view.hidden ? "True" : "False",
entry.view.team_view ? "True" : "False",
entry.view.online_only ? "True" : "False"});
}
std::string totals;
if (stats_views.size() > stats_views_limit.size()) {
totals = fmt::format("\nViews: {}/{}", stats_views_limit.size(),
stats_views.size());
}
XELOGI("\n-------------------- Stats Views --------------------{}\n{}",
totals.c_str(), table.str());
auto icon_block = game_info_database_->GetIcon();
if (!icon_block.empty()) {
display_window_->SetIcon(icon_block.data(), icon_block.size());