mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-25 15:19:53 -06:00
add BIOS and firmware to savestates
This commit is contained in:
@ -858,8 +858,8 @@ bool DoSavestate(Savestate* file)
|
|||||||
file->VarArray(SharedWRAM, SharedWRAMSize);
|
file->VarArray(SharedWRAM, SharedWRAMSize);
|
||||||
file->VarArray(ARM7WRAM, ARM7WRAMSize);
|
file->VarArray(ARM7WRAM, ARM7WRAMSize);
|
||||||
|
|
||||||
//file->VarArray(ARM9BIOS, 0x1000);
|
file->VarArray(ARM9BIOS, 0x1000);
|
||||||
//file->VarArray(ARM7BIOS, 0x4000);
|
file->VarArray(ARM7BIOS, 0x4000);
|
||||||
|
|
||||||
file->VarArray(ExMemCnt, 2*sizeof(u16));
|
file->VarArray(ExMemCnt, 2*sizeof(u16));
|
||||||
file->VarArray(ROMSeed0, 2*8);
|
file->VarArray(ROMSeed0, 2*8);
|
||||||
|
22
src/SPI.cpp
22
src/SPI.cpp
@ -458,6 +458,28 @@ void DoSavestate(Savestate* file)
|
|||||||
|
|
||||||
// CHECKME/TODO: trust the firmware to stay the same?????
|
// CHECKME/TODO: trust the firmware to stay the same?????
|
||||||
// embedding the whole firmware in the savestate would be derpo tho??
|
// embedding the whole firmware in the savestate would be derpo tho??
|
||||||
|
file->Var32(&FirmwareLength);
|
||||||
|
if (file->Saving)
|
||||||
|
{
|
||||||
|
file->VarArray(Firmware, FirmwareLength);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Firmware) delete[] Firmware;
|
||||||
|
Firmware = new u8[FirmwareLength];
|
||||||
|
file->VarArray(Firmware, FirmwareLength);
|
||||||
|
|
||||||
|
FirmwareMask = FirmwareLength - 1;
|
||||||
|
|
||||||
|
u32 userdata = 0x7FE00 & FirmwareMask;
|
||||||
|
if (*(u16*)&Firmware[userdata+0x170] == ((*(u16*)&Firmware[userdata+0x70] + 1) & 0x7F))
|
||||||
|
{
|
||||||
|
if (VerifyCRC16(0xFFFF, userdata+0x100, 0x70, userdata+0x172))
|
||||||
|
userdata += 0x100;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserSettings = userdata;
|
||||||
|
}
|
||||||
|
|
||||||
file->Var32(&Hold);
|
file->Var32(&Hold);
|
||||||
file->Var8(&CurCmd);
|
file->Var8(&CurCmd);
|
||||||
|
Reference in New Issue
Block a user