Commit Graph

390 Commits

Author SHA1 Message Date
Matthew Stanley 699cc5bb3e Merge commit 'cb8a2e617dd5edbe1dc3dafbfc82f1a48bf3d6f6' into integrate/pr558plus-fixes-20261008
# Conflicts:
#	docs/TCP_COMMANDS.md
#	generated/OpenBIOS.emitter.sha
#	runtime/src/main.cpp
2026-10-08 11:00:25 -07:00
Shokunin 14feec22bf post_aa debug command: time the pass (PSX_POST_AA_TIME=N)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 02:40:10 -07:00
Shokunin 976da1a812 Opt-in post-process anti-aliasing (FXAA) and a supersample factor
[video] antialiasing_mode = "off" | "fxaa" | "fxaa_hq" (PSX_AA_MODE)
filters the composed game image after the game quad and before hold-last
capture, OSD and swap; guest VRAM, readbacks and the Smooth motion /
frame generation sources are untouched. Off (default) never runs the pass
and is byte-identical to master.

[video] supersample = 1.0..4.0 (PSX_SUPERSAMPLE) multiplies the internal-
resolution target (Match display or a line preset), so the existing area
resolve does ordered-grid SSAA; dynamic resolution takes it as its ceiling.

Debug server: post_aa reads/sets the mode live. Real-GL fixture
gl_post_aa_test; supersample checks in test_internal_resolution.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 02:39:59 -07:00
Shokunin a0cf9197f0 Debug-tools builds: live rendering A/B keys
PSX_DEBUG_TOOLS builds only (PSX_DEBUG_TOGGLES=0 turns them off). Keys flip one
rendering feature while the game runs and show the state on the OSD: 1 scale,
2 dynamic resolution, 3 widescreen, 4 Smooth motion, 5 texture filter,
6 wide mirror, 7 geometry correction, 8 perspective texturing, 0 summary,
9 PGXP depth, F10 PGXP colour, F11 PGXP seam, F12 PGXP CPU mode. The
debug_key TCP command presses one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 02:39:56 -07:00
Shokunin b0a89e4ede Smooth motion: in-between frames by reprojecting the real frame
Each in-between frame warps the newer real frame's finished image by the
in-between camera instead of drawing the scene again:
- per game frame: a snapshot of the list's finished image (taken when the
  list closes; R4 flips to a buffer before drawing into it, so the live
  surface is not a stable source) and a 2x native image of camera 1/z,
  pixel kind and view rasterized from the recorded triangles in painter
  order (world / car-or-dome / 2D-HUD-small-view);
- per in-between frame: one grid draw (a vertex per native pixel) that
  unprojects world pixels with their depth, moves them by the view's
  in-between camera (fg_view_affine) and samples the snapshot at full
  resolution, nearest wins; cells over depth edges or non-world pixels are
  left to the snapshot underneath; 2D/HUD pixels are put back; cars are
  drawn again at their own in-between position.
Measured: ~0.3-0.8 ms CPU and ~0.3-2 ms GPU per in-between frame (was 2-4
ms each), A/G/B max out-of-range 0.3-3 %, worst ratio 1.1-1.5.
[video] frame_generation_redraw / PSX_FRAME_GEN_REDRAW=1 keeps the old path.
Planner/holds: dynres 'over budget' no longer stops cheap reprojected
frames; guest-late trips ignored while they are cheap; allocation and
shader compilation are kept out of the cost estimate. frame_gen JSON:
rp_ms, rp_zn, reprojected, np (why a flip planned none); debug buffer 4 KiB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 02:39:42 -07:00
Shokunin dc2cd301d3 PGXP depth: no cost when off; render-thread-safe setters; Smooth motion honours depth
- gpu.c sends gr_set_depth_triangle only while a PGXP renderer feature is
  on (gl_renderer_pgxp_render_wanted): no RTH_DEPTH per triangle otherwise.
- The SZ rides in the textured vertex's unused colour alpha, so TEXV stays
  26 floats for every title.
- gl_renderer_set_pgxp_depth / _threshold / pgxp_render_stats sync with a
  live render thread (GL_RT_SYNC) like their neighbours.
- A depth-mode change is its own batch-break reason (7); batch_diag returns
  all eight reasons.
