Commit Graph

111 Commits

Author SHA1 Message Date
Matthew Stanley ddbb979f18 fix: enable camera-plane clipping with native-wide projection correction 2026-10-10 00:48:17 -07:00
Matt Stanley cf5bf1c88a Merge pull request #608 from RetroPortingToolKit/feat/mod-host-rumble
Mod API: title-supplied host rumble (psx_mod_set_host_rumble)
2026-10-09 22:36:08 -07:00
Matt Stanley 16758c1e24 Merge pull request #604 from RetroPortingToolKit/codex/mod-internal-resolution
Support session-only internal resolution requests from graphics mods
2026-10-09 22:35:59 -07:00
Matthew Stanley 371a0a4396 Report the guest cycles an uncharged call executed
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 04:45:12 -07:00
Shokunin e52679771a Host rumble online: local port only, never during a resim
In a netplay match psx_mod_set_host_rumble now takes only this peer's own
guest port (psx_netplay_local_port) and drives this peer's input pad with
it; other ports and calls made while rolling back are ignored, so a
netplay = "host_output" plugin can report every port each tick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 23:44:30 -07:00
Shokunin ee56f79087 Mod API: title-supplied host rumble (psx_mod_set_host_rumble)
Some titles compute vibration for every pad but only send it over SIO to a
DualShock (R4 with a presented NeGcon). A trusted mod can now hand the runtime
DualShock motor values per seat; the host pad gets the louder of that and the
guest's SIO motors. Values lapse 8 VBlanks after the last call and are cleared
at every session reset, so nothing can stick on. Opt-in: no title that does
not call it changes. PSX_RUMBLE_TRACE now also logs headless.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 23:25:25 -07:00
Matthew Stanley 320d94869c Allow trusted graphics mods to request a session-only internal resolution 2026-10-08 21:33:46 -07:00
Shokunin 91cd6db705 guest_cycle_scale: one CPU charge for every tier, declarative gate, rollback
Review of #561. Guest time now has two entry points (psx_cycles.h): the
CPU charge psx_cpu_charge() (instruction base, load fudge/region/completion,
i-cache refills, BIOS HLE costs), which applies [timing] guest_cycle_scale,
and the unscaled device advance psx_advance_cycles() (DMA, idle skips,
mul/div and GTE deadline waits). The emitters' block-mode charges emit
psx_cpu_charge; overlay DLLs accumulate it raw and publish through the
cpu_charge callback (was advance_cycles, same slot) into the same host
function, so nothing is scaled at the DLL boundary. The batched
psx_cyc_charge path, the dirty-RAM interpreter, psx_cyc_readmem, i-cache
refills and bios_hle.c all charge through it. At scale 1 it is exactly
psx_advance_cycles.

Gate in psxrecomp: [timing] guest_cycle_scale_gate, RAM predicates judged
at every VBlank edge (deterministic, works online, no mod needed), plus
psx_mod_set_guest_cycle_scale_gate() in mod_plugins.h for custom logic or
to tie the scale to a mod (guest_cycle_scale_gated = true; every mod
session reset shuts it). The carried fraction and both gate states are a
boot_state section (BS_SEC_GCS, written only when the scale is not 1), so
savestates and the netplay rollback snapshot re-simulate the same cycles.
psx_guest_cycle_scale_gate_test pins tier identity, the gates and rollback
re-simulation against the real psx_cycles.c.

OpenBIOS regenerated (emitter stamp); retail SCPH1001 is not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 21:41:39 -07:00
Matthew Stanley c55ddc4f29 Widescreen HUD size: proportional option shrinks the auto-UI HUD beyond 16:9
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 41a9889566)
2026-10-07 18:20:59 -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 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 d5d9a65889 Integrate current master retaining strict GP0 fixture guards 2026-10-07 09:55:51 -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
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 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 85d4888352 Merge commit 'refs/review/20261006/pr506' into review/pr502-wave-20261006 2026-10-06 19:04:48 -07:00
Shokunin 33b842e97f netplay: per-player own-view mods, widescreen only inside the local view
A [[plugin]] may declare netplay = "local_view": it only changes what one
player sees. A netplay session now keeps the player's own features whose every
contribution is such a plugin (no writes, overlays or derived discs) instead of
clearing them, without saving state.toml. They activate as usual, but their
hooks run only inside psx_mod_render_local_view (psx_mod_local_view_scope) and
their vblank/savestate callbacks not at all. With such a plan the widescreen
cull margin is the stock 0 in the shared game and this peer's own margin only
inside the sandboxed own-view draw; squash is not used. The canonical frame,
snapshots and digests stay identical on every peer whatever each player chose,
so nothing is negotiated, and each keeps their own aspect.

