| 23 | } |
| 24 | |
| 25 | void vif1TransferToMemory() |
| 26 | { |
| 27 | u128* pMem = (u128*)dmaGetAddr(vif1ch.madr, false); |
| 28 | |
| 29 | // VIF from gsMemory |
| 30 | if (pMem == nullptr) |
| 31 | { // Is vif0ptag empty? |
| 32 | Console.WriteLn("Vif1 Tag BUSERR"); |
| 33 | dmacRegs.stat.BEIS = true; // Bus Error |
| 34 | vif1Regs.stat.FQC = 0; |
| 35 | |
| 36 | vif1ch.qwc = 0; |
| 37 | vif1.done = true; |
| 38 | CPU_INT(DMAC_VIF1, 0); |
| 39 | return; // An error has occurred. |
| 40 | } |
| 41 | |
| 42 | // MTGS concerns: The MTGS is inherently disagreeable with the idea of downloading |
| 43 | // stuff from the GS. The *only* way to handle this case safely is to flush the GS |
| 44 | // completely and execute the transfer there-after. |
| 45 | //Console.Warning("Real QWC %x", vif1ch.qwc); |
| 46 | const u32 size = std::min(vif1.GSLastDownloadSize, (u32)vif1ch.qwc); |
| 47 | //const u128* pMemEnd = vif1.GSLastDownloadSize + pMem; |
| 48 | |
| 49 | #ifdef PCSX2_DEVBUILD |
| 50 | if (size) |
| 51 | { |
| 52 | // Checking if any crazy game does a partial |
| 53 | // gs primitive and then does a gs download... |
| 54 | Gif_Path& p1 = gifUnit.gifPath[GIF_PATH_1]; |
| 55 | Gif_Path& p2 = gifUnit.gifPath[GIF_PATH_2]; |
| 56 | Gif_Path& p3 = gifUnit.gifPath[GIF_PATH_3]; |
| 57 | pxAssert(p1.isDone() || !p1.gifTag.isValid); |
| 58 | pxAssert(p2.isDone() || !p2.gifTag.isValid); |
| 59 | pxAssert(p3.isDone() || !p3.gifTag.isValid); |
| 60 | } |
| 61 | #endif |
| 62 | |
| 63 | MTGS::InitAndReadFIFO(reinterpret_cast<u8*>(pMem), size); |
| 64 | // pMem += size; |
| 65 | |
| 66 | //Some games such as Alex Ferguson's Player Manager 2001 reads less than GSLastDownloadSize by VIF then reads the remainder by FIFO |
| 67 | //Clearing the memory is clearing memory it shouldn't be and kills it. |
| 68 | //The only scenario where this could be used is the transfer size really is less than QWC, not the other way around as it was doing |
| 69 | //That said, I think this is pointless and a waste of cycles and could cause more problems than good. We will alert this situation below anyway. |
| 70 | /*if (vif1.GSLastDownloadSize < vif1ch.qwc) { |
| 71 | if (pMem < pMemEnd) { |
| 72 | DevCon.Warning("GS Transfer < VIF QWC, Clearing end of space GST %x QWC %x", vif1.GSLastDownloadSize, (u32)vif1ch.qwc); |
| 73 | |
| 74 | __m128 zeroreg = _mm_setzero_ps(); |
| 75 | do { |
| 76 | _mm_store_ps((float*)pMem, zeroreg); |
| 77 | } while (++pMem < pMemEnd); |
| 78 | } |
| 79 | }*/ |
| 80 | |
| 81 | g_vif1Cycles += size * 2; |
| 82 | vif1ch.madr += size * 16; // mgs3 scene changes |
no test coverage detected