From ddb87027f958e8e56ad81ae14022b9eec0809968 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Sat, 19 Sep 2015 13:10:58 +0300 Subject: [PATCH] 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. --- pcsx2/Counters.cpp | 4 +++- pcsx2/gui/MemoryCardFolder.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pcsx2/Counters.cpp b/pcsx2/Counters.cpp index cb9b299a36..c3263d4049 100644 --- a/pcsx2/Counters.cpp +++ b/pcsx2/Counters.cpp @@ -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 diff --git a/pcsx2/gui/MemoryCardFolder.h b/pcsx2/gui/MemoryCardFolder.h index 2f7378f23f..0072584df7 100644 --- a/pcsx2/gui/MemoryCardFolder.h +++ b/pcsx2/gui/MemoryCardFolder.h @@ -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 {