Fix an off-by-one error in replay checkpoint loading.#18261
Merged
LibretroAdmin merged 1 commit intolibretro:masterfrom Sep 16, 2025
Merged
Fix an off-by-one error in replay checkpoint loading.#18261LibretroAdmin merged 1 commit intolibretro:masterfrom
LibretroAdmin merged 1 commit intolibretro:masterfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_unserializecall in bsvmovie.c has been deferred to the following invocation ofbsv_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.