diff --git a/pcsx2/SaveState.h b/pcsx2/SaveState.h index beadcf3efe..f250ccf19e 100644 --- a/pcsx2/SaveState.h +++ b/pcsx2/SaveState.h @@ -33,7 +33,7 @@ enum class FreezeAction // [SAVEVERSION+] // This informs the auto updater that the users savestates will be invalidated. -static const u32 g_SaveVersion = (0x9A31 << 16) | 0x0000; +static const u32 g_SaveVersion = (0x9A32 << 16) | 0x0000; // the freezing data between submodules and core diff --git a/pcsx2/Sio.cpp b/pcsx2/Sio.cpp index f0ee1ab3dd..22e928e81b 100644 --- a/pcsx2/Sio.cpp +++ b/pcsx2/Sio.cpp @@ -917,9 +917,34 @@ void SaveStateBase::sio2Freeze() Freeze(sio2); + // CRCs for memory cards. + // If the memory card hasn't changed when loading state, we can safely skip ejecting it. + u64 mcdCrcs[SIO::PORTS][SIO::SLOTS]; + if (IsSaving()) + { + for (u32 port = 0; port < SIO::PORTS; port++) + { + for (u32 slot = 0; slot < SIO::SLOTS; slot++) + mcdCrcs[port][slot] = mcds[port][slot].GetChecksum(); + } + } + Freeze(mcdCrcs); + if (IsLoading()) { - AutoEject::SetAll(); + bool ejected = false; + for (u32 port = 0; port < SIO::PORTS && !ejected; port++) + { + for (u32 slot = 0; slot < SIO::SLOTS; slot++) + { + if (mcdCrcs[port][slot] != mcds[port][slot].GetChecksum()) + { + AutoEject::SetAll(); + ejected = true; + break; + } + } + } // Restore fifoIn fifoIn.clear();