diff --git a/pcsx2/FiFo.cpp b/pcsx2/FiFo.cpp index a4d57b0032..5f0317ff29 100644 --- a/pcsx2/FiFo.cpp +++ b/pcsx2/FiFo.cpp @@ -109,6 +109,15 @@ void __fastcall WriteFIFO_VIF1(const mem128_t *value) } else vif1Regs.stat.VPS = VPS_IDLE; + if( gifRegs.stat.APATH == 2 && gifUnit.gifPath[1].isDone()) + { + gifRegs.stat.APATH = 0; + gifRegs.stat.OPH = 0; + vif1Regs.stat.VGW = false; //Let vif continue if it's stuck on a flush + + if(gifUnit.checkPaths(1,0,1)) gifUnit.Execute(false, true); + } + pxAssertDev( ret, "vif stall code not implemented" ); } @@ -119,4 +128,16 @@ void __fastcall WriteFIFO_GIF(const mem128_t *value) if(gifUnit.gifPath[GIF_PATH_3].state == GIF_PATH_WAIT) gifUnit.gifPath[GIF_PATH_3].state = GIF_PATH_IDLE; + + if( gifRegs.stat.APATH == 3 ) + { + gifRegs.stat.APATH = 0; + gifRegs.stat.OPH = 0; + + if(gifUnit.gifPath[GIF_PATH_3].state == GIF_PATH_IDLE || gifUnit.gifPath[GIF_PATH_3].state == GIF_PATH_WAIT) + { + if(gifUnit.checkPaths(1,1,0)) gifUnit.Execute(false, true); + } + + } } diff --git a/pcsx2/Vif1_Dma.cpp b/pcsx2/Vif1_Dma.cpp index b8af59799e..da52435688 100644 --- a/pcsx2/Vif1_Dma.cpp +++ b/pcsx2/Vif1_Dma.cpp @@ -236,6 +236,8 @@ __fi void vif1VUFinish() VIF_LOG("Clear APATH1"); gifRegs.stat.APATH = 0; gifRegs.stat.OPH = 0; + vif1Regs.stat.VGW = false; //Let vif continue if it's stuck on a flush + if(!vif1.waitforvu) { if(gifUnit.checkPaths(0,1,1)) gifUnit.Execute(false, true); @@ -269,6 +271,7 @@ __fi void vif1Interrupt() { gifRegs.stat.APATH = 0; gifRegs.stat.OPH = 0; + vif1Regs.stat.VGW = false; //Let vif continue if it's stuck on a flush if(gifUnit.checkPaths(1,0,1)) gifUnit.Execute(false, true); } diff --git a/pcsx2/Vif_Codes.cpp b/pcsx2/Vif_Codes.cpp index 38d2ee55a4..dbb0507058 100644 --- a/pcsx2/Vif_Codes.cpp +++ b/pcsx2/Vif_Codes.cpp @@ -181,9 +181,10 @@ vifOp(vifCode_Flush) { vif1Only(); vifStruct& vifX = GetVifX; pass1or2 { + bool p1or2 = (gifRegs.stat.APATH != 0 && gifRegs.stat.APATH != 3); vif1Regs.stat.VGW = false; vifFlush(idx); - if (gifUnit.checkPaths(1,1,0)) { + if (gifUnit.checkPaths(1,1,0) || p1or2) { GUNIT_WARN("Vif Flush: Stall!"); //gifUnit.PrintInfo(); vif1Regs.stat.VGW = true; @@ -202,15 +203,22 @@ vifOp(vifCode_FlushA) { vif1Only(); vifStruct& vifX = GetVifX; pass1or2 { - Gif_Path& p3 = gifUnit.gifPath[GIF_PATH_3]; - u32 p1or2 = gifUnit.checkPaths(1,1,0); - bool doStall = false; + //Gif_Path& p3 = gifUnit.gifPath[GIF_PATH_3]; + u32 gifBusy = gifUnit.checkPaths(1,1,1) || (gifRegs.stat.APATH != 0); + //bool doStall = false; vif1Regs.stat.VGW = false; vifFlush(idx); - if (p3.state != GIF_PATH_IDLE || p1or2) { + + if (gifBusy) + { GUNIT_WARN("Vif FlushA: Stall!"); + vif1Regs.stat.VGW = true; + vifX.vifstalled.enabled = true; + vifX.vifstalled.value = VIF_TIMING_BREAK; + return 0; + //gifUnit.PrintInfo(); - if (p3.state != GIF_PATH_IDLE && !p1or2) { // Only path 3 left... + /*if (p3.state != GIF_PATH_IDLE && !p1or2) { // Only path 3 left... GUNIT_WARN("Vif FlushA - Getting path3 to finish!"); if (gifUnit.lastTranType == GIF_TRANS_FIFO && p3.state != GIF_PATH_IDLE && !p3.hasDataRemaining()) { @@ -222,15 +230,17 @@ vifOp(vifCode_FlushA) { doStall = true; // If path3 still isn't finished... } } - else doStall = true; + else doStall = true;*/ } - if (doStall) { + /*if (doStall) { vif1Regs.stat.VGW = true; vifX.vifstalled.enabled = true; vifX.vifstalled.value = VIF_TIMING_BREAK; return 0; } - else vifX.cmd = 0; + else*/ + //Didn't need to stall! + vifX.cmd = 0; vifX.pass = 0; } pass3 { VifCodeLog("FlushA"); }