mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Added an external exception check when the CPU writes to the FIFO. This allows the CPU time to service FIFO overflows. Fixes random hangs caused by FIFO overflows and desyncs like in "The Last Story" and "Battalion Wars 2". Thanks to marcosvitali for the research.
Fixes issue 5209. Fixes issue 5150. Fixes issue 5055. Fixes issue 4889. Fixes issue 4061. Fixes issue 4010. Fixes issue 3902.
This commit is contained in:
@ -60,7 +60,6 @@ volatile bool interruptSet= false;
|
||||
volatile bool interruptWaiting= false;
|
||||
volatile bool interruptTokenWaiting = false;
|
||||
volatile bool interruptFinishWaiting = false;
|
||||
volatile bool OnOverflow = false;
|
||||
|
||||
bool IsOnThread()
|
||||
{
|
||||
@ -92,7 +91,6 @@ void DoState(PointerWrap &p)
|
||||
p.Do(interruptWaiting);
|
||||
p.Do(interruptTokenWaiting);
|
||||
p.Do(interruptFinishWaiting);
|
||||
p.Do(OnOverflow);
|
||||
}
|
||||
|
||||
inline void WriteLow (volatile u32& _reg, u16 lowbits) {Common::AtomicStore(_reg,(_reg & 0xFFFF0000) | lowbits);}
|
||||
@ -135,7 +133,6 @@ void Init()
|
||||
bProcessFifoToLoWatermark = false;
|
||||
bProcessFifoAllDistance = false;
|
||||
isPossibleWaitingSetDrawDone = false;
|
||||
OnOverflow = false;
|
||||
|
||||
et_UpdateInterrupts = CoreTiming::RegisterEvent("UpdateInterrupts", UpdateInterrupts_Wrapper);
|
||||
}
|
||||
@ -449,26 +446,7 @@ void STACKALIGN GatherPipeBursted()
|
||||
Common::AtomicAdd(fifo.CPReadWriteDistance, GATHER_PIPE_SIZE);
|
||||
|
||||
if (!IsOnThread())
|
||||
{
|
||||
RunGpu();
|
||||
}
|
||||
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,
|
||||
"FIFO is overflown by GatherPipe !\nCPU thread is too fast!");
|
||||
|
Reference in New Issue
Block a user