Live resolution: keep the legacy factor as booted; video_set debug command

psx_video_current reported the live scale as the legacy supersampling
factor, so a second live change looked like a legacy edit and asked for
a relaunch. Report the boot value. Debug-tools builds gain video_set
(internal_resolution, supersample) to drive the live path in tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shokunin
2026-10-22 10:55:28 -07:00
parent 0aa83bac8c
commit 8003db07de
2 changed files with 23 additions and 1 deletions
+20
View File
@@ -10630,6 +10630,25 @@ static void handle_dynres_check(int id, const char *json)
"\"restored\":%d,\"steps\":%s}", id, (unsigned long long)h0, bad, start, out);
}
/* {"cmd":"video_set","internal_resolution":N,"supersample":M} - change the
* Internal resolution preset (lines, 1 native, -1 match display) and/or the
* supersample (thousandths) through the in-game menu's live path. Returns the
* restart bits the change still needs (0 = fully live). */
static void handle_video_set(int id, const char *json)
{
extern void psx_video_current(PsxHostVideoSettings *v);
extern unsigned psx_video_apply_live(const PsxHostVideoSettings *next);
PsxHostVideoSettings v;
psx_video_current(&v);
const int ir = json_get_int(json, "internal_resolution", 0);
const int ss = json_get_int(json, "supersample", 0);
if (ir) v.internal_resolution = ir;
if (ss) v.supersample_milli = ss;
const unsigned restart = psx_video_apply_live(&v);
send_fmt("{\"id\":%d,\"ok\":true,\"restart\":%u,\"internal_resolution\":%d,"
"\"supersample\":%d}\n", id, restart, v.internal_resolution, v.supersample_milli);
}
static void handle_video_info(int id, const char *json)
{
(void)json;
@@ -16446,6 +16465,7 @@ static const CmdEntry s_commands[] = {
{ "dump_buffer", handle_dump_buffer },
{ "wide_full", handle_wide_full },
{ "video_info", handle_video_info },
{ "video_set", handle_video_set },
{ "hd_textures", handle_hd_textures },
{ "dynres", handle_dynres },
{ "dynres_force", handle_dynres_force },
+3 -1
View File
@@ -10254,7 +10254,9 @@ extern "C" void psx_video_current(PsxHostVideoSettings *v) {
v->frame_generation = g_frame_generation ? 1 : 0;
v->renderer = g_video_renderer;
v->internal_resolution = g_video_internal_res;
v->supersampling = g_video_scale;
/* The legacy factor as booted: the live scale moves with the internal
* resolution and supersample, which apply without a relaunch. */
v->supersampling = g_video_boot_valid ? g_video_boot.supersampling : g_video_scale;
v->render_thread = g_render_thread ? 1 : 0;
v->present_thread = g_present_thread ? 1 : 0;
v->supersample_milli = g_video_ss_milli;