SRAM things (#970)

* Allow SRAMManager to save to/load from a buffer.

* Don't delete what doesn't exist. Don't create a thread that will do absolutely nothing.

* Update SRAMManager's SecondaryBuffer when loading a savestate.
This commit is contained in:
SuuperW
2021-02-22 19:46:02 -06:00
committed by GitHub
parent 58dd1ec580
commit 94dcc9523e
3 changed files with 58 additions and 19 deletions

View File

@ -111,6 +111,10 @@ void DoSavestate(Savestate* file)
file->Var8(&StatusReg);
file->Var32(&Addr);
// SRAMManager might now have an old buffer (or one from the future or alternate timeline!)
if (!file->Saving)
NDSCart_SRAMManager::RequestFlush();
}
void LoadSave(const char* path, u32 type)
@ -145,6 +149,7 @@ void LoadSave(const char* path, u32 type)
}
}
SRAMFileDirty = false;
NDSCart_SRAMManager::Setup(path, SRAM, SRAMLength);
switch (SRAMLength)