- implement save state of "Memory Expansion Pak";
This commit is contained in:
mtabachenko 2013-11-12 11:08:23 +00:00
parent 429afd87f6
commit ed85c3df12
1 changed files with 25 additions and 0 deletions

View File

@ -162,6 +162,31 @@ public:
return 0xFFFFFFFF;
}
virtual void savestate(EMUFILE* os)
{
s32 version = 0;
EMUFILE_MEMORY *ram = new EMUFILE_MEMORY(expMemory, EXPANSION_MEMORY_SIZE);
os->write32le(version);
os->write32le((u32)ext_ram_lock);
os->writeMemoryStream(ram);
delete ram;
}
virtual void loadstate(EMUFILE* is)
{
EMUFILE_MEMORY *ram = new EMUFILE_MEMORY();
s32 version = is->read32le();
if (version >= 0)
{
is->read32le((u32*)&ext_ram_lock);
is->readMemoryStream(ram);
memcpy(expMemory, ram->buf(), std::min(EXPANSION_MEMORY_SIZE, ram->size()));
}
delete ram;
}
};
ISlot2Interface* construct_Slot2_ExpansionPak() { return new Slot2_ExpansionPak(); }