- Smooth-motion in-between frames replay RTH_DEPTH and test depth from
  their own clear; gl_frame_gen_test gains a PGXP pass (overlapping 3D
  triangles out of painter order) where the in-between frame must match
  the real one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 02:38:58 -07:00
Matthew Stanley 9032b1005e Always-on host CPU sampler ring (TCP host_profile)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 0901bb8b1e)
2026-10-07 18:20:58 -07:00
Matthew Stanley dd64bc6611 TCP input injection for port 2 (set_input/press/clear_input port=2)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 66cc81fe63)
2026-10-07 18:20:57 -07:00
Matthew Stanley 4b4fddb769 Present finite 2D backdrop scenes at 4:3 in native-wide
A full-screen rect backdrop that stops short of the reveal vetoes polygon overhang (Tomba village, beads-eio.4.28).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 17:46:17 -07:00
Matthew Stanley b620b13837 Integrate current framework master without dropping texture fixes 2026-10-07 14:39:05 -07:00
Matthew Stanley ed398cc37e Improve DuckStation texture capture and replacement fidelity 2026-10-07 13:40:57 -07:00
Shokunin 9de4f3febd Call frame generation "Smooth motion" in user-visible text
Log lines and doc headings say "Smooth motion (frame generation)", the
player-facing name. Config key [video] frame_generation and PSX_FRAME_GEN
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 12:58:38 -07:00
Shokunin 4f97482f8c Frame generation on the render thread from recorded draw lists
[video] frame_generation (opt-in, with render_thread): the render thread keeps
each game frame's replayed draw list, matches the triangles of the last two
(frame_gen.c), and presents in-between frames at the display refresh by
redrawing the newer list into separate surfaces with matched vertices
interpolated. It never runs guest code. Real frames are composed at their
flip and presented after the generated ones, with the same pixels and
order. Generation uses only measured surplus: a plan from render-thread CPU,
generated-frame cost and swap time, a breaker after backpressure or late
guest frames, and a pause while dynamic resolution is over budget. The
render-thread core gains a timed tick hook. Frame-cost queries pause around
generation, so dynamic resolution measures real frames only.

Tests: frame_gen_test, render_thread_test (tick), gl_frame_gen_test (real
frames identical off/on; phase 0/1 equal the endpoints). Docs:
docs/FRAME_GENERATION.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 12:53:09 -07:00
Shokunin af0e6a0472 Frontend: [video] render_thread option, vblank boundary, render_thread command
[video] render_thread (default false; PSX_RENDER_THREAD=0/1 overrides,
PSX_RENDER_THREAD_FRAMES bounds frames in flight, default 2) starts the
OpenGL render thread at the first vblank, after the context and every
startup GL call exist. Each vblank then closes a frame right after its
present and before wall-clock pacing, so the render thread draws while
the guest waits. Netplay, frame interpolation, Vulkan and software keep
the synchronous path.

TCP: render_thread reports records, frames produced/consumed, presents
and stale presents skipped, sync points with their recent reasons,
backpressure and render busy time. Display-ring and present-image-ring
readers sync first (the render thread fills them).

