RALibretro icon indicating copy to clipboard operation
RALibretro copied to clipboard

Operations following a load failure cause access violation errors

Open rzumer opened this issue 6 years ago • 7 comments

This is observable when attempting to load a file using the FCEUmm core, following an attempt at loading an FDS file without a system present (or regardless of that condition, prior to #35). Attempting to unload (in code) also generates errors, including exiting the application.

Further investigation is required in order to determine the root cause and other situations where the application can enter such a state.

rzumer avatar Aug 05 '18 16:08 rzumer

So to replicate this issue I have to load a regular NES ROM after a failed attempt to load a FDS file, right? I'll take a look.

leiradel avatar Aug 05 '18 16:08 leiradel

Thanks for the report.

leiradel avatar Aug 05 '18 16:08 leiradel

Every operation tested, including switching cores or exiting the application, causes access violations after the first failed load attempt.

rzumer avatar Aug 05 '18 16:08 rzumer

This also occurs when attempting to load headerless files via FCEUmm (no surprise, but it is another way to reproduce the issue).

rzumer avatar Sep 11 '18 13:09 rzumer

Every operation tested, including switching cores or exiting the application, causes access violations after the first failed load attempt.

Failing to load the game results in a call to _core.destroy, which resets all the function pointers. Attempting to change the core results in call to _core.deinit which is now a null pointer. Attempting to load a different game results in a call to _core.loadGame which is now a null pointer.

It seems like failing to load a game should not destroy the core. It behaves like the core is still active, even if a game isn't.

Jamiras avatar Sep 29 '18 14:09 Jamiras

also recommend modifying/extending the error reporting added in #35 so users are informed when a game fails to load.

Jamiras avatar Sep 29 '18 16:09 Jamiras

I believe the crash has been addressed by this change: https://github.com/RetroAchievements/RALibretro/pull/146/files#diff-fde495e29ccb3e6e525307003905d382R1157-R1160

The internal state is updated to "no core loaded" when a game fails to load.

It's probably still desirable to not unload the core when a game fails to load, so I'm not certain this should be closed yet.

Jamiras avatar Dec 14 '19 16:12 Jamiras