Skip to content

Comments

Fix replay rewind/load state bug#16710

Merged
LibretroAdmin merged 3 commits intolibretro:masterfrom
JoeOsborn:add-intfstream-truncate
Jun 18, 2024
Merged

Fix replay rewind/load state bug#16710
LibretroAdmin merged 3 commits intolibretro:masterfrom
JoeOsborn:add-intfstream-truncate

Conversation

@JoeOsborn
Copy link
Contributor

Currently, doing these actions will cause issues with replays (desync):

  1. Start recording a replay in any game and core (e.g. Super Mario Bros on FCEUX)
  2. Make a savestate
  3. Hold right for 5 seconds
  4. Load your savestate
  5. Hold left for 1 second
  6. Stop recording

On playback, you'll see 1 second of holding left followed by 4 seconds of holding right, because while we seek to the replay state as of the loaded state we don't truncate the file. This patch adds intfstream_truncate and uses it while recording to fix record-and-replay.

Will return 0 for non-file streams.  I didn't want to mess around with
memory_stream (which could in theory have a truncate impl that sets
size) because there were globals and stuff and I got nervous (also
truncate might *grow* a file if the new length is longer than the old
one and then I'd have to think about realloc, etc).
@LibretroAdmin LibretroAdmin merged commit e51a316 into libretro:master Jun 18, 2024
@QixuanZhao
Copy link

Is this released?

@JoeOsborn
Copy link
Contributor Author

I believe the last release was June 4 so probably not?

@QixuanZhao
Copy link

Looking forward😄

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.

3 participants