Tests: netplay_view_mods_test (flag, plan filter, parked hooks, no vblank,
state.toml untouched), ws_local_view_margin_test (margin scope), render-pass
sandbox asserts the scope around a local view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 14:17:26 -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
Matthew Stanley 49fe052a3e Add uncharged guest calls: run a guest function in zero guest time
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 09:53:08 -07:00
Shokunin 812465df58 Let a title block local Rewind (psx_mod_set_rewind_blocked)
A title calls psx_mod_set_rewind_blocked(1) while it is in a mode that must
not be rewound, such as local split-screen multiplayer, and 0 when it ends.
While blocked, opening Rewind is refused with an OSD note, no history is
captured (the ring keeps what it has; a capture already due is dropped and an
open panel closes unloaded), and a title-allowed direct Rewind shortcut is not
in force: its button is not claimed and reaches the guest pad / title
transform as if Rewind were off. Netplay already refuses Rewind on its own.
The block clears at every mod/session start, so a title that never calls it
is unchanged.

The direct-allowance decision (allowed, and for Rewind: enabled and not
blocked) is now one pure helper, psx_hotkey_direct_active, used for both the
claim and the shortcut press, so an unclaimed Rewind button is never a
one-button shortcut (with Rewind off it falls back to Select + button rather
than popping the "Rewind is off" note on every press).

Tests: psx_hotkey_pad_test covers the allowance and a block taking effect
mid-press; rewind_toggle_combo_test guards the capture/open gates and reset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 23:44:18 -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
Shokunin 82bc90dff2 Give a title pad transform the host pad of a digital-presented player
A digital presentation folds the sticks onto the D-pad and centres them,
so a transform on a digital player (the default for many titles) never
saw the stick. The transform decides what the guest sees, so for a
digital stage-1 pad with no controller source its frame is now the host
pad: real sticks and buttons without the stick->D-pad fold, type still
DIGITAL (new PadExtHooks.host_pad, capture_pad_slot_view). The output is
pre-filled with the stock pad and a decline delivers it, so pass-through
stays the stock folded digital bytes (mod_pad_transform_run takes the
stock pad). Analog pads, sources and guarded frames are unchanged.

