From 06e4ae00b283e4769f338973188df983c8681d3d Mon Sep 17 00:00:00 2001 From: arcum42 Date: Fri, 25 Jun 2010 23:13:41 +0000 Subject: [PATCH] pcsx2: A bit of cleanup. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3307 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Gif.cpp | 2 +- pcsx2/SPR.cpp | 16 ++++------------ pcsx2/Vif0_Dma.cpp | 3 ++- pcsx2/Vif1_Dma.cpp | 26 +++++++++++++------------- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/pcsx2/Gif.cpp b/pcsx2/Gif.cpp index 4094834a5c..375f57a121 100644 --- a/pcsx2/Gif.cpp +++ b/pcsx2/Gif.cpp @@ -424,7 +424,7 @@ void dmaGIF() if(gif->chcr.MOD == CHAIN_MODE && gif->qwc > 0) { //DevCon.Warning(L"GIF QWC on Chain " + gif->chcr.desc()); - if(((gif->chcr.TAG >> 12) & 0x7) == 0x0 || ((gif->chcr.TAG >> 12) & 0x7) == 0x7) + if ((gif->chcr.tag().ID == TAG_REFE) || (gif->chcr.tag().ID == TAG_END)) { gspath3done = true; } diff --git a/pcsx2/SPR.cpp b/pcsx2/SPR.cpp index 8c20cd36ff..3c19194dd2 100644 --- a/pcsx2/SPR.cpp +++ b/pcsx2/SPR.cpp @@ -130,7 +130,6 @@ void _SPR0interleave() } spr0->qwc = 0; - spr0finished = true; } static __forceinline void _dmaSPR0() @@ -207,6 +206,7 @@ static __forceinline void _dmaSPR0() default: { _SPR0interleave(); + spr0finished = true; break; } } @@ -264,14 +264,10 @@ void dmaSPR0() // fromSPR if(spr0->chcr.MOD == CHAIN_MODE && spr0->qwc > 0) { //DevCon.Warning(L"SPR0 QWC on Chain " + spr0->chcr.desc()); - if(((spr0->chcr.TAG >> 12) & 0x7) == 0x7) + if (spr0->chcr.tag().ID == TAG_END) // but not TAG_REFE? { spr0finished = true; } - else - { - spr0finished = false; - } } SPRFROMinterrupt(); @@ -327,7 +323,6 @@ void _SPR1interleave() } spr1->qwc = 0; - spr1finished = true; } void _dmaSPR1() // toSPR work function @@ -394,6 +389,7 @@ void _dmaSPR1() // toSPR work function default: { _SPR1interleave(); + spr1finished = true; break; } } @@ -411,14 +407,10 @@ void dmaSPR1() // toSPR if(spr1->chcr.MOD == CHAIN_MODE && spr1->qwc > 0) { //DevCon.Warning(L"SPR1 QWC on Chain " + spr1->chcr.desc()); - if(((spr1->chcr.TAG >> 12) & 0x7) == 0x7 || ((spr1->chcr.TAG >> 12) & 0x7) == 0x0) + if ((spr1->chcr.tag().ID == TAG_END) || (spr1->chcr.tag().ID == TAG_REFE)) { spr1finished = true; } - else - { - spr1finished = false; - } } SPRTOinterrupt(); diff --git a/pcsx2/Vif0_Dma.cpp b/pcsx2/Vif0_Dma.cpp index 37633c202d..14088ae9ce 100644 --- a/pcsx2/Vif0_Dma.cpp +++ b/pcsx2/Vif0_Dma.cpp @@ -232,7 +232,8 @@ void dmaVIF0() vif0.dmamode = VIF_CHAIN_MODE; //DevCon.Warning(L"VIF0 QWC on Chain CHCR " + vif0ch->chcr.desc()); vif0.inprogress |= 0x1; - if(((vif0ch->chcr.TAG >> 12) & 0x7) == 0x0 || ((vif0ch->chcr.TAG >> 12) & 0x7) == 0x7) + + if ((vif0ch->chcr.tag().ID == TAG_REFE) || (vif0ch->chcr.tag().ID == TAG_END)) { vif0.done = true; } diff --git a/pcsx2/Vif1_Dma.cpp b/pcsx2/Vif1_Dma.cpp index 27f657971e..e9e0efdbdb 100644 --- a/pcsx2/Vif1_Dma.cpp +++ b/pcsx2/Vif1_Dma.cpp @@ -282,7 +282,7 @@ bool CheckPath2GIF(int channel) } else if( vif1.GifWaitState == 1 ) // Else we're flushing path3 :), but of course waiting for the microprogram to finish { - if(gifRegs->stat.P1Q == true) + if (gifRegs->stat.P1Q) { //DevCon.Warning("VIF1-1 stall P1Q %x P2Q %x APATH %x PTH3 %x vif1cmd %x", gifRegs->stat.P1Q, gifRegs->stat.P2Q, gifRegs->stat.APATH, GSTransferStatus.PTH3, vif1.cmd); CPU_INT(channel, 128); @@ -316,7 +316,7 @@ bool CheckPath2GIF(int channel) } else //Normal Flush { - if(gifRegs->stat.P1Q == true) + if (gifRegs->stat.P1Q) { //DevCon.Warning("VIF1-2 stall P1Q %x P2Q %x APATH %x PTH3 %x vif1cmd %x", gifRegs->stat.P1Q, gifRegs->stat.P2Q, gifRegs->stat.APATH, GSTransferStatus.PTH3, vif1.cmd); CPU_INT(channel, 128); @@ -340,7 +340,6 @@ __forceinline void vif1Interrupt() { gifRegs->stat.OPH = false; gifRegs->stat.APATH = GIF_APATH_IDLE; - } if (schedulepath3msk & 0x10) @@ -350,7 +349,7 @@ __forceinline void vif1Interrupt() return; } //Some games (Fahrenheit being one) start vif first, let it loop through blankness while it sets MFIFO mode, so we need to check it here. - if (dmacRegs->ctrl.MFD == MFD_VIF1) // VIF MFIFO + if (dmacRegs->ctrl.MFD == MFD_VIF1) { //Console.WriteLn("VIFMFIFO\n"); // Test changed because the Final Fantasy 12 opening somehow has the tag in *Undefined* mode, which is not in the documentation that I saw. @@ -360,20 +359,20 @@ __forceinline void vif1Interrupt() return; } - if(vif1ch->chcr.DIR && CheckPath2GIF(DMAC_VIF1) == false) return; //We need to check the direction, if it is downloading from the GS, we handle that seperately (KH2 for testing) - if (vif1ch->chcr.DIR)vif1Regs->stat.FQC = min(vif1ch->qwc, (u16)16); - //Simulated GS transfer time done, clear the flags + if (vif1ch->chcr.DIR) + { + if (!CheckPath2GIF(DMAC_VIF1)) return; + + vif1Regs->stat.FQC = min(vif1ch->qwc, (u16)16); + //Simulated GS transfer time done, clear the flags + } - - - - if (!(vif1ch->chcr.STR)) Console.WriteLn("Vif1 running when CHCR == %x", vif1ch->chcr._u32); if (vif1.cmd) { - if(vif1.done == true && vif1ch->qwc == 0) vif1Regs->stat.VPS = VPS_WAITING; + if (vif1.done == true && vif1ch->qwc == 0) vif1Regs->stat.VPS = VPS_WAITING; } else { @@ -486,7 +485,8 @@ void dmaVIF1() vif1.dmamode = VIF_CHAIN_MODE; //DevCon.Warning(L"VIF1 QWC on Chain CHCR " + vif1ch->chcr.desc()); vif1.inprogress |= 0x1; - if(((vif1ch->chcr.TAG >> 12) & 0x7) == 0x0 || ((vif1ch->chcr.TAG >> 12) & 0x7) == 0x7) + + if ((vif1ch->chcr.tag().ID == TAG_REFE) || (vif1ch->chcr.tag().ID == TAG_END)) { vif1.done = true; }