Fixed GPFifo out of bounds by 32 bytes

Fixed incorrect FIFO out of bounds check
plus a bit optimization of CheckPipe()

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5692 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx
2010-06-14 16:32:40 +00:00
parent fc12291806
commit 857f1f4d38
3 changed files with 38 additions and 30 deletions

View File

@ -594,7 +594,7 @@ void STACKALIGN GatherPipeBursted()
if (g_VideoInitialize.bOnThread)
{
// update the fifo-pointer
if (fifo.CPWritePointer >= fifo.CPEnd)
if (fifo.CPWritePointer + GATHER_PIPE_SIZE >= fifo.CPEnd)
fifo.CPWritePointer = fifo.CPBase;
else
fifo.CPWritePointer += GATHER_PIPE_SIZE;
@ -634,7 +634,7 @@ void STACKALIGN GatherPipeBursted()
}
else
{
if (fifo.CPWritePointer >= fifo.CPEnd)
if (fifo.CPWritePointer + GATHER_PIPE_SIZE >= fifo.CPEnd)
fifo.CPWritePointer = fifo.CPBase;
else
fifo.CPWritePointer += GATHER_PIPE_SIZE;
@ -687,11 +687,11 @@ void CatchUpGPU()
fifo.CPReadWriteDistance -= 32;
// increase the ReadPtr
if (fifo.CPReadPointer >= fifo.CPEnd)
if (fifo.CPReadPointer + 32 >= fifo.CPEnd)
{
fifo.CPReadPointer = fifo.CPBase;
// adjust, take care
ptr = Memory_GetPtr(fifo.CPReadPointer);
ptr -= fifo.CPReadPointer - fifo.CPBase;
DEBUG_LOG(COMMANDPROCESSOR, "Fifo Loop");
}
else