Tests: pad_external_input_test (digital player: frame has the real lx and
unfolded buttons, decline and pass-through deliver the stock digital
bytes, no host-pad query for analog / guarded / source ports),
mod_pad_transform_test (decline returns the stock pad, output pre-filled
from it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 20:24:54 -07:00
Shokunin a4d1f31487 Add a title pad transform stage to external offline input
psx_mod_set_pad_transform(player, &PSXModPadTransform) registers stage 2b
of pad_external_input: after the physical pad and any controller source,
before the mouse policy. The transform sees the resolved pad plus the
port's host extras (gamepad present, LT/RT 0..255 from SDL, unthresholded)
and may rewrite buttons, sticks and the presented controller type, e.g. a
NeGcon whose I/II come from the triggers. Output is pre-filled as a
pass-through, validated (struct size, ranges, type within allowed_types)
and replaced by neutral when invalid; detaching or a mod/session reset
owes one neutral release frame. initial_type sets the boot/hotplug type.

The resolver stays pure: host extras arrive through a new capture hook and
the transform through another, both covered in pad_external_input_test.
Under the input guard the transform runs on zero triggers and its output
is neutralized. A NeGcon result resets the mouse policy rather than letting
it overwrite the I/II bytes. Offline only: netplay, resim, selfcheck replay
and plain debug overrides never reach it.

With no transform registered every pad is bit-identical to before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 19:36:34 -07:00
Shokunin 775fb3b646 Merge remote-tracking branch 'origin/master' into feat/mod-local-pad-sticks
# Conflicts:
#	runtime/src/main.cpp
2026-10-05 14:50:46 -07:00
Shokunin 7c6419cbcb mods: game-owned netplay function hooks and filters
Trusted game code can register entry hooks and consuming filters that run
only in a netplay session (psx_game_register_netplay_function_entry /
_filter). They live outside the mod package plan, which every online
match clears, so a title's netplay support survives it. Offline they are
inert unless PSX_GAME_FILTER_OFFLINE_PROBE=1. Reimplemented on master's
entry-filter path from the R4 Link Battle branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 14:15:09 -07:00
Matthew Stanley 6f9bdd94f2 Resolve controller source and mouse policy in one ordered external-input layer
Mouse policy now folds onto the resolved pad (source included) instead of a discarded capture; no-policy path does no mouse polling.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:49:35 -07:00
Beman b5566c7b25 Support optional held mouse input policies for local P1
(cherry picked from commit 00ee1f40b6)
2026-10-05 13:49:35 -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 a6674e6629 Merge remote-tracking branch 'origin/master' into landtmp/495
# Conflicts:
#	runtime/CMakeLists.txt
#	runtime/src/main.cpp
2026-10-05 13:24:03 -07:00
Shokunin f3801ba10b mods: read local host sticks for presentation-only plugins
psx_mod_read_local_pad_sticks(player, out[4]) returns the mapped local
stick axes (lx, ly, rx, ry; 0..255, centre 128) without touching the
SIO sample, so a presentation plugin (a look-around camera) can read the
right stick even when the game selected a digital pad. It returns 0 and
centred axes for an invalid or disconnected player, in netplay, and
during rollback resimulation; peer input is never presentation input.
The debug-server axis override feeds it for deterministic tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 13:11:51 -07:00
Matthew Stanley c20a32fa2d Merge land/pr493 into land/pr496 2026-10-05 10:12:14 -07:00
Matthew Stanley 67e42e8833 mod controller source: call these offline controller sources, mod-trusted, not 'trusted'
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-05 10:12:08 -07:00
Matthew Stanley 3733764362 Merge origin/master into land/pr495 2026-10-05 10:11:51 -07:00
Matthew Stanley e1673a52f2 Merge land/pr492 into land/pr493 2026-10-05 10:11:34 -07:00
Matthew Stanley 3358f81e25 Let titles audit withheld plugin packages; SPU upload wraps like hardware
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 21:53:37 -07:00
Matthew Stanley 911426552a Add shared seamless-loading kit: resident disc packs and guest services
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 20:55:30 -07:00
Matthew Stanley fe42da2744 Merge release/native-rendering-20261003 into master
Keeps both lines: master's PGXP session, draw-distance clamps, masked rejects
and saturated-winding NCLIP; the release's render-pass kit additions, verified
media/disc extents, timeline/present rings, cull-scale sites. Overlay ABI v30.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 19:27:02 -07:00
Matthew Stanley 167babab9f Merge Tomba snapshot continuation fix into master
Keep upstream atomic v9 restore and handoff serialization. Add scoped snapshot deferral for host adapters, reset abandoned scopes at scheduler escapes, and rebind enabled mod hooks before restored execution. The backport parent preserves the tested Tomba v0.15 savestate/cache lineage. Focused host-snapshot, restored-handoff, and mod-runtime tests pass.
2026-10-04 17:59:57 -07:00
Matthew Stanley 6426b25f3d Preserve restored handoff and snapshot host-call continuations 2026-10-04 17:51:23 -07:00
Matthew Stanley f0b920dd65 Merge branch 'review/pr495-fix' into review/pr497-fix
# Conflicts:
#	runtime/CMakeLists.txt
#	runtime/include/mod_controller_source.h
#	runtime/include/mod_plugins.h
#	runtime/runtime.cmake
#	runtime/src/main.cpp
#	runtime/src/mod_controller_source.c
#	runtime/tests/test_mod_controller_source.c
2026-10-04 11:03:38 -07:00
Matthew Stanley b1899a2f51 Merge branch 'review/pr496-fix' into review/pr497-fix
# Conflicts:
#	runtime/src/debug_server.c
2026-10-04 11:03:22 -07:00
Matthew Stanley dd0ce3d365 gte: render-view projection override replaces guest projection explicitly; fix abort test count after merge
Override skips guest-formula PGXP shadows; composition with fov_scale tested and documented.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 11:03:01 -07:00
Matthew Stanley 8403bdf9a5 Merge branch 'review/pr493-fix' into review/pr496-fix
# Conflicts:
#	runtime/include/mod_plugins.h
#	runtime/src/main.cpp
#	runtime/src/render_pass.c
#	runtime/tests/test_gl_readback_region.c
#	runtime/tests/test_gte_register_access.cpp
#	runtime/tests/test_render_pass_sandbox.c
2026-10-04 10:57:48 -07:00
Matthew Stanley 2cc8dcb317 mod controller source: neutral release on reset, once-per-frame sample, policy-routed type
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-04 10:46:04 -07:00
Matthew Stanley ff9777318e mod_plugins.h: document that watchdog aborts longjmp past plugin frames
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 10:45:30 -07:00
Matthew Stanley 405ecded85 Merge origin/master into review/pr495-fix 2026-10-04 10:40:53 -07:00
Matthew Stanley cd9981cda8 Clip proven native-wide world faces across camera and screen planes 2026-10-03 23:51:14 -07:00