Skip to content

Fix an off-by-one error in replay checkpoint loading.#18261

Merged
LibretroAdmin merged 1 commit intolibretro:masterfrom
JoeOsborn:bsv-movie-fix-checkpoint-off-by-one
Sep 16, 2025
Merged

Fix an off-by-one error in replay checkpoint loading.#18261
LibretroAdmin merged 1 commit intolibretro:masterfrom
JoeOsborn:bsv-movie-fix-checkpoint-off-by-one

Conversation

@JoeOsborn
Copy link
Copy Markdown
Contributor

The issue is that a replay frame read on core frame K stores the inputs for frame K along with the core state as of the end of frame K, in other words the beginning of frame K+1. To fix it, and to make sure existing replays play back properly, the core_unserialize call in bsvmovie.c has been deferred to the following invocation of bsv_movie_read_next_events, so that frame K+1 is unserialized (restored) just before reading the inputs for frame K+1.

Some refactoring has also been done to simplify the number and timing of calls to bsv_movie functions from runloop.c.

The issue is that a replay frame read on core frame K stores the
inputs for frame K along with the core state as of *the end of frame
K*, in other words the beginning of frame K+1. To fix it, and to make
sure existing replays play back properly, the `core_unserialize` call
in bsvmovie.c has been deferred to the following invocation of
`bsv_movie_read_next_events`, so that frame K+1 is deserialized just
before reading the inputs for frame K+1.

Some refactoring has also been done to simplify the number and timing
of calls to bsv_movie functions from runloop.c.
@LibretroAdmin LibretroAdmin merged commit e416cfb into libretro:master Sep 16, 2025
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants