Added an exception check when the game is close to overflowing. Fixes the fifo overflow that occurs in Battalion Wars 2.

Changed the CPEnd loop check to an exact match.
This commit is contained in:
skidau 2014-11-17 16:05:16 +11:00
parent 3d448e49c6
commit ca3e5ce5e1

View File

@ -330,7 +330,7 @@ void GatherPipeBursted()
}
// update the fifo pointer
if (fifo.CPWritePointer >= fifo.CPEnd)
if (fifo.CPWritePointer == fifo.CPEnd)
fifo.CPWritePointer = fifo.CPBase;
else
fifo.CPWritePointer += GATHER_PIPE_SIZE;
@ -342,6 +342,10 @@ void GatherPipeBursted()
ProcessorInterface::Fifo_CPUEnd = fifo.CPEnd;
}
// If the game is running close to overflowing, make the exception checking more frequent.
if (fifo.bFF_HiWatermark)
CoreTiming::ForceExceptionCheck(0);
Common::AtomicAdd(fifo.CPReadWriteDistance, GATHER_PIPE_SIZE);
RunGpu();
@ -470,8 +474,7 @@ void ProcessFifoAllDistance()
{
if (IsOnThread())
{
while (!interruptWaiting && fifo.bFF_GPReadEnable &&
fifo.CPReadWriteDistance && !AtBreakpoint())
while (!interruptWaiting && fifo.bFF_GPReadEnable && fifo.CPReadWriteDistance && !AtBreakpoint())
Common::YieldCPU();
}
}