mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-15 12:41:09 +00:00
Simplify fifo code
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3855 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
feb67740bc
commit
5b6b732378
@ -422,6 +422,11 @@ void Write16(const u16 _Value, const u32 _Address)
|
|||||||
Common::AtomicStore(fifo.bFF_GPLinkEnable, tmpCtrl.GPLinkEnable);
|
Common::AtomicStore(fifo.bFF_GPLinkEnable, tmpCtrl.GPLinkEnable);
|
||||||
Common::AtomicStore(fifo.bFF_BPEnable, tmpCtrl.BPEnable);
|
Common::AtomicStore(fifo.bFF_BPEnable, tmpCtrl.BPEnable);
|
||||||
|
|
||||||
|
if (m_CPCtrlReg.BPEnable && !tmpCtrl.BPEnable)
|
||||||
|
{
|
||||||
|
fifo.bFF_Breakpoint = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// TOCHECK (mb2): could BP irq be cleared with w16 to STATUS_REGISTER?
|
// TOCHECK (mb2): could BP irq be cleared with w16 to STATUS_REGISTER?
|
||||||
// funny hack: eg in MP1 if we disable the clear breakpoint ability by commenting this block
|
// funny hack: eg in MP1 if we disable the clear breakpoint ability by commenting this block
|
||||||
// the game is of course faster but looks stable too.
|
// the game is of course faster but looks stable too.
|
||||||
|
@ -122,15 +122,9 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
|||||||
{
|
{
|
||||||
fifoStateRun = true;
|
fifoStateRun = true;
|
||||||
SCPFifoStruct &_fifo = *video_initialize.pCPFifo;
|
SCPFifoStruct &_fifo = *video_initialize.pCPFifo;
|
||||||
s32 distToSend;
|
|
||||||
|
|
||||||
while (fifoStateRun)
|
while (fifoStateRun)
|
||||||
{
|
{
|
||||||
video_initialize.pPeekMessages();
|
|
||||||
|
|
||||||
VideoFifo_CheckEFBAccess();
|
|
||||||
|
|
||||||
VideoFifo_CheckSwapRequest();
|
|
||||||
|
|
||||||
s_criticalFifo.Enter();
|
s_criticalFifo.Enter();
|
||||||
|
|
||||||
@ -139,56 +133,35 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
|||||||
{
|
{
|
||||||
Common::AtomicStore(_fifo.CPReadIdle, 0);
|
Common::AtomicStore(_fifo.CPReadIdle, 0);
|
||||||
|
|
||||||
while (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance)
|
do
|
||||||
{
|
{
|
||||||
if(!fifoStateRun)
|
if(!fifoStateRun)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Create pointer to video data and send it to the VideoPlugin
|
|
||||||
u32 readPtr = _fifo.CPReadPointer;
|
u32 readPtr = _fifo.CPReadPointer;
|
||||||
|
|
||||||
u8 *uData = video_initialize.pGetMemoryPointer(readPtr);
|
u8 *uData = video_initialize.pGetMemoryPointer(readPtr);
|
||||||
|
|
||||||
// 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)
|
|
||||||
{
|
|
||||||
if (readPtr == _fifo.CPBreakpoint)
|
|
||||||
{
|
|
||||||
Common::AtomicStore(_fifo.bFF_Breakpoint, 1);
|
|
||||||
video_initialize.pUpdateInterrupts();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
distToSend = 32;
|
|
||||||
readPtr += 32;
|
|
||||||
if ( readPtr >= _fifo.CPEnd)
|
|
||||||
readPtr = _fifo.CPBase;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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, 32);
|
||||||
|
|
||||||
|
readPtr += 32;
|
||||||
|
if (readPtr >= _fifo.CPEnd)
|
||||||
|
readPtr = _fifo.CPBase;
|
||||||
|
|
||||||
Common::AtomicStore(_fifo.CPReadPointer, readPtr);
|
Common::AtomicStore(_fifo.CPReadPointer, readPtr);
|
||||||
Common::AtomicAdd(_fifo.CPReadWriteDistance, -distToSend);
|
Common::AtomicAdd(_fifo.CPReadWriteDistance, -32);
|
||||||
|
|
||||||
|
if (_fifo.bFF_BPEnable && (readPtr == _fifo.CPBreakpoint))
|
||||||
|
{
|
||||||
|
_fifo.bFF_Breakpoint = 1;
|
||||||
|
video_initialize.pUpdateInterrupts();
|
||||||
|
}
|
||||||
|
|
||||||
video_initialize.pPeekMessages();
|
video_initialize.pPeekMessages();
|
||||||
|
|
||||||
VideoFifo_CheckEFBAccess();
|
VideoFifo_CheckEFBAccess();
|
||||||
|
|
||||||
VideoFifo_CheckSwapRequest();
|
VideoFifo_CheckSwapRequest();
|
||||||
}
|
|
||||||
|
} while (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance && !(_fifo.bFF_BPEnable && _fifo.bFF_Breakpoint));
|
||||||
|
|
||||||
Common::AtomicStore(_fifo.CPReadIdle, 1);
|
Common::AtomicStore(_fifo.CPReadIdle, 1);
|
||||||
video_initialize.pSetFifoIdle();
|
video_initialize.pSetFifoIdle();
|
||||||
@ -196,6 +169,9 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Common::YieldCPU();
|
Common::YieldCPU();
|
||||||
|
video_initialize.pPeekMessages();
|
||||||
|
VideoFifo_CheckEFBAccess();
|
||||||
|
VideoFifo_CheckSwapRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
s_criticalFifo.Leave();
|
s_criticalFifo.Leave();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user