mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 21:37:42 -07:00
Skip saving/loading GBA flash state if SRAM is null
This commit is contained in:
parent
2abdcc54dd
commit
a57ba1368e
@ -96,18 +96,24 @@ void DoSavestate(Savestate* file)
|
||||
u32 oldlen = SRAMLength;
|
||||
|
||||
file->Var32(&SRAMLength);
|
||||
|
||||
if (SRAMLength != oldlen)
|
||||
{
|
||||
printf("savestate (GBA): VERY BAD!!!! SRAM LENGTH DIFFERENT. %d -> %d\n", oldlen, SRAMLength);
|
||||
printf("oh well. loading it anyway. iojkjkojo\n");
|
||||
|
||||
// reallocate save memory
|
||||
if (oldlen) delete[] SRAM;
|
||||
if (SRAMLength) SRAM = new u8[SRAMLength];
|
||||
}
|
||||
if (SRAMLength)
|
||||
{
|
||||
// fill save memory if data is present
|
||||
file->VarArray(SRAM, SRAMLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
// no save data, nothing left to do
|
||||
SRAMType = SaveType::S_NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
// persist some extra state info
|
||||
file->Var8(&SRAMFlashState.bank);
|
||||
|
Loading…
Reference in New Issue
Block a user