void CVPU1::Cmd_DIRECT(StreamType& stream, CODE nCommand) { uint32 nSize = stream.GetAvailableReadBytes(); nSize = std::min<uint32>(m_CODE.nIMM * 0x10, nSize); assert((nSize & 0x0F) == 0); if(nSize != 0) { uint8* packet = reinterpret_cast<uint8*>(alloca(nSize)); stream.Read(packet, nSize); int32 remainingLength = nSize; while(remainingLength > 0) { uint32 processed = m_vif.GetGif().ProcessPacket(packet, 0, remainingLength, CGsPacketMetadata(2)); packet += processed; remainingLength -= processed; assert(remainingLength >= 0); } } m_CODE.nIMM -= (nSize / 0x10); if((m_CODE.nIMM == 0) && (nSize != 0)) { m_STAT.nVPS = 0; } else { m_STAT.nVPS = 1; } }
uint32 CGIF::ReceiveDMA(uint32 address, uint32 qwc, uint32 unused, bool tagIncluded) { uint8* memory(nullptr); uint32 size = qwc * 0x10; if(tagIncluded) { assert(qwc >= 0); size -= 0x10; address += 0x10; } if(address & 0x80000000) { memory = m_spr; address &= PS2::EE_SPR_SIZE - 1; } else { memory = m_ram; } uint32 end = address + size; while(address < end) { address += ProcessPacket(memory, address, end, CGsPacketMetadata(3)); } return qwc; }
void CVif1::Cmd_DIRECT(StreamType& stream, CODE nCommand) { uint32 nSize = stream.GetAvailableReadBytes(); nSize = std::min<uint32>(m_CODE.nIMM * 0x10, nSize); assert((nSize & 0x0F) == 0); if(nSize != 0) { if(m_directBuffer.size() < nSize) { m_directBuffer.resize(nSize); } auto packet = m_directBuffer.data(); stream.Read(packet, nSize); int32 remainingLength = nSize; while(remainingLength > 0) { uint32 processed = m_gif.ProcessPacket(packet, 0, remainingLength, CGsPacketMetadata(2)); packet += processed; remainingLength -= processed; assert(remainingLength >= 0); } } m_CODE.nIMM -= (nSize / 0x10); if((m_CODE.nIMM == 0) && (nSize != 0)) { m_STAT.nVPS = 0; } else { m_STAT.nVPS = 1; } }