From 3fde8f8073a8a8d2e250d20da2627517963f1c1c Mon Sep 17 00:00:00 2001 From: Sour Date: Sat, 25 Jan 2020 13:40:24 -0500 Subject: [PATCH] Run Ahead: Fixed some issues with FDS/VS System system actions not being processed properly --- Core/FDS.cpp | 5 ++++- Core/FDS.h | 2 +- Core/FdsSystemActionManager.h | 5 ++++- Core/VsSystemActionManager.h | 4 ++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Core/FDS.cpp b/Core/FDS.cpp index 7259bb02..1855bdc6 100644 --- a/Core/FDS.cpp +++ b/Core/FDS.cpp @@ -488,7 +488,10 @@ void FDS::StreamState(bool saving) Stream(_irqReloadValue, _irqCounter, _irqEnabled, _irqRepeatEnabled, _diskRegEnabled, _soundRegEnabled, _writeDataReg, _motorOn, _resetTransfer, _readMode, _crcControl, _diskReady, _diskIrqEnabled, _extConWriteReg, _badCrc, _endOfHead, _readWriteEnabled, _readDataReg, _diskWriteProtected, - _diskNumber, _diskPosition, _delay, _previousCrcControlFlag, _gapEnded, _scanningDisk, _transferComplete, audio); + _diskNumber, _diskPosition, _delay, _previousCrcControlFlag, _gapEnded, _scanningDisk, _transferComplete, audio, + _autoDiskEjectCounter, _autoDiskSwitchCounter, _restartAutoInsertCounter, _previousFrame, _lastDiskCheckFrame, + _successiveChecks, _previousDiskNumber, _crcAccumulator + ); if(saving) { for(size_t i = 0; i < _fdsDiskSides.size(); i++) { diff --git a/Core/FDS.h b/Core/FDS.h index 7adb252a..9dbb4a03 100644 --- a/Core/FDS.h +++ b/Core/FDS.h @@ -73,7 +73,7 @@ private: vector> _orgDiskSides; vector> _orgDiskHeaders; - bool _gameStarted; + bool _gameStarted = false; bool _needSave = false; protected: diff --git a/Core/FdsSystemActionManager.h b/Core/FdsSystemActionManager.h index b1ab43a2..75daa79b 100644 --- a/Core/FdsSystemActionManager.h +++ b/Core/FdsSystemActionManager.h @@ -72,7 +72,6 @@ public: if(diskToInsert >= 0) { mapper->InsertDisk(diskToInsert); - } } } @@ -105,7 +104,9 @@ public: if(!IsAutoInsertDiskEnabled()) { shared_ptr mapper = _mapper.lock(); if(mapper && mapper->IsDiskInserted()) { + _console->Pause(); InsertDisk((mapper->GetCurrentDisk() ^ 0x01) % mapper->GetSideCount()); + _console->Resume(); } } } @@ -115,7 +116,9 @@ public: if(!IsAutoInsertDiskEnabled()) { shared_ptr mapper = _mapper.lock(); if(mapper) { + _console->Pause(); InsertDisk(((mapper->GetCurrentDisk() & 0xFE) + 2) % mapper->GetSideCount()); + _console->Resume(); } } } diff --git a/Core/VsSystemActionManager.h b/Core/VsSystemActionManager.h index d38935ed..d6d68f09 100644 --- a/Core/VsSystemActionManager.h +++ b/Core/VsSystemActionManager.h @@ -76,13 +76,17 @@ public: void InsertCoin(uint8_t port) { if(port < 4) { + _console->Pause(); _needInsertCoin[port] = VsSystemActionManager::InsertCoinFrameCount; MessageManager::DisplayMessage("VS System", "CoinInsertedSlot", std::to_string(port + 1)); + _console->Resume(); } } void SetServiceButtonState(int consoleId, bool pressed) { + _console->Pause(); _needServiceButton[consoleId] = pressed; + _console->Resume(); } }; \ No newline at end of file