From 8003db07de1b291db97ab1f2672ffb5a19bb94a7 Mon Sep 17 00:00:00 2001 From: Shokunin <30949000+tetrisgm@users.noreply.github.com> Date: Thu, 22 Oct 2026 10:55:28 -0700 Subject: [PATCH] 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 --- runtime/src/debug_server.c | 20 ++++++++++++++++++++ runtime/src/main.cpp | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/runtime/src/debug_server.c b/runtime/src/debug_server.c index af45cb55..e2630733 100644 --- a/runtime/src/debug_server.c +++ b/runtime/src/debug_server.c @@ -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 }, diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index 979bf95f..22860cae 100644 --- a/runtime/src/main.cpp +++ b/runtime/src/main.cpp @@ -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;