diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.cpp b/Source/Core/VideoCommon/Src/CommandProcessor.cpp index e6a0589ba5..0adbf42b9b 100644 --- a/Source/Core/VideoCommon/Src/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/Src/CommandProcessor.cpp @@ -118,6 +118,7 @@ volatile bool interruptSet= false; volatile bool interruptWaiting= false; volatile bool interruptTokenWaiting = false; volatile bool interruptFinishWaiting = false; +volatile bool OnOverflow = false; void FifoCriticalEnter() { @@ -669,6 +670,26 @@ void STACKALIGN GatherPipeBursted() UpdateInterruptsScMode(); } } + else + { + if(fifo.CPReadWriteDistance == fifo.CPEnd - fifo.CPBase - 32) + { + if(!OnOverflow) + NOTICE_LOG(COMMANDPROCESSOR,"FIFO is almost in overflown, BreakPoint: %i", fifo.bFF_Breakpoint); + OnOverflow = true; + while (!CommandProcessor::interruptWaiting && fifo.bFF_GPReadEnable && + fifo.CPReadWriteDistance > fifo.CPEnd - fifo.CPBase - 64) + Common::YieldCPU(); + + + + + } + else + { + OnOverflow = false; + } + } _assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase, diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.h b/Source/Core/VideoCommon/Src/CommandProcessor.h index 9d98c802d2..cd39d4b0c4 100644 --- a/Source/Core/VideoCommon/Src/CommandProcessor.h +++ b/Source/Core/VideoCommon/Src/CommandProcessor.h @@ -35,6 +35,7 @@ extern volatile bool interruptSet; extern volatile bool interruptWaiting; extern volatile bool interruptTokenWaiting; extern volatile bool interruptFinishWaiting; +extern volatile bool OnOverflow; // internal hardware addresses enum diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index 1259b5c51a..72bb2e7ca0 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -150,7 +150,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) CommandProcessor::SetStatus(); while (!CommandProcessor::interruptWaiting && _fifo.bFF_GPReadEnable && - _fifo.CPReadWriteDistance && !AtBreakpoint()) + (_fifo.CPReadWriteDistance && !AtBreakpoint() || CommandProcessor::OnOverflow)) { // while the FIFO is processing data we activate this for sync with emulator thread.