Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reinitialize rewind buffer after loading game with achievements #15934

Merged
merged 2 commits into from
Nov 22, 2023

Conversation

Jamiras
Copy link
Contributor

@Jamiras Jamiras commented Nov 20, 2023

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 in content_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

@LibretroAdmin LibretroAdmin merged commit 39a4441 into libretro:master Nov 22, 2023
@Jamiras Jamiras deleted the fix_ach_rewind branch November 23, 2023 16:56
@dontsnm
Copy link

dontsnm commented Nov 26, 2023

With some cores like Snes9x and genesis plus, rewind doesn't work with achievements enabled.

@brigcam
Copy link

brigcam commented Mar 1, 2024

still having this issue here, it seems to happen when a game has no achievements (eg on 32x After Burner has the issue, but Spider-Man works fine). I'm on git version 07de6d9. it seems the same behaviour described here: #15933 (comment)

Sunderland93 pushed a commit to Sunderland93/RetroArch that referenced this pull request Dec 26, 2024
…etro#15934)

* reinitialize rewind buffer after loading game with achievements

* fix #endif placement for HAVE_GFX_WIDGETS
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.

If rewind and cheevos are enabled at the same time, rewind breaks unless it is toggled after content is loaded
4 participants