Gif Unit/VIF: Fix up some bits from r5551. Fixes SSX 3 and Charlie and the Chocolate Factory.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5552 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
refraction@gmail.com 2013-02-10 15:06:10 +00:00
parent b51f0b01dd
commit e8d865d01d
3 changed files with 43 additions and 9 deletions

View File

@ -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);
}
}
}

View File

@ -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);
}

View File

@ -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"); }