Project

General

Profile

Emulator Issues #12220

Potential save corruption when loading savestate with matching GCI card header but mismatching BAT.

Added by Pikachu025 about 2 months ago. Updated 16 days ago.

Status:
Fix pending
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

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 Name?

F-Zero GX

Game ID? (right click the game in the game list, Properties, Info tab)

GFZP01

MD5 Hash? (right click the game in the game list, Properties, Verify tab, Verify Integrity button)

e1081d2e1701de9dd5114388e361dbdf

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".

Oops.

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.

oops.png (174 KB) oops.png Pikachu025, 08/11/2020 05:44 PM
7919

History

#1 Updated by JMC4789 16 days ago

  • Status changed from New to Accepted

#3 Updated by JosJuice 16 days ago

  • Status changed from Accepted to Fix pending

Also available in: Atom PDF