fix #1134 (american girls julie finds a way) by changing behaviour of box test busy flag relative to fifo

This commit is contained in:
zeromus 2016-08-13 23:50:25 +00:00
parent cc2c86cf11
commit abbfa4a6b7
2 changed files with 28 additions and 12 deletions

View File

@ -237,6 +237,15 @@ void GFX_FIFOsend(u8 cmd, u32 param)
if(IsMatrixStackCommand(cmd))
gxFIFO.matrix_stack_op_size++;
//along the same lines:
//american girls julie finds a way will put a bunch of stuff and then a box test into the fifo and then immediately test the busy flag
//so we need to set the busy flag here.
//does it expect the fifo to be running then? well, it's definitely jammed -- making it unjammed at one point did fix this bug.
//it's still not clear whether we're handling the immediate vs fifo commands properly at all :(
//anyway, here we go, similar treatment. consider this a hack.
if(cmd == 0x70) MMU_new.gxstat.tb = 1; //just set the flag--youre insane if you queue more than one of these anyway
if(cmd == 0x71) MMU_new.gxstat.tb = 1;
if(gxFIFO.size>=HACK_GXIFO_SIZE) {
printf("--FIFO FULL-- : %d\n",gxFIFO.size);
}

View File

@ -1496,8 +1496,9 @@ static void gfx3d_glViewPort(u32 v)
static BOOL gfx3d_glBoxTest(u32 v)
{
//printf("boxtest\n");
MMU_new.gxstat.tr = 0; // clear boxtest bit
MMU_new.gxstat.tb = 1; // busy
//clear result flag. busy flag has been set by fifo component already
MMU_new.gxstat.tr = 0;
BTcoords[BTind++] = v & 0xFFFF;
BTcoords[BTind++] = v >> 16;
@ -1505,9 +1506,11 @@ static BOOL gfx3d_glBoxTest(u32 v)
if (BTind < 5) return FALSE;
BTind = 0;
MMU_new.gxstat.tb = 0; // clear busy
GFX_DELAY(103);
//now that we're executing this, we're not busy anymore
MMU_new.gxstat.tb = 0;
#if 0
INFO("BoxTEST: x %f y %f width %f height %f depth %f\n",
BTcoords[0], BTcoords[1], BTcoords[2], BTcoords[3], BTcoords[4], BTcoords[5]);
@ -1620,27 +1623,31 @@ static BOOL gfx3d_glBoxTest(u32 v)
//if any portion of this poly was retained, then the test passes.
if (boxtestClipper.clippedPolyCounter > 0)
{
//printf("%06d PASS %d\n",boxcounter,gxFIFO.size);
//printf("%06d PASS %d\n",gxFIFO.size, i);
MMU_new.gxstat.tr = 1;
break;
}
else
{
}
//if(i==5) printf("%06d FAIL\n",gxFIFO.size);
}
if (MMU_new.gxstat.tr == 0)
{
//printf("%06d FAIL %d\n",boxcounter,gxFIFO.size);
}
//printf("%06d RESULT %d\n",gxFIFO.size, MMU_new.gxstat.tr);
return TRUE;
}
static BOOL gfx3d_glPosTest(u32 v)
{
//printf("postest\n");
//this is apparently tested by transformers decepticons and ultimate spiderman
//printf("POSTEST\n");
MMU_new.gxstat.tb = 1;
//clear result flag. busy flag has been set by fifo component already
MMU_new.gxstat.tr = 0;
//now that we're executing this, we're not busy anymore
MMU_new.gxstat.tb = 0;
PTcoords[PTind++] = float16table[v & 0xFFFF];
PTcoords[PTind++] = float16table[v >> 16];