/* RwBool _rwDMAOpenVIFPkt(RwUInt32 type, RwUInt32 size); DMAcnt flush unpack *matrix camera base, offset lightPkt */ u_long128 flushCmd128; u_long128 xMaxYMax128; u_long128 vu1DataXYZScale; u_long128 vu1DataXYZShift; u_long128 vu1DataOffset3D; u_long128 baseOffsetCmd128; RwBool openVU1SetupPktNew(const RwMatrix *matrix, const u_long128 *lightPkt, RwUInt32 lightPktLen) { RwUInt128 ltmp; RwUInt64 tmp, tmp1; RwUInt64 size; // of UNPACK RwUInt32 dest = vuSDmat0; size = 6; // matrix, near&far clip if(matrix == NULL){ size = 0; dest = vuSDxMaxyMax; } size += 4; // camera values // TODO: what is the extra qword here? _rwDMAOpenVIFPkt(0, 3+size+1+lightPktLen + 1); RWDMA_LOCAL_BLOCK_BEGIN(); // DMAcnt tmp = (1L << 28) | ( 2 + // flush + unpack size + // unpack data 1 + // base, offset lightPktLen); MAKE128(ltmp, 0L, tmp); RWDMA_ADD_TO_PKT(ltmp); // flush RWDMA_ADD_TO_PKT(flushCmd128); // Unpack camera/object data tmp = (((0x6CL << 24) | /* VIF unpack 4-32 */ (size << 16) | /* Transfer size */ (dest)) << 32) | /* destination on VU1 */ ((1L << 24) | (4 << 8) | (4)); /* How to unpack, length 4W, stride 4W */ MAKE128(ltmp, tmp, 0L); RWDMA_ADD_TO_PKT(ltmp); if(matrix){ RwUInt32 *matVector; matVector = (RwUInt32 *)(&matrix->right); tmp = matVector[0] | ((RwUInt64)(matVector[1])<<32); tmp1 = matVector[2] | ((RwUInt64)(matVector[2])<<32); MAKE128(ltmp, tmp1, tmp); RWDMA_ADD_TO_PKT(ltmp); matVector = (RwUInt32 *)(&matrix->up); tmp = matVector[0] | ((RwUInt64)(matVector[1])<<32); tmp1 = matVector[2] | ((RwUInt64)(matVector[2])<<32); MAKE128(ltmp, tmp1, tmp); RWDMA_ADD_TO_PKT(ltmp); matVector = (RwUInt32 *)(&matrix->at); tmp = matVector[0] | ((RwUInt64)(matVector[1])<<32); tmp1 = matVector[2] | ((RwUInt64)(matVector[2])<<32); MAKE128(ltmp, tmp1, tmp); RWDMA_ADD_TO_PKT(ltmp); matVector = (RwUInt32 *)(&matrix->pos); tmp = matVector[0] | ((RwUInt64)(matVector[1])<<32); tmp1 = matVector[2] | ((RwUInt64)(matVector[2])<<32); MAKE128(ltmp, tmp1, tmp); RWDMA_ADD_TO_PKT(ltmp); MAKE128(ltmp, 0L, 0L); // near and far clip. why 0? RWDMA_ADD_TO_PKT(ltmp); RWDMA_ADD_TO_PKT(ltmp); } RWDMA_ADD_TO_PKT(xMaxYMax128); // vuSDxMaxyMax; zw: fog RWDMA_ADD_TO_PKT(vu1DataXYZScale); // vuSDcamWcamHzScale RWDMA_ADD_TO_PKT(vu1DataXYZShift); // vuSDoffXoffYzShift RWDMA_ADD_TO_PKT(vu1DataOffset3D); // vuSDrealOffset // end of UNPACK // base and offset RWDMA_ADD_TO_PKT(baseOffsetCmd128); // Light packet while(lightPktLen--) RWDMA_ADD_TO_PKT(*lightPkt++); RWDMA_LOCAL_BLOCK_END(); return TRUE; }