MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / CheckForMemoryCardConfigChanges

Method CheckForMemoryCardConfigChanges

pcsx2/VMManager.cpp:3034–3079  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3032}
3033
3034void VMManager::CheckForMemoryCardConfigChanges(const Pcsx2Config& old_config)
3035{
3036 bool changed = false;
3037
3038 for (size_t i = 0; i < std::size(EmuConfig.Mcd); i++)
3039 {
3040 if (EmuConfig.Mcd[i].Enabled != old_config.Mcd[i].Enabled ||
3041 EmuConfig.Mcd[i].Filename != old_config.Mcd[i].Filename)
3042 {
3043 changed = true;
3044 break;
3045 }
3046 }
3047
3048 if (!changed)
3049 return;
3050
3051 Console.WriteLn("Updating memory card configuration");
3052
3053 // force card eject when files change
3054 for (u32 port = 0; port < 2; port++)
3055 {
3056 for (u32 slot = 0; slot < 4; slot++)
3057 {
3058 const uint index = FileMcd_ConvertToSlot(port, slot);
3059 if (EmuConfig.Mcd[index].Enabled != old_config.Mcd[index].Enabled ||
3060 EmuConfig.Mcd[index].Filename != old_config.Mcd[index].Filename)
3061 {
3062 Console.WriteLn("Ejecting memory card %u (port %u slot %u) due to source change", index, port, slot);
3063 AutoEject::Set(port, slot);
3064 }
3065 }
3066 }
3067 // force reindexing, mc folder code is janky
3068 std::string sioSerial;
3069 {
3070 std::unique_lock lock(s_info_mutex);
3071 if (const GameDatabaseSchema::GameEntry* game = GameDatabase::findGame(s_disc_serial))
3072 sioSerial = game->memcardFiltersAsString();
3073 if (sioSerial.empty())
3074 sioSerial = s_disc_serial;
3075 }
3076
3077 if (!GSDumpReplayer::IsReplayingDump())
3078 FileMcd_Reopen(sioSerial);
3079}
3080
3081void VMManager::CheckForMiscConfigChanges(const Pcsx2Config& old_config)
3082{

Callers

nothing calls this directly

Calls 7

FileMcd_ConvertToSlotFunction · 0.85
SetFunction · 0.85
FileMcd_ReopenFunction · 0.85
sizeFunction · 0.50
WriteLnMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected