diff --git a/pcsx2/FiFo.cpp b/pcsx2/FiFo.cpp index 282eb68aaa..28122713c4 100644 --- a/pcsx2/FiFo.cpp +++ b/pcsx2/FiFo.cpp @@ -164,6 +164,7 @@ void __fastcall WriteFIFO_page_5(u32 mem, const mem128_t *value) if(GSTransferStatus.PTH2 == STOPPED_MODE && gifRegs->stat.APATH == GIF_APATH2) { + if(gifRegs->stat.DIR == 0)gifRegs->stat.OPH = false; gifRegs->stat.APATH = GIF_APATH_IDLE; if(gifRegs->stat.P1Q) gsPath1Interrupt(); } @@ -200,6 +201,7 @@ void __fastcall WriteFIFO_page_6(u32 mem, const mem128_t *value) GetMTGS().SendDataPacket(); if(GSTransferStatus.PTH3 == STOPPED_MODE && gifRegs->stat.APATH == GIF_APATH3 ) { + if(gifRegs->stat.DIR == 0)gifRegs->stat.OPH = false; gifRegs->stat.APATH = GIF_APATH_IDLE; if(gifRegs->stat.P1Q) gsPath1Interrupt(); } diff --git a/pcsx2/GS.cpp b/pcsx2/GS.cpp index 4dc0251393..b4953f1792 100644 --- a/pcsx2/GS.cpp +++ b/pcsx2/GS.cpp @@ -283,15 +283,10 @@ void __fastcall gsWrite64_page_01( u32 mem, const mem64_t* value ) case 0x12001040: //busdir //This is probably a complete hack, however writing to BUSDIR "should" start a transfer - //(Bleach Blade Battlers, Growlanser 2 and 3, Wizardry) //Only problem is it kills killzone :(. // (yes it *is* a complete hack; both lines here in fact --air) //========================================================================= - //Console.Warning("BUSDIR write! Setting OPH and DIR to = %x",(u32)value[0]); - if ((u32)value[0] == 1) - gifRegs->stat.OPH = true; - else - gifRegs->stat.OPH = false; + gifRegs->stat.OPH = true; gifRegs->stat.DIR = (u32)value[0]; //========================================================================= diff --git a/pcsx2/Gif.cpp b/pcsx2/Gif.cpp index 8f8293110c..78d3281282 100644 --- a/pcsx2/Gif.cpp +++ b/pcsx2/Gif.cpp @@ -69,7 +69,8 @@ void gsPath1Interrupt() size -= count; if(GSTransferStatus.PTH1 == STOPPED_MODE) - { + { + gifRegs->stat.OPH = false; gifRegs->stat.APATH = GIF_APATH_IDLE; } } @@ -105,6 +106,7 @@ __forceinline void gsInterrupt() if(GSTransferStatus.PTH3 >= PENDINGSTOP_MODE && gifRegs->stat.APATH == GIF_APATH3 ) { + gifRegs->stat.OPH = false; GSTransferStatus.PTH3 = STOPPED_MODE; gifRegs->stat.APATH = GIF_APATH_IDLE; if(gifRegs->stat.P1Q) gsPath1Interrupt(); @@ -317,7 +319,7 @@ void GIFdma() - //gifRegs->stat.OPH = true; // why set the GS output path flag here? (rama) + gifRegs->stat.OPH = true; gifRegs->stat.FQC = min((u16)0x10, gif->qwc);// FQC=31, hack ;) (for values of 31 that equal 16) [ used to be 0xE00; // APATH=3] //Check with Path3 masking games if (gif->qwc > 0) { @@ -336,7 +338,7 @@ void GIFdma() } - //gifRegs->stat.OPH = true; // why set the GS output path flag here? (rama) + gifRegs->stat.OPH = true; // Transfer Dn_QWC from Dn_MADR to GIF if ((gif->chcr.MOD == NORMAL_MODE) || (gif->qwc > 0)) // Normal Mode { @@ -630,6 +632,7 @@ void gifMFIFOInterrupt() if(GSTransferStatus.PTH3 == STOPPED_MODE && gifRegs->stat.APATH == GIF_APATH3 ) { + gifRegs->stat.OPH = false; gifRegs->stat.APATH = GIF_APATH_IDLE; if(gifRegs->stat.P1Q) gsPath1Interrupt(); } diff --git a/pcsx2/Vif1_Dma.cpp b/pcsx2/Vif1_Dma.cpp index 1b868999ea..95c2fe93c6 100644 --- a/pcsx2/Vif1_Dma.cpp +++ b/pcsx2/Vif1_Dma.cpp @@ -348,6 +348,7 @@ __forceinline void vif1Interrupt() if(GSTransferStatus.PTH2 == STOPPED_MODE && gifRegs->stat.APATH == GIF_APATH2) { + gifRegs->stat.OPH = false; gifRegs->stat.APATH = GIF_APATH_IDLE; if(gifRegs->stat.P1Q) gsPath1Interrupt(); } @@ -442,6 +443,12 @@ __forceinline void vif1Interrupt() if (vif1.cmd != 0) Console.WriteLn("vif1.cmd still set %x tag size %x", vif1.cmd, vif1.tag.size); #endif + if((vif1ch->chcr.DIR == VIF_NORMAL_TO_MEM_MODE) && vif1.GSLastDownloadSize <= 16) + { + //Reverse fifo has finished and nothing is left, so lets clear the outputting flag + gifRegs->stat.OPH = false; + } + vif1ch->chcr.STR = false; vif1.vifstalled = false; g_vifCycles = 0; diff --git a/pcsx2/Vif1_MFIFO.cpp b/pcsx2/Vif1_MFIFO.cpp index 85c57a8849..ee2f9d29ac 100644 --- a/pcsx2/Vif1_MFIFO.cpp +++ b/pcsx2/Vif1_MFIFO.cpp @@ -239,6 +239,7 @@ void vifMFIFOInterrupt() if(GSTransferStatus.PTH2 == STOPPED_MODE && gifRegs->stat.APATH == GIF_APATH2) { GSTransferStatus.PTH2 = STOPPED_MODE; + if(gifRegs->stat.DIR == 0)gifRegs->stat.OPH = false; gifRegs->stat.APATH = GIF_APATH_IDLE; if(gifRegs->stat.P1Q) gsPath1Interrupt(); /*gifRegs->stat.APATH = GIF_APATH_IDLE; diff --git a/pcsx2/ps2/GIFpath.cpp b/pcsx2/ps2/GIFpath.cpp index f2fbb2f546..24677532c5 100644 --- a/pcsx2/ps2/GIFpath.cpp +++ b/pcsx2/ps2/GIFpath.cpp @@ -357,8 +357,8 @@ static __forceinline void gsHandler(const u8* pMem) // qwords, rounded down; any extra bits are lost // games must take care to ensure transfer rectangles are exact multiples of a qword vif1.GSLastDownloadSize = vif1.TRXREG.RRW * vif1.TRXREG.RRH * bpp >> 7; - //DevCon.Warning("GS download in progress. OPH = %x", gifRegs->stat.OPH); - //gifRegs->stat.OPH = true; // Too early to set it here. It should be done on a BUSDIR call (rama) + //DevCon.Warning("GS download in progress"); + gifRegs->stat.OPH = true; } } if (reg >= 0x60) @@ -618,7 +618,7 @@ __forceinline int GIFPath::CopyTag(const u128* pMem128, u32 size) } if(GSTransferStatus.PTH3 < PENDINGSTOP_MODE || pathidx != 2) { - //gifRegs->stat.OPH = true; // why set the GS output path flag here? (rama) + gifRegs->stat.OPH = true; gifRegs->stat.APATH = pathidx + 1; } @@ -646,7 +646,7 @@ __forceinline int GIFPath::CopyTag(const u128* pMem128, u32 size) break; } gifRegs->stat.APATH = pathidx + 1; - //gifRegs->stat.OPH = true; // why set the GS output path flag here? (rama) + gifRegs->stat.OPH = true; switch(tag.FLG) { case GIF_FLG_PACKED: diff --git a/pcsx2/x86/microVU_Lower.inl b/pcsx2/x86/microVU_Lower.inl index 597bd37936..1e40e9a557 100644 --- a/pcsx2/x86/microVU_Lower.inl +++ b/pcsx2/x86/microVU_Lower.inl @@ -1111,6 +1111,7 @@ void __fastcall mVU_XGKICK_(u32 addr) { if(GSTransferStatus.PTH1 == STOPPED_MODE) { + gifRegs->stat.OPH = false; gifRegs->stat.APATH = GIF_APATH_IDLE; } } diff --git a/pcsx2/x86/sVU_Lower.cpp b/pcsx2/x86/sVU_Lower.cpp index 326119ccd9..2ea05d0986 100644 --- a/pcsx2/x86/sVU_Lower.cpp +++ b/pcsx2/x86/sVU_Lower.cpp @@ -1993,6 +1993,7 @@ void __fastcall VU1XGKICK_MTGSTransfer(u32 *pMem, u32 addr) if(GSTransferStatus.PTH1 == STOPPED_MODE ) { + gifRegs->stat.OPH = false; gifRegs->stat.APATH = GIF_APATH_IDLE; } }