Revert the the Fifo changes from r3984 (Pokemon XD still somewhat works) this should fix hangs/desyncs in a couple of games (burnout, metroid, spyro, soulcalibur, nightfire...) see issue 1524

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4442 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s 2009-10-21 00:01:07 +00:00
parent c600926710
commit 4c3e405c47
3 changed files with 42 additions and 28 deletions

View File

@ -81,7 +81,7 @@ void DoState(PointerWrap &p)
p.Do(cookie); p.Do(cookie);
if (cookie != 0xBAADBABE + STATE_VERSION) if (cookie != 0xBAADBABE + STATE_VERSION)
{ {
PanicAlert("Savestate version mismatch !\nSorry, you can't load states from others revisions."); PanicAlert("Savestate version mismatch !\nSorry, you can't load states from other revisions.");
return; return;
} }
// Begin with video plugin, so that it gets a chance to clear it's caches and writeback modified things to RAM // Begin with video plugin, so that it gets a chance to clear it's caches and writeback modified things to RAM

View File

@ -145,49 +145,63 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
{ {
Common::AtomicStore(_fifo.CPReadIdle, 0); Common::AtomicStore(_fifo.CPReadIdle, 0);
do while (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance)
{ {
if (!fifoStateRun) if (!fifoStateRun)
break; 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; 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); u8 *uData = video_initialize.pGetMemoryPointer(readPtr);
// Check Pointer and move pointer // if we are on BP mode we must send 32B chunks to Video plugin for BP checking
if ((distToSend + readPtr) >= _fifo.CPEnd) // TODO (mb2): test & check if MP1/MP2 realy need this now.
if (_fifo.bFF_BPEnable)
{ {
distToSend =_fifo.CPEnd - readPtr; if (readPtr == _fifo.CPBreakpoint)
readPtr = _fifo.CPBase; {
Common::AtomicStore(_fifo.bFF_Breakpoint, 1);
CommandProcessor::UpdateInterruptsFromVideoPlugin();
break;
}
distToSend = 32;
readPtr += 32;
if ( readPtr >= _fifo.CPEnd)
readPtr = _fifo.CPBase;
} }
else 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 // Execute new instructions found in uData
Fifo_SendFifoData(uData, distToSend); 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)) if (_fifo.bFF_BPEnable && (readPtr == _fifo.CPBreakpoint))
{ {
Common::AtomicStore(_fifo.bFF_Breakpoint, 1); Common::AtomicStore(_fifo.bFF_Breakpoint, 1);
CommandProcessor::UpdateInterruptsFromVideoPlugin(); CommandProcessor::UpdateInterruptsFromVideoPlugin();
} }
// Update CPReadPointer and RWDistance Common::AtomicStore(_fifo.CPReadPointer, readPtr);
Common::AtomicStore(_fifo.CPReadPointer, readPtr); Common::AtomicAdd(_fifo.CPReadWriteDistance, -distToSend);
Common::AtomicAdd(_fifo.CPReadWriteDistance, -distToSend);
video_initialize.pPeekMessages();
} while (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance && !(_fifo.bFF_BPEnable && _fifo.bFF_Breakpoint)); VideoFifo_CheckEFBAccess();
VideoFifo_CheckSwapRequest();
}
Common::AtomicStore(_fifo.CPReadIdle, 1); Common::AtomicStore(_fifo.CPReadIdle, 1);
CommandProcessor::SetFifoIdleFromVideoPlugin(); CommandProcessor::SetFifoIdleFromVideoPlugin();

View File

@ -1042,8 +1042,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
// Clear framebuffer // Clear framebuffer
//glClearColor(0, 0, 0, 0); glClearColor(0, 0, 0, 0);
//glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();