Commit Graph

1135 Commits

Author SHA1 Message Date
Matthew Stanley ec4c91cd94 runtime: GP0 source key and overlay_region_floor follow the 8 MiB window
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 08:03:58 -07:00
Matthew Stanley 1721739a73 debug_server: PSX_WTRACE_BOOT_RANGES gets reserved slots and is refused whole, with the reason in wtrace stats
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 08:03:58 -07:00
Matthew Stanley 0238117450 runtime: keep RAM-mirror PCs architectural; fold only bytes, through one live mask
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 08:03:57 -07:00
Matthew Stanley 18e3030440 savestate: validate every section before applying any; header records the live RAM size
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 08:03:39 -07:00
Matthew Stanley 71fdd712db debug_server: seed boot/transition write-ring ranges from PSX_WTRACE_BOOT_RANGES
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 06:43:12 -07:00
Matthew Stanley c564ccd1f1 runtime: route every RAM consumer through one live 2/8 MiB geometry
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 06:31:33 -07:00
Matthew Stanley fa951645b4 runtime: add opt-in 8 MB main RAM mod
Adapt the 8 MB RAM work from the rbengine branch into a master-targeted change. The builtin package is disabled by default, activation requests expanded RAM before memory init, and runtime/state/digest/dispatch paths respect the live RAM map.
2026-09-26 06:02:23 -07:00
Matthew Stanley f9109e21c6 Resolve relative bezel artwork paths against the exe directory
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 22:27:47 -07:00
Shokunin 5bd0397278 Resolve the executable path on macOS without /proc
The setup host located itself with realpath("/proc/self/exe"), which only
exists on Linux. On macOS it failed, so a host launched from Finder (cwd =
$HOME) could not find its project tree: Generate & rebuild never appeared
and forward-to-built-game never fired. Take the path from dyld's
_NSGetExecutablePath there (as recomp-ui's launcher_model.c already does);
Linux and Windows are unchanged.

The netplay rollback "binary path" diagnostic had the same /proc read and
logged "(unknown)" on macOS; it uses the same source now.

No emulation or runtime behaviour changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 20:05:09 -07:00
Alex Vanderveen b5ef7b86d9 netplay: take the scheduler, input history and hash-confirm from recomp-net
recomp-net now carries the peer-facing rollback modules that used to live in
retcomm-rbengine (RetroPortingToolKit/recomp-net#14). Switch the MotK shims and
psx_netplay_sched.c from rbe_sched_* / rbe_ih_* / rbe_hc_* /
rbe_rb_peer_post_tip_ok to their rnet_* names and recomp_net/ headers, and bump
lib/recomp-net to c2338c6.

The netplay_* / np_sched_* surface the rest of the runtime calls is unchanged.
The snap ring and rbe_mono_ms still come from retcomm-rbengine, which stays at
a7b9850 for now; the three moved-module unit tests link recomp_net directly
instead of reaching it through rbengine. RBE_RB_* env knobs keep their names.

Checked with PSX_NETPLAY=ON: psx-runtime links and the netplay tests pass
against both the current rbengine and the split one (rbengine
refactor/launcher-core), and the binary's 33 scheduler / history /
hash-confirm functions now resolve to rnet_* where they were rbe_*.
lobby_chat_ring_test does not compile on master either (chat_push arity) and
is untouched here.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 22:06:27 -04:00
Matt Stanley dc7a4c1084 Merge pull request #389 from RetroPortingToolKit/fix/cue-pregap
Honour cue PREGAP/POSTGAP in the BIN/CUE mount (fixes #388)
2026-09-24 15:42:52 -07:00
Matt Stanley 9e9ec7b401 Merge pull request #383 from x6568tank/feat/mid-session-disc-change
Mount a different disc while the game runs
2026-09-24 15:15:43 -07:00
Matthew Stanley eec71b9787 fix: open the game window at a normal size instead of maximised
Default = largest multiple of 240 lines within 2/3 of the usable height;
an explicit window_width is still honoured.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 14:42:12 -07:00
Matthew Stanley 0e75a37f7c debug: record immediate CD responses in the command history ring
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 14:38:03 -07:00
Matthew Stanley e09980e6cd fix: honour cue PREGAP/POSTGAP in the BIN/CUE mount
Gaps the dump does not store were dropped, so every later track (and GetTD)
sat 150 sectors early; games that seek via GetTD landed in the previous track.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 14:38:03 -07:00
Matthew Stanley c68bf6e085 Merge current master while preserving Tomba adaptive renderer 2026-09-19 16:23:00 -07:00
Matthew Stanley fa435a4a0c render: add uncapped adaptive viewport and stable world classification 2026-09-19 16:19:23 -07:00
x6568tank 740df609b7 feat: add a cd_reinsert debug command
The reinsert hotkey needs a focused window, so no test could exercise
the lid. This runs the same tray cycle on the same image from the
debug server.

It was added to isolate a wedge seen after a savestate save, and it
established that the wedge predates the disc-change work: a save
followed by this command alone reproduces it, with no disc change.
2026-09-18 11:40:35 -04:00
x6568tank 8fa46fbee5 fix: derive the disc index when --disc names a set member
The index derivation is guarded by !disc_override_path, so an explicit
--disc left selected_disc_index at its default of 1. Every savestate
then carried the _disc1 token whatever was mounted.

Measured on a two-disc set: booting disc 2 with --disc wrote
state_801255AC_disc1_slot08.pst. With this change the same run writes
state_801255AC_disc2_slot08.pst.

This is independent of the disc-change feature. It is in this branch
because the roster registration already computes the mounted index.
2026-09-18 11:40:35 -04:00
x6568tank e397d6abb8 fix: keep the savestate disc scope with the mounted disc
main() sets savestate_set_disc_scope() once, from the boot disc. A
mid-session disc change left it behind, so a state saved after a swap
was filed under the disc the game booted from. That is the exact
mix-up the scoping exists to prevent, and nothing in the slot list
would have shown it, because every disc of a set shares one entry_pc.

cdrom_disc_select() now updates the scope, rather than the one caller
doing it, so any future caller stays correct.

Two smaller fixes in the same function. A failed iso_open() left
s_disc_selected naming a disc that is no longer mounted; it now
reports none. A roster path longer than the buffer was silently
truncated and would open the wrong file or nothing; it is now dropped.
2026-09-18 11:40:35 -04:00
x6568tank 7c99a88565 feat: mount a different disc while the game runs
The runtime mounts one disc image at startup. No code path changes the
mounted image after that. Some multi-disc games prompt for a disc
change during play and then poll the drive. That poll never succeeds.
The CD-reinsert path reopens the same image path, so it cannot mount
the other disc.

cdrom_disc_select() closes the current image and opens another roster
entry, inside the existing lid window. cdrom_lid_media_ready() returns
0 for the whole window, so the guest cannot read the image until the
window ends. The existing timed close then ends the window.

cdrom_init() is not called. It also resets warm-route, trace and timing
state, which would discard a running session. cdrom_disc_select()
resets the sector buffers, the seek position, and the warm-route
arming. Registered warm routes are configuration and are not reset.

begin_tray_open_cycle() now holds the tray-open code, moved out of
debug_force_cd_reinsert(). Both paths call it.

Add a disc_select debug command. It returns the roster and mounts entry
n when n is given. It also returns the sector count and track count of
the mounted image, which confirms that the reader opened another image.

Tested on Ace Combat 3: Electrosphere (SLPS-02020 / SLPS-02021). Boot
disc 2 with no disc-2 save. The game prompts for disc 1. At that prompt
the CD read count is static at 2955 and frames run at 60.5 Hz, so the
drive is idle. disc_select n=1 mounts disc 1. The game resumes and
plays its first cutscene. Reads restart within two seconds and pass
19971. The read addresses change to disc-1 values. The frame rate does
not drop.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-18 11:10:00 -04:00
Matt Stanley 1a0897ca50 Merge pull request #373 from Alexbeav/up/autocompile-posix
runtime: spawn overlay autocompile on POSIX hosts
2026-09-17 14:10:45 -05:00
Matt Stanley 2697a78846 Merge pull request #376 from Alexbeav/up/toolchain-staging
cli: stage the overlay toolchain beside every built product
2026-09-17 14:10:42 -05:00
Matt Stanley b1d8d4cead Merge pull request #374 from Alexbeav/up/frame-report
runtime: report frame rate from every product, not just debug builds
2026-09-17 14:10:28 -05:00
Matt Stanley ba5a70d5de Merge pull request #375 from Alexbeav/up/launcher-dialogs
runtime: show launcher warnings through SDL on every platform
2026-09-17 14:10:25 -05:00
Matt Stanley 234bfc4dac Merge pull request #378 from Alexbeav/up/freeze-mdec
runtime: do not classify MDEC-active stillness as a spin freeze
2026-09-17 14:10:21 -05:00
Alexandros Mandravillis 59f17edf6a runtime: do not classify MDEC-active stillness as a spin freeze
During a boot FMV the guest parks in BIOS MDEC code with the dirty-RAM counters
legitimately still while frames advance, which is exactly the spin signature.
Every boot FMV wrote a 47-76 MB dump, 1.8 GB per kit in one session, inside
timed windows. MDEC activity within the window now rules the classification
out. Verified on NCII: heartbeat live through the FMV, zero dumps.

(cherry picked from commit bf60c128218949e3e3af7ea867d50cc7a1e8a774)
2026-09-16 20:00:33 +03:00
Alexandros Mandravillis 1da867ea99 runtime: recompute the text-modified bitmap after a state restore
dirty_ram_text_guard_resync_after_restore() cleared text_modified_bitmap,
and the page-clean fast path in dirty_ram_text_native_ok_ranges_from()
then trusted a clear bit as "bytes still equal the reference" and skipped
the compare. Restored RAM may carry self-modified text (the CMR2 class)
that no live write will ever re-flag: the bitmap is not part of the state
image, and the writes happened in the process that produced it. After a
save-state load into a fresh process, a stale native body could be
admitted for those pages.

Recompute the bitmap from the bytes: one pass over the reference range (at
most 2 MB, once per restore), setting the bit for every page that differs,
so those pages stay under the exact compare.

(cherry picked from commit ab186edf6, memory.c part)
2026-09-16 20:00:33 +03:00
Alexandros Mandravillis c10bad2ebb cli: stage the overlay toolchain beside every built product
No setup package ever staged one, so overlay_cache = true alone left every
streamed overlay on the interpreter. rebuild now stages the pinned Python,
tcc, this pin's recompiler, headers and the build's codegen hash beside the
normal and diagnostic products, and writes compiler.txt naming the compiler
the wizard already has; the runtime treats that as a gcc-tier compiler, so a
player with nothing on PATH gets -O2 shards. Verified on the NCII kit: gcc
tier reported and four shards built with no compiler on PATH.

(cherry picked from commit 03865e10f6ee198d58c47c74526df5db46bb35a9)
2026-09-16 19:59:17 +03:00
Alexandros Mandravillis 6451508633 runtime: spawn overlay autocompile on POSIX hosts
autocompile_request() returned 0 on every non-Windows host, so a Linux or
macOS player never had a shard compiled at runtime: captures were written,
the packager staged a working toolchain, the boot log said "overlay
autocompile enabled", and every overlay ran interpreted for the whole
session (Parasite Eve on Rocky 9: 1.35e9 interpreted instructions by frame
13k with /usr/bin/gcc beside the exe).

Mirror the Windows spawner with fork/exec: /bin/sh -c runs the configured
command in its own process group at nice 10, stdout+stderr flow through one
pipe into the same tail ring (streaming PSX_SHARD_RESULT parse), a pthread
watcher drains the pipe and reaps the child, and the emulation thread's poll
turns DONE into the one idempotent cache rescan. No PSX_SHARD_PUBLISHED
handoff off Windows: the rescan is the fallback the Windows path already
takes when a marker is cut off. Shutdown SIGTERMs the group and joins;
PR_SET_PDEATHSIG on Linux plus the dying pipe cover a runtime that never
reaches shutdown. The PSX_OVERLAY_* pins are set once at configure time
(glibc setenv is not safe against a concurrent getenv). Configure names the
interpreter it will run and marks the run degraded when the path is not
executable. Link Threads unconditionally on Unix.

The child-line buffer, shard_result_values, shard_result_line_locked and
publish_parse_locked move out of the Windows block; child_line_locked is
per-platform. Both Windows unit tests still pass.

Verified on Rocky 9 (PE diagnostic product): 0 -> 68 shards in 150 s,
interpreted instructions by frame 14.5k 1.35e9 -> 0.39e9, curve flat from
frame ~4k, counters visible over the debug server, quit and SIGKILL
mid-compile leave no orphans or zombies.

(cherry picked from commit 854540c9c96e86b0cc1eea0dd99ef285169784d9)
2026-09-16 19:56:55 +03:00
Alexandros Mandravillis 09a59af86c runtime: report frame rate from every product, not just debug builds
s_frame_count is already maintained under PSX_NO_DEBUG_TOOLS, but everything
that exposes it — the debug server, the freeze heartbeat, screenshots — is
compiled out of production. A shipped binary could not report its own speed, so
throughput could only be measured on the diagnostic product, which carries
instrumentation of its own and is not what players run.

That gap is why a 30% throughput regression reached a release candidate
unmeasured, and why the first four attempts to attribute it were all made
against the wrong binary.

Adds an opt-in periodic line on stdout, outside every debug guard:

  PSX_FRAME_REPORT_MS=2000
  psxrecomp: frames=1234 elapsed_ms=20000 fps=61.7 avg_fps=61.7

Unset, it is one branch on a cached int per vblank. Line-oriented on stdout so a
harness can read it without a debug connection.

(cherry picked from commit aac4dbf58331a413b4ac8be6890c7ff499c55ca0)
(cherry picked from commit c1fbb313d15fe00256bc68a805ba0df255feb249)
2026-09-16 19:56:55 +03:00
Alexandros Mandravillis 3b541c681f runtime: show launcher warnings through SDL on every platform
launcher_warning/launcher_info only ever raised a dialog under _WIN32, so on
macOS and Linux a first run with no BIOS printed to a terminal nobody was
looking at and quit. SDL3 is already linked; SDL_ShowSimpleMessageBox covers
all three platforms and keeps the headless guard.

(cherry picked from commit 22f4322eb33d46946f9b953f943bedf070eb75a6)
2026-09-16 19:56:55 +03:00
Alexandros Mandravillis 6acf1976d2 runtime: refuse an over-long overlay autocompile command instead of truncating it
s_cmd was 4096 bytes; a 208-address --force-interior list produced a 6392-char
command, snprintf cut it mid-argument, every compile failed the same way and
autocompile latched degraded for the process lifetime. Buffer is now 8192
(cmd.exe's own ceiling), the cmd.exe wrapper is sized from it, and an over-long
command is reported and disabled loudly.

(cherry picked from commit b0fd04076ca4b0cc7f8d813bc6f750f94df30bf9)
2026-09-16 19:56:54 +03:00
Pegasus 5968162fe9 fix: publish deferred CPU work before GTE deadline checks
(cherry picked from commit 43abd4a5c8)
2026-09-14 17:26:34 +03:00
Pegasus 77a8480363 Read disc region from the actual SYSTEM.CNF directory entry
Prefer the ISO9660 boot file over the bounded raw-image scan. Biohazard stores SYSTEM.CNF outside that scan, leaving fresh builds at the default SCEA response. Add raw and cooked late-file regressions with an early decoy serial. The full-profile prefix again matches the retained native baseline through 5999 returns; the independent-source frontier remains return 464.

(cherry picked from commit 82c3de13ef)
2026-09-14 17:26:33 +03:00
Pegasus 324690cb97 Preserve fully qualified Windows network asset paths
(cherry picked from commit 51d5d56a27)
2026-09-14 17:26:32 +03:00
Pegasus 5e23de8393 feat: add PS1 conformance harness and fix GTE fidelity
(cherry picked from commit 98d617b5f3)
2026-09-14 17:26:31 +03:00
Alexandros Mandravillis d4abc2f05d Fix non-RA JALR interpreter handoff
(cherry picked from commit 2f8f627b24)
2026-09-14 17:26:30 +03:00
Matthew Stanley 8b689140dd Add opt-in world scene classification and immutable terrain batching 2026-09-13 21:06:58 -07:00
Matthew Stanley b4d41b173c Merge current master and preserve both runtime regression test groups 2026-09-13 19:40:33 -07:00
Matthew Stanley f2352e3d32 Keep retained scene aspect until the next displayed buffer flip 2026-09-13 19:27:03 -07:00
Matthew Stanley e3beb365ba Add opt-in native-wide presentation hold for retained loading scenes 2026-09-13 19:11:21 -07:00
Alexandros Mandravillis 693c7be0fc Fix GPU upload history overflow after retention fills (#360)
Co-authored-by: Pegasus <pegasus@psxrecomp.local>
2026-09-13 17:01:55 -07:00
Matthew Stanley 9037e7bd23 Add opt-in retained texture banks and enhancement memory snapshots 2026-09-13 16:50:26 -07:00
Matt Stanley d4c45adf62 fix(sio): remove title-specific card IRQ repair and opt-in (#362) 2026-09-13 16:33:46 -07:00
Matthew Stanley 7025bb5f88 Fix rewind keyboard load conflicting with cancel aliases 2026-09-13 14:16:20 -07:00
Aliet Exposito Garcia ab2aaf95be fix(runtime): fix compilation failure when netplay is disabled
When `PSX_NETPLAY` is turned off, the build fails because `ae_np_account_sync` is referenced without being declared in that configuration. This issue caused automated continuous integration pipelines and local builds to fail unless netplay was explicitly forced on.

Wrapping this function call ensures that the runtime compiles cleanly for projects that do not require netplay support, restoring the ability to build with netplay disabled.
2026-09-13 13:33:16 -04:00
Matt Stanley bd01da696a Merge pull request #353 from plinkr/feat/gl-renderer-post-gamma
feat(OpenGL renderer): add post presentation gamma control
2026-09-13 00:29:57 -07:00
Matthew Stanley ce7f646f42 fix(runtime): keep chat-report dependency inside enabled lobby path 2026-09-12 23:10:42 -07:00
Matthew Stanley fa655333fb fix(runtime): guard optional netplay authentication dependencies 2026-09-12 23:06:05 -07:00