Commit Graph

748 Commits

Author SHA1 Message Date
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
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
Shokunin c4215396e3 netplay: present a title-chosen local view for each peer
A title whose netplay mode draws every seat's view into one frame (so all
peers keep identical guest state) can now ask the present path to show only
this peer's rectangle of the display: psx_netplay_present_local_view(x, y,
w, h), usually picked from psx_netplay_local_slot(). The GL dual-raster
present shows it from the internal-resolution surface, the software present
crops its staged frame, both at 4:3, and the headless present-image ring
records the same rectangle. The request is host-only (never serialized or
guest-visible), lapses PSX_NETPLAY_LOCAL_VIEW_HOLD ticks after its last
renewal so menus fall back to the full frame, survives rollback replays
without moving its stamp backwards, and is ignored offline. It wins over
[netplay] local_viewport.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 01:05:14 -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 514cf5deda Carry the NeGcon type through PsxNetPad and one shared SIO apply
PsxNetPad type 3 is NeGcon, packed lx = twist, rx = I, ry = II, ly = L
(the rollback row's stick view carries twist and L). Every decoder accepts
up to PSX_NETPAD_TYPE_MAX instead of clamping at JogCon, and normalization
keeps NeGcon pressures exact (only twist gets the centre deadzone).

psx_pad_apply_to_sio() is now the one PsxNetPad -> SIO path for offline
sampling, netplay delay/rollback apply and selfcheck replay, so a type
added once reaches the guest the same way everywhere. Selfcheck replay now
matches offline sampling on multitap seats with the analog-on-tap hack.
psx_netplay_normalize_pad moves to a pure TU so tests link the real one
instead of a mirror. Pins recomp-net to the branch that keeps type 3.

Other titles: pads never carry type 3, so SIO bytes are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 19:28:13 -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
Shokunin a2bbf961ec netplay: expose published seat pads and seat count; unconfirmed load barrier in both modes
- psx_netplay_seat_count() and psx_netplay_sim_pad(seat, out): the pad row
  last published to SIO for each seat at the current simulation tick,
  following delay-sync publication and rollback's sealed overrides, for a
  game hook whose title reads more players than its SIO protocol exposes
  (R4 Link Battle). Host-only cache, never serialized; republished on
  every admitted or replayed tick.
- Load barrier: while a slower peer is still applying a save, neither
  mode waits for confirmation from an already-frozen peer (rollback did
  this already); after mutual ready, both modes resume on a confirmed
  first tick instead of rollback inventing it, so peers cannot run
  different inputs from the identical restored state.

From the R4 Link Battle branch; its headless input probe is dropped
because master already honours debug input on headless peers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 14:17:22 -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 9f13dd0bbc openxr: suspend presentation interpolation while a session runs; glDeleteProgram optional
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-05 13:41:02 -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 19f009600c Merge remote-tracking branch 'origin/master' into landtmp/505
# Conflicts:
#	runtime/tests/test_gte_register_access.cpp
2026-10-05 13:25:10 -07:00
Matthew Stanley b31c40c2ae Merge remote-tracking branch 'origin/master' into landtmp/460 2026-10-05 13:24:39 -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
Matthew Stanley 82468f30d4 Merge remote-tracking branch 'origin/master' into landtmp/494 2026-10-05 13:23:40 -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 b44c72349d Test JogCon steering, hotplug and live input 2026-10-05 12:57:31 -07:00
Shokunin 3df760f524 Add JogCon input selection and hotplug handling 2026-10-05 12:57:31 -07:00
Shokunin 52c6d758a6 Add JogCon SIO controller support 2026-10-05 12:57:10 -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 029629ff89 Merge origin/master into land/pr494 2026-10-05 10:11:43 -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
Shokunin 5807fe8ec3 fix(pgxp): keep probe out of geometry counters 2026-10-05 03:40:41 -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 68676a86ae openxr: tear down and retry on session/instance loss; release unwritable swapchain images; hands focus from session state
Loss no longer returns 0 forever; EXITING tears down and stays disabled. begin() syncs actions so hands work without polling input. Timeout code no longer treated as writable.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 11:11:21 -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 7d9abcf5ff stereo: stop presenting a pair the plugin has stopped refreshing
Pair is fresh only within 24 vblanks of its capture cycle; savestate/session reset already invalidate it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 10:59:28 -07:00
Matthew Stanley a599d44b86 Merge branch 'review/pr494-fix' into review/pr496-fix
# Conflicts:
#	runtime/CMakeLists.txt
#	runtime/include/projection_scale_config.hpp
#	runtime/src/gte.cpp
#	runtime/src/main.cpp
#	runtime/src/projection_scale_config.cpp
#	runtime/tests/test_gte_register_access.cpp
#	runtime/tests/test_projection_scale_config.cpp
2026-10-04 10:58:21 -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 98763d922f fov_scale config: accept integers, warn and fall back to 1.0 instead of throwing
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 10:55:58 -07:00
Matthew Stanley 07aaa6e700 Add side-effect-free psx_peek_word + test
Debug reads of RAM/scratchpad/BIOS without MMIO, read hooks or unmapped_fatal.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 10:50:02 -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