VMManager: Cycle/autoeject memory cards when files change

Hopefully should fix card changes not getting picked up in some games.
This commit is contained in:
Connor McLaughlin 2022-06-06 22:48:23 +10:00 committed by refractionpcsx2
parent cf07f4aef1
commit 547b2fc9e8
2 changed files with 16 additions and 0 deletions

View File

@ -121,6 +121,7 @@ extern void sioWrite8(u8 value);
extern void sioWriteCtrl16(u16 value); extern void sioWriteCtrl16(u16 value);
extern void sioInterrupt(); extern void sioInterrupt();
extern void sioInterruptR(); extern void sioInterruptR();
extern void SetForceMcdEjectTimeoutNow(uint port, uint slot);
extern void SetForceMcdEjectTimeoutNow(); extern void SetForceMcdEjectTimeoutNow();
extern void ClearMcdEjectTimeoutNow(); extern void ClearMcdEjectTimeoutNow();
extern void sioStatRead(); extern void sioStatRead();

View File

@ -1535,6 +1535,21 @@ void VMManager::CheckForMemoryCardConfigChanges(const Pcsx2Config& old_config)
FileMcd_EmuClose(); FileMcd_EmuClose();
FileMcd_EmuOpen(); FileMcd_EmuOpen();
// force card eject when files change
for (u32 port = 0; port < 2; port++)
{
for (u32 slot = 0; slot < 4; slot++)
{
const uint index = FileMcd_ConvertToSlot(port, slot);
if (EmuConfig.Mcd[index].Enabled != old_config.Mcd[index].Enabled ||
EmuConfig.Mcd[index].Filename != old_config.Mcd[index].Filename)
{
Console.WriteLn("Replugging memory card %u (port %u slot %u) due to source change", index, port, slot);
SetForceMcdEjectTimeoutNow(port, slot);
}
}
}
// force reindexing, mc folder code is janky // force reindexing, mc folder code is janky
std::string sioSerial; std::string sioSerial;
{ {