mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00
VIF: Handle edge case of direct qword buffer transfer.
If buffer contained a SIGNAL command that isn't ready to be processed, VIF state would get bad. Fixes hang in Million Monkeys.
This commit is contained in:
parent
225e37d0dc
commit
64c63f1b03
1 changed files with 9 additions and 6 deletions
|
@ -166,7 +166,7 @@ void CVif1::Cmd_DIRECT(StreamType& stream, CODE nCommand)
|
|||
if(hasPartialQword)
|
||||
{
|
||||
//Read enough bytes to try to complete our qword
|
||||
assert(m_directQwordBufferIndex < QWORD_SIZE);
|
||||
assert(m_directQwordBufferIndex <= QWORD_SIZE);
|
||||
uint32 readAmount = std::min(nSize, QWORD_SIZE - m_directQwordBufferIndex);
|
||||
stream.Read(m_directQwordBuffer + m_directQwordBufferIndex, readAmount);
|
||||
m_directQwordBufferIndex += readAmount;
|
||||
|
@ -176,13 +176,16 @@ void CVif1::Cmd_DIRECT(StreamType& stream, CODE nCommand)
|
|||
if(m_directQwordBufferIndex == QWORD_SIZE)
|
||||
{
|
||||
assert(m_CODE.nIMM != 0);
|
||||
FRAMEWORK_MAYBE_UNUSED uint32 processed = m_gif.ProcessMultiplePackets(m_directQwordBuffer,
|
||||
uint32 processed = m_gif.ProcessMultiplePackets(m_directQwordBuffer,
|
||||
QWORD_SIZE, 0, QWORD_SIZE, CGsPacketMetadata(2));
|
||||
if(processed != 0)
|
||||
{
|
||||
assert(processed == QWORD_SIZE);
|
||||
m_CODE.nIMM--;
|
||||
m_directQwordBufferIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If no data pending in our partial qword buffer, go forward with multiple qword transfer
|
||||
if(m_directQwordBufferIndex == 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue