reinitialize rewind buffer after loading game with achievements #15934
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.
Description
Fixes #15933.
Because the achievement state needs to be included in the rewind buffer, the rewind manager has to be reset after the achievements are loaded so it has the proper size of a per-frame state.
Prior to #15912 rewind was disabled after identifying the game being loaded, and then re-enabled after the game was loaded. Identifying the loaded game is an asynchronous call to the server, so rewind wouldn't be disabled immediately when the game was loaded. And when it was re-enabled, the per frame state size would include the achievement state.
With the changes in #15912, identifying the game is part of a library call to load a game, so rewind was being disabled earlier; too early. The achievement
rcheevos_load
handler is being called earlier incontent_init
than the rewind state initialization code, so rewind was getting re-enabled immediately and it was still enabled when the achievement code tried to re-enable it later. As a result, the rewind state manager was still expecting frames without achievement state, so when a frame was captured with achievement state, it was too big and the state manager would discard it.Solution: Instead of disabling rewind when
rcheevos_load
is called, quickly toggle it off and back on once the achievements are loaded so the per-frame size is correct.Related Issues
#15933
Related Pull Requests
n/a
Reviewers
@Sanaki