summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/CommandProcessor.cpp
diff options
context:
space:
mode:
authorMarcos Vitali <marcosvitali@gmail.com>2010-11-27 19:36:18 +0000
committerMarcos Vitali <marcosvitali@gmail.com>2010-11-27 19:36:18 +0000
commit762563a02673b10f8c448aec6240a95e6a3d3696 (patch)
tree892acae11f842c4f16862ad6847b104da362125e /Source/Core/VideoCommon/Src/CommandProcessor.cpp
parent5ae1b65388f1c76ffeab3a11057242f4944bbb20 (diff)
If there is a SetBreakPoint and the actual distance is enough to achieve the BP, we wait for the FIFO Loop in dual core mode. That fix Pokemon XD in game in dual core mode (also maybe this fix Issue 3452) and hopefully others FIFO hangs related with BP. I test games like SMG and don't produce slowdowns. If you have any slowdown about this commit. Please report it.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6483 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon/Src/CommandProcessor.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/CommandProcessor.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.cpp b/Source/Core/VideoCommon/Src/CommandProcessor.cpp
index 49c6762f51..2e46d1219c 100644
--- a/Source/Core/VideoCommon/Src/CommandProcessor.cpp
+++ b/Source/Core/VideoCommon/Src/CommandProcessor.cpp
@@ -402,6 +402,30 @@ void Write16(const u16 _Value, const u32 _Address)
UCPCtrlReg tmpCtrl(_Value);
m_CPCtrlReg.Hex = tmpCtrl.Hex;
+ //If there is a SetBreakPoint and the actual distance is enought to achieve the BP,
+ //we wait for the FIFO Loop in DC MODE
+ if (g_VideoInitialize.bOnThread && fifo.bFF_BPInt && tmpCtrl.BPInt && fifo.bFF_BPEnable && tmpCtrl.BPEnable)
+ {
+ bool wait = false;
+ if (fifo.CPReadPointer + fifo.CPReadWriteDistance + 32 > fifo.CPBreakpoint)
+ {
+ wait = true;
+ } //If the distance is >= CPEnd we need to calculate the distane related to CPBase
+ else if (fifo.CPReadPointer + fifo.CPReadWriteDistance >= fifo.CPEnd)
+ {
+ if (fifo.CPReadWriteDistance + fifo.CPReadPointer - fifo.CPEnd + 32 > fifo.CPBreakpoint)
+ wait = true;
+ }
+
+ // We waiting for the fifo loop finish
+ while (wait && fifo.bFF_GPReadEnable && (fifo.CPReadWriteDistance ||
+ (fifo.bFF_BPEnable && ((fifo.CPReadPointer <= fifo.CPBreakpoint) &&
+ (fifo.CPReadPointer + 32 > fifo.CPBreakpoint)))))
+ {
+ Common::YieldCPU();
+ }
+ }
+
Common::AtomicStore(fifo.bFF_Breakpoint, false);
if (tmpCtrl.FifoUnderflowIntEnable)