From e02f680861c2e80a4cbca669a199dcf466ca71a9 Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Sat, 5 Jul 2014 00:07:46 -0400 Subject: [PATCH] Keep device type EXIDEVICE_MEMORYCARDFOLDER for gci folder. This fixes loading save states when type mismatches. --- Source/Core/Core/HW/EXI_Device.cpp | 1 - Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp | 4 ++++ Source/Core/Core/State.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/HW/EXI_Device.cpp b/Source/Core/Core/HW/EXI_Device.cpp index 53a79ed295..dbd2807112 100644 --- a/Source/Core/Core/HW/EXI_Device.cpp +++ b/Source/Core/Core/HW/EXI_Device.cpp @@ -103,7 +103,6 @@ IEXIDevice* EXIDevice_Create(TEXIDevices device_type, const int channel_num) { bool gci_folder = (device_type == EXIDEVICE_MEMORYCARDFOLDER); result = new CEXIMemoryCard(channel_num, gci_folder); - device_type = EXIDEVICE_MEMORYCARD; break; } case EXIDEVICE_MASKROM: diff --git a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp index 96de4866f2..dd0b2a3e5b 100644 --- a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp @@ -33,6 +33,8 @@ void CEXIMemoryCard::FlushCallback(u64 userdata, int cyclesLate) // note that userdata is forbidden to be a pointer, due to the implementation of EventDoState int card_index = (int)userdata; CEXIMemoryCard* pThis = (CEXIMemoryCard*)ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARD, card_index); + if (pThis == nullptr) + pThis = (CEXIMemoryCard*)ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARDFOLDER, card_index); if (pThis && pThis->memorycard) pThis->memorycard->Flush(); } @@ -41,6 +43,8 @@ void CEXIMemoryCard::CmdDoneCallback(u64 userdata, int cyclesLate) { int card_index = (int)userdata; CEXIMemoryCard* pThis = (CEXIMemoryCard*)ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARD, card_index); + if (pThis == nullptr) + pThis = (CEXIMemoryCard*)ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARDFOLDER, card_index); if (pThis) pThis->CmdDone(); } diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index 681411dbb4..55cd1a2fa7 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -63,7 +63,7 @@ static Common::Event g_compressAndDumpStateSyncEvent; static std::thread g_save_thread; // Don't forget to increase this after doing changes on the savestate system -static const u32 STATE_VERSION = 27; +static const u32 STATE_VERSION = 28; enum {