Don't do invalid GIFchain calls, fixes Dual Hearts part 2 of Issue 314.

This is part of PATH 3 masking mess, so it could fix other PATH 3 using games.
Added some debug lines as well, should there be problems.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2331 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2009-12-09 12:23:24 +00:00
parent 1bb1b71544
commit 514d78392c
1 changed files with 20 additions and 11 deletions

View File

@ -135,7 +135,8 @@ int _GIFchain()
static __forceinline void GIFchain() static __forceinline void GIFchain()
{ {
Registers::Freeze(); Registers::Freeze();
if (gif->qwc) gscycles+= _GIFchain(); /* guessing */ // qwc check now done outside this function
/*if (gif->qwc)*/ gscycles+= _GIFchain(); /* guessing */
Registers::Thaw(); Registers::Thaw();
} }
@ -236,10 +237,14 @@ void GIFdma()
return; return;
} }
//Check with Path3 masking games
if (gif->qwc > 0) {
GIFchain(); GIFchain();
CPU_INT(2, gscycles * BIAS); CPU_INT(2, gscycles * BIAS);
return; return;
} }
else DevCon.WriteLn("GIFdma() case 1, but qwc = 0!"); //Don't do 0 GIFchain and then return
}
// Transfer Dn_QWC from Dn_MADR to GIF // Transfer Dn_QWC from Dn_MADR to GIF
if ((gif->chcr.MOD == NORMAL_MODE) || (gif->qwc > 0)) // Normal Mode if ((gif->chcr.MOD == NORMAL_MODE) || (gif->qwc > 0)) // Normal Mode
@ -250,11 +255,14 @@ void GIFdma()
Console.WriteLn("DMA Stall Control on GIF normal"); Console.WriteLn("DMA Stall Control on GIF normal");
} }
//Check with Path3 masking games
if (gif->qwc > 0) {
GIFchain(); //Transfers the data set by the switch GIFchain(); //Transfers the data set by the switch
CPU_INT(2, gscycles * BIAS); CPU_INT(2, gscycles * BIAS);
return; return;
} }
else DevCon.WriteLn("GIFdma() case 2, but qwc = 0!"); //Don't do 0 GIFchain and then return, fixes Dual Hearts
}
if ((gif->chcr.MOD == CHAIN_MODE) && (!gspath3done)) // Chain Mode if ((gif->chcr.MOD == CHAIN_MODE) && (!gspath3done)) // Chain Mode
{ {
@ -267,7 +275,8 @@ void GIFdma()
// there are still bugs, need to also check if gif->madr +16*qwc >= stadr, if not, stall // there are still bugs, need to also check if gif->madr +16*qwc >= stadr, if not, stall
if (!gspath3done && ((gif->madr + (gif->qwc * 16)) > dmacRegs->stadr.ADDR) && (ptag->ID == TAG_REFS)) if (!gspath3done && ((gif->madr + (gif->qwc * 16)) > dmacRegs->stadr.ADDR) && (ptag->ID == TAG_REFS))
{ {
// stalled // 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 Source = %x, Drain = %x\n MADR = %x, STADR = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3,gif->madr, psHu32(DMAC_STADR));
prevcycles = gscycles; prevcycles = gscycles;
gif->tadr -= 16; gif->tadr -= 16;