Commit Graph

775 Commits

Author SHA1 Message Date
Matthew Stanley 2d256286e8 Add deterministic post-SPU PCM callbacks for trusted mods 2026-10-24 13:08:46 -07:00
Shokunin f9a7a33657 timing: opt-in batching of the scaled CPU charge
With [timing] guest_cycle_scale active, every one-cycle psx_cyc_charge went
straight to psx_cpu_charge and psx_advance_cycles, bypassing the batch the
scale-1 path uses. [timing] guest_cycle_scale_batch (PSX_GCS_BATCH=0/1)
scales the charge in place, with the same fractional carry and order as
psx_cpu_charge, then batches it like the scale-1 path. It flushes at the same
observation points. Default off.

R4 exactness, frame_fingerprint off vs on, 9000 frames each: headless boot
through intro, title and attract; a 1P Grand Prix race; and a 2P VS race.
cyc, mmio, mc and qc are identical on every frame. sp, wr, pc and ws are
identical at the end. The only differences are single-frame VBlank straddles
of wc/sc (never two frames in a row). 0 dispatch misses.

Speed, release builds, races at 60 Hz:
- M4 (macOS sample): psx_cpu_charge 4.3 % -> 0 % of emulation-thread samples;
  busy 46.0 -> 44.4 % (2 pairs).
- 9800X3D: no measurable change (30.0 vs 30.5 %; one core 44.6 vs 44.2 %).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 22:21:53 -07:00
Shokunin 985d45ecf2 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-08 22:20:08 -07:00
Shokunin f461435d1c Title timing constant: [timing] guest_cycle_scale (and _gated)
No CPU is emulated: recompiled code charges the guest clock a fixed cost
per instruction. guest_cycle_scale = N charges 1/N of it (instruction,
load, mul/div, GTE latencies, overlay DLL batches) while VBlank, timers,
CD, SPU and DMA keep hardware time, so the game never runs out of frame
time. A title constant in game.toml (1 = faithful, 1..64), never a player
setting; guest_cycle_scale_gated applies it only while the title's mod
opens the gate (psx_guest_cycle_scale_gate_open). PSX_GUEST_CYCLE_SCALE
overrides for testing. A scale other than 1 is folded into the netplay
content fingerprint as a safety net.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 22:20:07 -07:00
Matthew Stanley bffd30fe81 Recover verified thin terrain faces from zero integer NCLIP 2026-10-08 22:02:07 -07:00
Matthew Stanley 2c6e0a3a20 Allow explicit world axes for widescreen visibility cones 2026-10-08 21:02:03 -07:00
Matthew Stanley b0f7b2be8e Widen guarded packed screen-X predicates in native and interpreted code 2026-10-08 12:59:36 -07:00
Matthew Stanley e740b81c3c Preserve native fractional scroll mappings in Capcom wide views 2026-10-07 22:56:22 -07:00
Matthew Stanley ec8c5c54c2 Share authored-map Capcom adaptive background packet rendering 2026-10-07 21:30:51 -07:00
Matthew Stanley 502393296a Share bounded resident Mode 2 sector cursor for title loader HLE 2026-10-07 19:42:21 -07:00
Matthew Stanley 609cc88dd2 Share strict aligned archive extent validation for resident loading 2026-10-07 19:18:52 -07:00
Matthew Stanley fd489f47ec Share validated Neversoft archive and renderer extensions 2026-10-07 18:32:54 -07:00
Matthew Stanley b77b18a3b1 Preserve PGXP projection and depth through flagged subdivision stores 2026-10-07 18:06:07 -07:00
Matthew Stanley 972d4f4c71 fix: restore draw-entry primitive arenas through the render sandbox journal 2026-10-07 16:19:50 -07:00
Matthew Stanley 968788ccf6 fix: accept allocated primitive arenas in sandbox OT submission 2026-10-07 16:11:35 -07:00
Matthew Stanley 4b754210bd Retarget native render packets in the allocated GPU aperture 2026-10-07 10:27:26 -07:00
Matthew Stanley 77f3a90923 Preserve queued native frames and batch guarded GPU submission 2026-10-07 10:08:38 -07:00
Matthew Stanley 5cf009df84 Preserve padded OT allocations with indexed late-packet relocation 2026-10-07 09:33:59 -07:00
Matthew Stanley d1d35c32e5 Preserve padded OT allocations with indexed late-packet relocation 2026-10-07 04:36:36 -07:00
Matthew Stanley 89e9909ed0 Preserve independently submitted HUD lists during scene replay 2026-10-07 01:30:01 -07:00
Matthew Stanley ab4534455f Share bounded late OT replay and decoded framebuffer retargeting 2026-10-07 01:03:29 -07:00
Matthew Stanley bebf2d08dc Support sprite scenes whose bank state lives entirely in DRAWENV 2026-10-07 00:23:48 -07:00
Matthew Stanley 586d01ee65 Extract descriptor-based native sprite scene replay for X-series titles 2026-10-07 00:17:17 -07:00
Matthew Stanley 4b0e5bd1db GPU packet keys keep the enhancement aperture apart from the main RAM it aliases
The UI prepass re-read aperture node payloads through the RAM-folded key, so
THPS2's relocated prim arena discarded the HUD squash every frame.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 23:56:07 -07:00
Matthew Stanley 308d7b9ca6 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>
2026-10-06 23:55:19 -07:00
Matthew Stanley ce4ae025c6 Support identified scene motion in shared draw replay 2026-10-06 23:48:08 -07:00
Matthew Stanley 20b0ea04bc Honor explicit HUD anchors in projection rendering 2026-10-06 21:49:56 -07:00
Matthew Stanley 8f95b59999 Support checkpointed relocation of packet precision metadata 2026-10-06 20:37:31 -07:00
Matthew Stanley 1d201aa39f Accelerate exact startup file hashing with native host crypto 2026-10-06 20:00:55 -07:00
Matthew Stanley 04f871f014 Preserve exact packet precision across guarded draw replay 2026-10-06 19:21:43 -07:00
Matthew Stanley 8873093790 Abort render replay before uncheckpointed device reads 2026-10-06 19:19:09 -07:00
Matthew Stanley b0bb115dd0 Honor HOLD when presenting native replay generations 2026-10-06 18:36:52 -07:00
Matthew Stanley 16d3672526 Add build-selected execution contracts and stateless HLE GTE service 2026-10-06 18:30:50 -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
Matt Stanley d95eed86c2 Merge pull request #541 from RetroPortingToolKit/feat/mod-uncharged-guest-call
Add uncharged guest calls: run a guest function in zero guest time
2026-10-06 11:13:08 -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
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 66482a7cd8 Add opt-in netplay content negotiation with a backward-compatible LAN protocol
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
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
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