| 312 | } |
| 313 | |
| 314 | void CopyGSPacketData(u8* pMem, u32 size, bool aligned = false) |
| 315 | { |
| 316 | if (curSize + size > buffSize) |
| 317 | { // Move gsPack to front of buffer |
| 318 | GUNIT_LOG("CopyGSPacketData: Realigning packet!"); |
| 319 | RealignPacket(); |
| 320 | } |
| 321 | for (;;) |
| 322 | { |
| 323 | s32 offset = curOffset - gsPack.size; |
| 324 | s32 readPos = offset - getReadAmount(); |
| 325 | if (readPos >= 0) |
| 326 | break; // MTGS is reading in back of curOffset |
| 327 | if ((s32)buffLimit + readPos > (s32)curSize + (s32)size) |
| 328 | break; // Enough free front space |
| 329 | mtgsReadWait(); // Let MTGS run to free up buffer space |
| 330 | } |
| 331 | pxAssertMsg(curSize + size <= buffSize, "Gif Path Buffer Overflow!"); |
| 332 | memcpy(&buffer[curSize], pMem, size); |
| 333 | curSize += size; |
| 334 | } |
| 335 | |
| 336 | // If completed a GS packet (with EOP) then set done to true |
| 337 | // MTVU: This function only should be called called on EE thread |
no outgoing calls
no test coverage detected