Keep device type EXIDEVICE_MEMORYCARDFOLDER for gci folder.

This fixes loading save states when type mismatches.
This commit is contained in:
Rachel Bryk 2014-07-05 00:07:46 -04:00
parent ee100cf827
commit e02f680861
3 changed files with 5 additions and 2 deletions

View File

@ -103,7 +103,6 @@ IEXIDevice* EXIDevice_Create(TEXIDevices device_type, const int channel_num)
{ {
bool gci_folder = (device_type == EXIDEVICE_MEMORYCARDFOLDER); bool gci_folder = (device_type == EXIDEVICE_MEMORYCARDFOLDER);
result = new CEXIMemoryCard(channel_num, gci_folder); result = new CEXIMemoryCard(channel_num, gci_folder);
device_type = EXIDEVICE_MEMORYCARD;
break; break;
} }
case EXIDEVICE_MASKROM: case EXIDEVICE_MASKROM:

View File

@ -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 // note that userdata is forbidden to be a pointer, due to the implementation of EventDoState
int card_index = (int)userdata; int card_index = (int)userdata;
CEXIMemoryCard* pThis = (CEXIMemoryCard*)ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARD, card_index); CEXIMemoryCard* pThis = (CEXIMemoryCard*)ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARD, card_index);
if (pThis == nullptr)
pThis = (CEXIMemoryCard*)ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARDFOLDER, card_index);
if (pThis && pThis->memorycard) if (pThis && pThis->memorycard)
pThis->memorycard->Flush(); pThis->memorycard->Flush();
} }
@ -41,6 +43,8 @@ void CEXIMemoryCard::CmdDoneCallback(u64 userdata, int cyclesLate)
{ {
int card_index = (int)userdata; int card_index = (int)userdata;
CEXIMemoryCard* pThis = (CEXIMemoryCard*)ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARD, card_index); CEXIMemoryCard* pThis = (CEXIMemoryCard*)ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARD, card_index);
if (pThis == nullptr)
pThis = (CEXIMemoryCard*)ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARDFOLDER, card_index);
if (pThis) if (pThis)
pThis->CmdDone(); pThis->CmdDone();
} }

View File

@ -63,7 +63,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread; static std::thread g_save_thread;
// Don't forget to increase this after doing changes on the savestate system // 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 enum
{ {