Emulator Issues #12220
Potential save corruption when loading savestate with matching GCI card header but mismatching BAT.
A scenario I missed in https://github.com/dolphin-emu/dolphin/pull/8879. Thankfully it seems most games work fine regardless since they read BAT on-demand, but clearly some do not...
Game ID? (right click the game in the game list, Properties, Info tab)
MD5 Hash? (right click the game in the game list, Properties, Verify tab, Verify Integrity button)
What's the problem? Describe what went wrong.
Internal game state and GCI folder state mismatch when loading savestates in a specific way, which potentially causes save corruption. See below for details.
What steps will reproduce the problem?
BACKUP YOUR GAMECUBE SAVES BEFORE ATTEMPTING THIS, just in case.
- Make sure you have GCI folder set as Slot A.
- Load F-Zero GX.
- Go to Options -> Memory Card -> Manage Game Data -> Save Game Data.
- The game will ask you if it's okay to overwrite the existing save. On this screen, make a savestate.
- Confirm the prompt and let it save.
- Afterwards reload the savestate.
- Confirm the prompt again.
- What happens now depends on how your loaded memory card looks internally, but more likely than not, Dolphin will PanicAlert with "BAT incorrect. Dolphin will now exit".
Even more scary, if you attempt this with a regular Memory Card instead of a GCI folder, the write just 'goes through' and kinda-sorta reverts the memory card Dir/BAT to the state when the savestate was made. Which, uh, just kinda breaks the card if it has had major changes since -- see attachment.
The fix for this is simple enough, compare more of the memcard state (Dir and BAT) on state load and force a eject/reinsert if it mismatches.
Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.
Yes, tested on 5.0-12392 (not entirely latest but close enough, and I know there have no changes here since then)
Is the issue present in the latest stable version?
Haven't tested, but I assume so.
If the issue isn't present in the latest stable version, which is the first broken version? (You can find the first broken version by bisecting. Windows users can use the tool https://forums.dolphin-emu.org/Thread-green-notice-development-thread-unofficial-dolphin-bisection-tool-for-finding-broken-builds and anyone who is building Dolphin on their own can use git bisect.)
Probably has always been broken in some way.