mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
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:
@ -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
|
||||
|
@ -118,12 +118,12 @@ void Fifo_SendFifoData(u8* _uData, u32 len)
|
||||
if (size + len >= FIFO_SIZE)
|
||||
{
|
||||
int pos = (int)(g_pVideoData - videoBuffer);
|
||||
if (size - pos > pos)
|
||||
size -= pos;
|
||||
if (size + len > FIFO_SIZE)
|
||||
{
|
||||
PanicAlert("FIFO out of bounds (sz = %i, at %08x)", size, pos);
|
||||
}
|
||||
memmove(&videoBuffer[0], &videoBuffer[pos], size - pos);
|
||||
size -= pos;
|
||||
memmove(&videoBuffer[0], &videoBuffer[pos], size);
|
||||
g_pVideoData = videoBuffer;
|
||||
}
|
||||
// Copy new video instructions to videoBuffer for future use in rendering the new picture
|
||||
@ -180,7 +180,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
||||
}
|
||||
distToSend = 32;
|
||||
|
||||
if ( readPtr >= _fifo.CPEnd)
|
||||
if (readPtr + 32 >= _fifo.CPEnd)
|
||||
readPtr = _fifo.CPBase;
|
||||
else
|
||||
readPtr += 32;
|
||||
@ -192,9 +192,9 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
||||
// send 1024B chunk max length to have better control over PeekMessages' period
|
||||
distToSend = distToSend > 1024 ? 1024 : distToSend;
|
||||
// add 32 bytes because the cp end points to the start of the last 32 byte chunk
|
||||
if ((distToSend + readPtr) >= (_fifo.CPEnd + 32)) // TODO: better?
|
||||
if (readPtr + distToSend >= _fifo.CPEnd)
|
||||
{
|
||||
distToSend =(_fifo.CPEnd + 32) - readPtr;
|
||||
distToSend = _fifo.CPEnd - readPtr;
|
||||
readPtr = _fifo.CPBase;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user