Files
PS5_RetroArch/tooling/webui/dump-options.cpp
T
Mihawk cf649dd5d7 Add guided WebUI settings for every included core except RPCS3
Expose 846 options from 15 pinned PS5 core catalogs before first use,
with categories, descriptions, exact choices, saved-value preservation,
and Advanced mode. Include installed cores without saved profiles and
preserve first-use PPSSPP/Dolphin edits through their profile migration.
Bind dynamic runtime options to the catalog and core binary revision.

Validation: all five tools/verify.sh gates pass (96 tests), all 15 core
browser checks pass, and the deployed native menu-only run exposes all
846 catalog keys with matching JSON, build identity and normal return.
Restore original settings and stop the temporary helper after testing.

Evidence: evidence/webui-settings-guide/{capture,expectation}.json
Reproduce: python3 tools/evidence.py compare evidence/
Raw native record: klog/webui-guide/all-cores-20261002-130144/report.json
2026-10-02 13:06:01 -04:00

47 lines
1.8 KiB
C++

// Host-only serialization of the same option tables compiled into each core.
#include <cstdio>
#include <string>
#include <libretro.h>
static std::string quoted(const char *value)
{
std::string out = "\"";
for (const unsigned char c : std::string(value ? value : ""))
{
if (c == '"' || c == '\\')
out += '\\';
if (c < 32)
{
char escape[7];
std::snprintf(escape, sizeof escape, "\\u%04x", c);
out += escape;
}
else
out += c;
}
return out + '"';
}
static void dump(const retro_core_option_v2_category *cats,
const retro_core_option_v2_definition *defs)
{
std::printf("{\"categories\":[");
for (auto *c = cats; c && c->key; ++c)
std::printf("%s{\"key\":%s,\"label\":%s,\"description\":%s}", c == cats ? "" : ",",
quoted(c->key).c_str(), quoted(c->desc).c_str(), quoted(c->info).c_str());
std::printf("],\"settings\":[");
for (auto *s = defs; s->key; ++s)
{
std::printf("%s{\"key\":%s,\"label\":%s,\"description\":%s,\"category\":%s,\"default\":%s,"
"\"choices\":[",
s == defs ? "" : ",", quoted(s->key).c_str(),
quoted(s->desc_categorized ? s->desc_categorized : s->desc).c_str(),
quoted(s->info_categorized ? s->info_categorized : s->info).c_str(),
quoted(s->category_key).c_str(), quoted(s->default_value).c_str());
for (size_t i = 0; i < RETRO_NUM_CORE_OPTION_VALUES_MAX && s->values[i].value; ++i)
std::printf(
"%s[%s,%s]", i ? "," : "", quoted(s->values[i].value).c_str(),
quoted(s->values[i].label ? s->values[i].label : s->values[i].value).c_str());
std::printf("]}");
}
std::puts("]}");
}