config_loader is a BIOS emitter input: OpenBIOS fingerprint regenerated
(tools/regen_bios.sh --config bios/OpenBIOS.toml; the C is unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 12:49:42 -07:00
Shokunin ecbbb5eceb Add the opt-in dynamic resolution controller, config and telemetry
A step controller (dynamic_resolution.c) lowers or raises the GL internal scale from frame-time telemetry between a floor and the configured ceiling; off unless a title or the player enables it. Tested by dynamic_resolution_test (synthetic load) and the real-GL gl_scale_invariance_test step modes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 12:44:59 -07:00
Matthew Stanley 3a11aea16d Refresh netplay validation against master retaining audited startup cache and local views 2026-10-07 11:59:16 -07:00
Matthew Stanley 7d0a18ebc6 Integrate netplay pad and own-view stack without dropping current-master behavior
Preserve negotiated content and dual-raster pass gates. Retain both fixture assertion sets and HD-off seams. Regenerate both BIOS with actual native emitter. Fix type-only rollback corrections and exclude extra-pad changes from digital-only promote gates.
2026-10-07 11:06:57 -07:00
Matthew Stanley ee140c9519 Merge reviewed sky scheduler opt-in (PR552) 2026-10-07 10:48:55 -07:00
Matthew Stanley a99ad54763 Merge reviewed host launch timing scopes (PR551)
# Conflicts:
#	runtime/src/mod_runtime.cpp
2026-10-07 10:48:55 -07:00
Matthew Stanley c6b089b896 Combine controller stack with validated PGXP fixes and current master; regenerate both BIOS backends 2026-10-07 10:01:37 -07:00
Matthew Stanley bceadc6124 Add DuckStation-compatible texture pack mod and gameplay dumping
Load modern texpage/texupload PNG replacements independently of DuckStation source. Integrate pack folders and options with mods, preserve native VRAM, and validate GL rendering, format matching, dump safety, and upload invalidation.
2026-10-06 23:24:47 -07:00
Matthew Stanley e4b6ddc99a Require measured host credit before admitting render replay 2026-10-06 23:03:48 -07:00
Matthew Stanley 8ba237ccf5 Retain host launch and mod commit stage timings for TCP diagnostics 2026-10-06 22:46:05 -07:00
Shokunin 5f72282fa5 Merge remote-tracking branch 'origin/feat/title-rewind-block' into feat/netplay-input-transform
# Conflicts:
#	generated/OpenBIOS.emitter.sha
#	runtime/src/debug_server.c
2026-10-06 19:37:46 -07:00
Shokunin 6f62f560bf netplay: input transforms stay per player online; rollback rows carry rx/ry
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 19:37:35 -07:00
Shokunin 12c5512218 Merge remote-tracking branch 'origin/feat/pad-transform-stage' into feat/netplay-input-transform 2026-10-06 19:35:45 -07:00
Matthew Stanley d66401751e Integrate controller input stack for review with current command index and both BIOS backends 2026-10-06 19:21:51 -07:00
Matthew Stanley f9c7bb0a1c PGXP: carry precision through GTE-as-multiplier arithmetic and lwl/lwr word copies
Fixes Ape Escape terrain seams: CPU-built subdivision midpoints and lwl/lwr-copied
grid corners drew native next to precise neighbours. Adds pgxp_tri_ring/pgxp_store_ring.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 13:35:43 -07:00
Shokunin f379771c93 netplay: let a title present its own sandboxed local view
psx_mod_render_local_view() runs a title's draw code in the render-pass
sandbox on a forward netplay frame and keeps the drawn display rect in the
OpenGL presenter's surface only. The authoritative CPU VRAM, guest RAM,
rollback snapshots and digests keep the canonical frame; the presenter shows
this peer's own image. A committed image cancels any local-view crop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 11:24:17 -07:00
Shokunin 3654593e16 Add a rewind_status debug command
Reports whether local Rewind is enabled and open, the title block
(psx_mod_set_rewind_blocked) and the snapshots held, so scripted headless runs
can check that a blocked title captures no history and refuses to open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 23:49:55 -07:00
Matthew Stanley 96b2c05c27 Drain queued world batches before wide overlays, bound forced replay spans, sequence presented images
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 23:33:30 -07:00
Matthew Stanley ddd903014f Keep resident packs in memory when the cache is unwritable and record adapter requests in an always-on ring
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 22:52:52 -07:00
Matthew Stanley a734cd9034 Record GPU list CPU holds, per-source exception cycles and recent C0 readbacks in always-on rings
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 22:52:52 -07:00
Matthew Stanley d7fb33eb85 Add opt-in CD-DA playlists, media preparers, netplay render passes, hidden OpenGL headless and netplay_status
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 22:52:51 -07:00
Shokunin 91d780bc0a Let a title claim a direct host shortcut; add a debug host-pad layer
psx_mod_allow_direct_shortcut(PSX_MOD_SHORTCUT_*) lets a host shortcut
bound to one controller button act on that button alone. Without it a
one-button binding means Select + button, like the legacy encoding, so a
title can default to a one-button binding safely whether or not its mod is
enabled. While allowed (Rewind: while Rewind is enabled) the runtime claims
the host button: it never reaches P1's guest pad, and a claim made while it
is held lasts until release. Allowances clear at every mod session start.
Multi-button bindings behave as before.

game.toml [controller] direct_shortcut / direct_shortcut_button lets the
title default that shortcut to one button and tells the launcher to capture
it as one button (RECOMP_LAUNCHER_HAS_DIRECT_ASSIST_BIND). No title id is
checked anywhere.

Debug: set_input {"layer":"host", buttons, lx..ry, lt, rt} arms a
virtual P1 gamepad that feeds stage 1 of the offline input path (so sources,
title transforms and trigger values see it) and shortcut polling. A plain
set_input override still wins. Headless runs with the layer armed resolve
P1 through the same path and poll Rewind and the fast-forward latch; the
Rewind pause loop keeps the debug endpoint live and runs without a window.

Binding semantics and the claim latch are pure (psx_hotkey_pad.h) and
covered by psx_hotkey_pad_test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 20:25:17 -07:00
Matthew Stanley d247ce8b88 Add opt-in netplay local viewport width sites, fixed aspect and native-wide per-camera views
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 20:20:18 -07:00
Shokunin ca82734bb8 sio: add the NeGcon (0x23) controller type
SIO_PAD_NEGCON = 3 presents a Namco NeGcon (NPC-101): poll ID 0x23 with
buttons, twist (left X), then analog I, II and L (Mednafen negcon.cpp).
sio_set_pad_negcon() supplies I/II/L per frame like the sticks. The device
has no config mode: any command but 0x42 gets the ID byte with no ACK, and
game bytes in a poll drive no motors. Multitap seats stay digital unless the
analog-on-tap hack is armed; the bulk status block carries the NeGcon frame.

Entering or leaving NeGcon is a device swap, not the DualShock analog
button: a deferred request applies even while the game holds the 0x44 mode
lock, and the swap clears the lock, config latch and motor map. Requests
raised mid-config still wait for config exit.

0x44 now selects the analog mode of the device in the port: a JogCon the
game set to digital returns as a JogCon instead of becoming a DualShock.
The mode lock and that device are guest state, so they join the snapshot
as an appended section (older snapshots still load, unlocked).
pad_status reports negcon and mode_locked per slot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 19:25:38 -07:00
Shokunin 2388a5ff7f Merge remote-tracking branch 'origin/master' into feat/jogcon-controller
# Conflicts:
#	runtime/src/main.cpp
2026-10-05 14:51:54 -07:00
Matthew Stanley 78da432f1e Merge origin/master into pr497
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-05 13:39:19 -07:00
Matthew Stanley 9c88657abc Merge remote-tracking branch 'origin/master' into landtmp/496
# Conflicts:
#	docs/TCP_COMMANDS.md
#	runtime/runtime.cmake
2026-10-05 13:24:20 -07:00
Matthew Stanley 96375896de Merge remote-tracking branch 'origin/master' into landtmp/493 2026-10-05 13:23:22 -07:00
Matthew Stanley 0da8c607b4 Merge remote-tracking branch 'origin/master' into landtmp/492
# Conflicts:
#	docs/TCP_COMMANDS.md
2026-10-05 13:23:03 -07:00
Shokunin 1424727444 Add deterministic debug pad selection at boot 2026-10-05 13:14:10 -07:00
Shokunin b44c72349d Test JogCon steering, hotplug and live input 2026-10-05 12:57:31 -07:00
Matthew Stanley c20a32fa2d Merge land/pr493 into land/pr496 2026-10-05 10:12:14 -07:00
Matthew Stanley 091fb61d13 Merge land/pr490 into land/pr491
# Conflicts:
#	docs/TCP_COMMANDS.md
2026-10-05 10:11:45 -07:00
Matthew Stanley e1673a52f2 Merge land/pr492 into land/pr493 2026-10-05 10:11:34 -07:00
Matthew Stanley 8bb46116ec Merge origin/master into land/pr490
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-05 10:11:10 -07:00
Matthew Stanley 4a276ef0a2 Merge origin/master into land/pr492 2026-10-05 10:11:09 -07:00
Yves a8d859f38b Match encoded desktop colors in OpenXR gameplay and native copies 2026-10-05 23:15:48 +08:00