mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 06:10:03 -06:00
Improved SRAM performance (#925)
* Offload NDS SRAM writing to separate thread, debounce writes to two seconds after last flush or DeInit. * Fixed printf messages. * Fixes after CR. * Fixed potential portability issue with time_t
This commit is contained in:
@ -27,7 +27,7 @@
|
||||
#include "Config.h"
|
||||
#include "ROMList.h"
|
||||
#include "melonDLDI.h"
|
||||
|
||||
#include "NDSCart_SRAMManager.h"
|
||||
|
||||
namespace NDSCart_SRAM
|
||||
{
|
||||
@ -145,6 +145,8 @@ void LoadSave(const char* path, u32 type)
|
||||
}
|
||||
}
|
||||
|
||||
NDSCart_SRAMManager::Setup(path, SRAM, SRAMLength);
|
||||
|
||||
switch (SRAMLength)
|
||||
{
|
||||
case 512: WriteFunc = Write_EEPROMTiny; break;
|
||||
@ -450,17 +452,10 @@ void Write(u8 val, u32 hold)
|
||||
|
||||
void FlushSRAMFile()
|
||||
{
|
||||
if (!SRAMFileDirty)
|
||||
return;
|
||||
if (!SRAMFileDirty) return;
|
||||
|
||||
SRAMFileDirty = false;
|
||||
|
||||
FILE* f = Platform::OpenFile(SRAMPath, "wb");
|
||||
if (f)
|
||||
{
|
||||
fwrite(SRAM, SRAMLength, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
NDSCart_SRAMManager::RequestFlush();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user