diff options
Diffstat (limited to 'Source/Core/VideoCommon/Src/Fifo.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/Fifo.cpp | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index b258eb97f2..6285e37afe 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -145,49 +145,63 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) { Common::AtomicStore(_fifo.CPReadIdle, 0); - do + while (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance) { if (!fifoStateRun) break; - // Get the Read Pointer - // Create pointer to video data and send it to the VideoPlugin + // Create pointer to video data and send it to the VideoPlugin u32 readPtr = _fifo.CPReadPointer; - - // Set distance - // if we are on BP mode we must send 32B chunks to Video plugin for BP checking - distToSend = _fifo.bFF_BPEnable ? 32 : _fifo.CPReadWriteDistance; - // send 1024B chunk max length to have better control over PeekMessages' period - //distToSend = distToSend > 1024 ? 1024 : distToSend; - - // Get Data based on pointer u8 *uData = video_initialize.pGetMemoryPointer(readPtr); - // Check Pointer and move pointer - if ((distToSend + readPtr) >= _fifo.CPEnd) + // if we are on BP mode we must send 32B chunks to Video plugin for BP checking + // TODO (mb2): test & check if MP1/MP2 realy need this now. + if (_fifo.bFF_BPEnable) { - distToSend =_fifo.CPEnd - readPtr; - readPtr = _fifo.CPBase; + if (readPtr == _fifo.CPBreakpoint) + { + Common::AtomicStore(_fifo.bFF_Breakpoint, 1); + CommandProcessor::UpdateInterruptsFromVideoPlugin(); + break; + } + distToSend = 32; + readPtr += 32; + if ( readPtr >= _fifo.CPEnd) + readPtr = _fifo.CPBase; } else - readPtr += distToSend; + { + distToSend = _fifo.CPReadWriteDistance; + // send 1024B chunk max length to have better control over PeekMessages' period + distToSend = distToSend > 1024 ? 1024 : distToSend; + if ((distToSend + readPtr) >= _fifo.CPEnd) // TODO: better? + { + distToSend =_fifo.CPEnd - readPtr; + readPtr = _fifo.CPBase; + } + else + readPtr += distToSend; + } // Execute new instructions found in uData Fifo_SendFifoData(uData, distToSend); - //Check BP Mode - Pokemon XD wants this to be called after the pointer move + // The following condition is what keeps Pokemon XD "sorta booting" weird isn't it ? if (_fifo.bFF_BPEnable && (readPtr == _fifo.CPBreakpoint)) - { - Common::AtomicStore(_fifo.bFF_Breakpoint, 1); - CommandProcessor::UpdateInterruptsFromVideoPlugin(); - } + { + Common::AtomicStore(_fifo.bFF_Breakpoint, 1); + CommandProcessor::UpdateInterruptsFromVideoPlugin(); + } + + Common::AtomicStore(_fifo.CPReadPointer, readPtr); + Common::AtomicAdd(_fifo.CPReadWriteDistance, -distToSend); - // Update CPReadPointer and RWDistance - Common::AtomicStore(_fifo.CPReadPointer, readPtr); - Common::AtomicAdd(_fifo.CPReadWriteDistance, -distToSend); + video_initialize.pPeekMessages(); + VideoFifo_CheckEFBAccess(); - } while (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance && !(_fifo.bFF_BPEnable && _fifo.bFF_Breakpoint)); + VideoFifo_CheckSwapRequest(); + } Common::AtomicStore(_fifo.CPReadIdle, 1); CommandProcessor::SetFifoIdleFromVideoPlugin(); |
