// Calls the vif unpack functions from the MTVU thread static void MTVU_Unpack(void* data, VIFregisters& vifRegs) { u16 wl = vifRegs.cycle.wl > 0 ? vifRegs.cycle.wl : 256; bool isFill = vifRegs.cycle.cl < wl; if (newVifDynaRec) dVifUnpack<1>((u8*)data, isFill); else _nVifUnpack(1, (u8*)data, vifRegs.mode, isFill); }
_vifT int nVifUnpack(const u8* data) { nVifStruct& v = nVif[idx]; vifStruct& vif = GetVifX; VIFregisters& vifRegs = vifXRegs; const uint ret = aMin(vif.vifpacketsize, vif.tag.size); const bool isFill = (vifRegs.cycle.cl < vifRegs.cycle.wl); s32 size = ret << 2; if (ret == vif.tag.size) { // Full Transfer if (v.bSize) { // Last transfer was partial memcpy(&v.buffer[v.bSize], data, size); v.bSize += size; size = v.bSize; data = v.buffer; vif.cl = 0; vifRegs.num = (vifXRegs.code >> 16) & 0xff; // grab NUM form the original VIFcode input. if (!vifRegs.num) vifRegs.num = 256; } if (!idx || !THREAD_VU1) { if (newVifDynaRec) dVifUnpack<idx>(data, isFill); else _nVifUnpack(idx, data, vifRegs.mode, isFill); } else vu1Thread.VifUnpack(vif, vifRegs, (u8*)data, (size + 4) & ~0x3); vif.pass = 0; vif.tag.size = 0; vif.cmd = 0; vifRegs.num = 0; v.bSize = 0; }