From b4b61faa70d52a1886fb1330e9389e71f00dfea0 Mon Sep 17 00:00:00 2001 From: refraction Date: Fri, 26 Mar 2010 01:35:17 +0000 Subject: [PATCH] Fixed a couple of issues with GIF stalls, also quite a nasty bug which could have completely screwed Normal GIF transfers git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2769 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Gif.cpp | 9 ++++++--- pcsx2/IPU/IPU.cpp | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pcsx2/Gif.cpp b/pcsx2/Gif.cpp index 7deaaaa778..9e9e76c691 100644 --- a/pcsx2/Gif.cpp +++ b/pcsx2/Gif.cpp @@ -206,7 +206,7 @@ void GIFdma() if ((gif->madr + (gif->qwc * 16)) > dmacRegs->stadr.ADDR) { - CPU_INT(DMAC_GIF, gscycles); + CPU_INT(DMAC_GIF, 4); gscycles = 0; return; } @@ -272,7 +272,10 @@ void GIFdma() GIFchain(); //Transfers the data set by the switch CPU_INT(DMAC_GIF, gscycles * BIAS); return; + } else { //Else it really is a normal transfer and we want to quit, else it gets confused with chains + gspath3done = 1; } + //else DevCon.WriteLn("GIFdma() case 2, but qwc = 0!"); //Don't do 0 GIFchain and then return, fixes Dual Hearts } @@ -289,9 +292,9 @@ void GIFdma() { // stalled. // We really need to test this. Pay attention to prevcycles, as it used to trigger GIFchains in the code above. (rama) - Console.WriteLn("GS Stall Control Source = %x, Drain = %x\n MADR = %x, STADR = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3,gif->madr, psHu32(DMAC_STADR)); + Console.WriteLn("GS Stall Control start Source = %x, Drain = %x\n MADR = %x, STADR = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3,gif->madr, psHu32(DMAC_STADR)); prevcycles = gscycles; - gif->tadr -= 16; + //gif->tadr -= 16; hwDmacIrq(DMAC_STALL_SIS); CPU_INT(DMAC_GIF, gscycles); gscycles = 0; diff --git a/pcsx2/IPU/IPU.cpp b/pcsx2/IPU/IPU.cpp index c541ee83bc..89ac884bed 100644 --- a/pcsx2/IPU/IPU.cpp +++ b/pcsx2/IPU/IPU.cpp @@ -1309,10 +1309,13 @@ static __forceinline bool ipuDmacSrcChain(DMACh *tag, tDMA_TAG *ptag) static __forceinline void flushGIF() { - while(gif->chcr.STR && (vif1Regs->mskpath3 == 0) && Path3progress != STOPPED_MODE) + if (dmacRegs->ctrl.STD != STD_GIF || (gif->madr + (gif->qwc * 16)) < dmacRegs->stadr.ADDR) { - GIF_LOG("Flushing gif chcr %x tadr %x madr %x qwc %x", gif->chcr._u32, gif->tadr, gif->madr, gif->qwc); - gsInterrupt(); + while(gif->chcr.STR && (vif1Regs->mskpath3 == 0) && Path3progress != STOPPED_MODE) + { + GIF_LOG("Flushing gif chcr %x tadr %x madr %x qwc %x", gif->chcr._u32, gif->tadr, gif->madr, gif->qwc); + gsInterrupt(); + } } } @@ -1566,7 +1569,7 @@ void ipu0Interrupt() { // gif g_nDMATransfer.GIFSTALL = false; - if (gif->chcr.STR) GIFdma(); + //if (gif->chcr.STR) GIFdma(); } if (g_nDMATransfer.VIFSTALL)