folderMemoryCard: hack - don't call hundreds of times per second

In order to flush data with some delay after save-to-memory-card, the code was
calling sioNextFrame() on each frames (60 times/s) continuously as long as the
emulation is active, regardless if FMC is in use or if memory cards in general
are in use.

Further to that, each call to sioNextFrame calls 8 times into the memory card
plugin even if FMC is not in use, resulting in overall ~500 calls/sec with the
sole goal of facilitating delayed flush after MCD save with folder memory cards.

This patch is a hack to call it once per second instead of 60 per second, but we
need to remove this call completely.

The delayed flush will now happen after 60-120 frames instead of exactly 60.
This commit is contained in:
Avi Halachmi (:avih) 2015-09-19 13:10:58 +03:00
parent ef9016e363
commit ddb87027f9
2 changed files with 4 additions and 2 deletions

View File

@ -434,7 +434,9 @@ static __fi void VSyncEnd(u32 sCycle)
if (gates) rcntEndGate(true, sCycle); // Counters End Gate Code
// FolderMemoryCard needs information on how much time has passed since the last write
sioNextFrame();
// Call it every 60 frames
if (!(g_FrameCount % 60))
sioNextFrame();
frameLimit(); // limit FPS

View File

@ -256,7 +256,7 @@ public:
static const u32 NextDataClusterMask = 0x7FFFFFFFu;
static const u32 DataClusterInUseMask = 0x80000000u;
static const int FramesAfterWriteUntilFlush = 60;
static const int FramesAfterWriteUntilFlush = 2;
protected:
union superBlockUnion {