diff --git a/TCP_COMMANDS.md b/TCP_COMMANDS.md index a07020a9..27825b98 100644 --- a/TCP_COMMANDS.md +++ b/TCP_COMMANDS.md @@ -50,6 +50,7 @@ Columns: **N** = native, **D** = DuckStation oracle. | `read_scratch` | | ✓ | `addr`, `len` | Read PS1 scratchpad (0x1F800000 region) | | `read_vram` / `vram_peek` | ✓¹ | ✓ | `x`, `y`, `w`, `h` | Read 16-bit VRAM pixels (max 128×128) | | `gpu_state` | ✓ | ✓ | — | Display area, display depth, draw offset, GPUSTAT, clip rect, xfer state | +| `geom_correction` | | ✓ | — | `[video] geometry_correction` / `perspective_texturing` engagement: enable flag plus free-running `geometry_vertex_hits` and `perspective_triangles` totals. Both enhancements silently fall back to the faithful path on anything they cannot prove is projected geometry, so a zero counter with the flag on means the title never qualifies — sample twice and diff for a rate | | `sio_state` | ✓ | ✓ | — | SIO registers + (native only) pad/memcard protocol + TX/RX history | | `irq_state` | ✓ | ✓ | — | `I_STAT`, `I_MASK` (both), plus chain state on native | | `dma_state` | ✓ | ✓ | — | DPCR, DICR, all 7 channel states (madr/bcr/chcr) | diff --git a/runtime/src/debug_server.c b/runtime/src/debug_server.c index ff6ad416..21a81259 100644 --- a/runtime/src/debug_server.c +++ b/runtime/src/debug_server.c @@ -4874,6 +4874,28 @@ static void handle_write_ram(int id, const char *json) send_ok(id); } +/* geom_correction — is [video] geometry_correction / perspective_texturing + * actually doing anything on THIS title? + * + * Both enhancements are silent no-ops on content they cannot prove is + * projected geometry: a vertex whose sub-pixel fraction was never cached, or a + * packet whose position words lack full GTE projection provenance, simply draws + * the faithful way. So "enabled" alone tells you nothing — these counters are + * how you tell an engaged correction from an inert one. Both are free-running + * totals; sample twice and diff for a per-window rate. */ +static void handle_geom_correction(int id, const char *json) +{ + (void)json; + send_fmt("{\"id\":%d,\"ok\":true," + "\"geometry_correction\":%d," + "\"geometry_vertex_hits\":%u," + "\"perspective_triangles\":%u}", + id, + gte_geometry_correction_enabled(), + (unsigned)gte_geometry_correction_hits(), + (unsigned)gpu_texture_correction_hits()); +} + static void handle_gpu_state(int id, const char *json) { (void)json; @@ -12603,6 +12625,7 @@ static const CmdEntry s_commands[] = { { "dump_ram", handle_read_ram }, /* alias: one request, one response */ { "write_ram", handle_write_ram }, { "gpu_state", handle_gpu_state }, + { "geom_correction", handle_geom_correction }, { "ws_aspect_cone_site", handle_ws_aspect_cone_site }, { "ws_margin", handle_ws_margin }, { "ws_hud_mode", handle_ws_hud_mode }, diff --git a/tools/debug_client.py b/tools/debug_client.py index 766d1732..243c5f49 100644 --- a/tools/debug_client.py +++ b/tools/debug_client.py @@ -220,6 +220,11 @@ def build_cmd(args): return {"cmd": "read_scratch", "addr": addr, "len": length}, pretty_json elif cmd == "gpu": return {"cmd": "gpu_state"}, pretty_json + elif cmd in ("geom", "geom_correction"): + # Are the [video] geometry_correction / perspective_texturing + # enhancements actually engaging on this title? Free-running totals; + # sample twice and diff for a per-window rate. + return {"cmd": "geom_correction"}, pretty_json elif cmd == "overlay": return {"cmd": "overlay_state"}, pretty_json elif cmd == "watch":