Skip to content

Defer auto state load for cores requiring initialization - #19487

Open
saboten731 wants to merge 1 commit into
libretro:masterfrom
saboten731:pr/defer-auto-state-load
Open

Defer auto state load for cores requiring initialization#19487
saboten731 wants to merge 1 commit into
libretro:masterfrom
saboten731:pr/defer-auto-state-load

Conversation

@saboten731

Copy link
Copy Markdown

Summary

Honor RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE when State Auto Load is enabled.

For cores that advertise this quirk, automatic state loading is deferred until the core has had an initial execution opportunity. The existing state-loading path is then used unchanged.

Problem

Some cores are not ready to unserialize a save state immediately after content loading.

RetroArch can currently attempt State Auto Load before such a core has completed initialization. This can cause automatic loading to fail even though loading the same state manually after startup succeeds.

Solution

Track whether the active core advertises RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE.

When it does, defer the initial automatic state-load request until after the core has completed its first top-level execution cycle, then invoke the existing Auto Load path.

The deferred request is one-shot and is cleared across content/core lifecycle changes.

Cores that do not advertise RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE continue to use the existing Auto Load path without the added delay.

Testing

Built and tested on Android AArch64 with Mupen64Plus-Next using GLideN64/OpenGL.

With State Auto Save and State Auto Load enabled:

  1. Launched a game and progressed to a recognizable game state.
  2. Exited normally and confirmed the automatic state was saved.
  3. Relaunched the same content.
  4. The saved state was restored automatically without invoking Load State manually.

State saving, startup, and gameplay remained stable during testing.

Related

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.

1 participant