mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 18:25:35 -04:00
77095c589c
Rewind was on for everyone and could only be turned off with PSX_REWIND=0 in the environment. It now defaults off and is enabled from settings.toml ([video] rewind) or the launcher's Display card. The cost it was charging silently: each snapshot is a whole machine — 2 MB main RAM + 1 MB VRAM + 512 KB SPU RAM — serialized uncompressed into a buffer malloc'd at a fixed 5 MiB cap that is never shrunk to the actual length, and one is captured every rewind_interval frames (15 by default, tightening toward 4 while an FMV runs), each with a 128x96 thumbnail built pixel by pixel. At the default depth of 50 a full ring is roughly 250 MB resident; at the maximum 200 it approaches 1 GB. That is a lot to hand a low-end host for a feature a session may never open. Turning it off genuinely avoids all of it: psx_rewind_configure() returns before any allocation when rewind is not wanted, and both capture paths are guarded by psx_rewind_enabled(). The only residue is a 450 KB BSS overlay panel whose pages stay untouched. The toggle applies live rather than at next launch — freeing the ring is the whole point, so waiting for a restart would miss it. psx_rewind_shutdown() already resets the overlay and drops a pending load, so tearing down mid-session is safe. PSX_REWIND still outranks the setting in both directions and now accepts 1 as well as 0. Netplay rollback is a separate subsystem with its own ring and is unaffected; rewind was already suppressed during netplay. Because off is now the common case, psx_rewind_toggle() says so on the OSD instead of leaving F8 / Select+R3 looking broken. It stays silent only in a -DPSX_REWIND=OFF build, where there is nothing to enable. Adds rewind_settings_test (default off, explicit off distinguishable from absent, save/load round trip, tuning keys independent of the enable) and the first documentation the feature has had, in config_schema.md. Verified: recompiler tests build and pass; main.cpp type-checks against the new recomp-ui ABI field; psx_rewind.c compiles both with and without PSX_HAS_RBENGINE_SNAP; the existing test_rewind_toggle_combo.py still passes. Not run end to end — this checkout has no BIOS dump to boot. Needs recomp-ui a31ecbc for Settings.rewind_enabled. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017AwqKPQFnK3x7xQbK4PQKj