Reimplemented Path3progress status var, and set incPmem to count in QWCs (cleanup).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1828 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-09-15 11:26:05 +00:00
parent bd3601b2d6
commit 5378760fcf
2 changed files with 28 additions and 16 deletions

View File

@ -230,27 +230,33 @@ void mtgsThreadObject::Reset()
} }
#define incPmem(x) { \ #define incPmem(x) { \
pMem += x; \ pMem += (x*16); \
size += x; \ size += (x*16); \
if ((pathidx==GIF_PATH_1)&&(pMem>=vuMemEnd)) pMem -= 0x4000; \ if ((pathidx==GIF_PATH_1)&&(pMem>=vuMemEnd)) pMem -= 0x4000; \
} }
__forceinline int mtgsThreadObject::_gifTransferDummy(GIF_PATH pathidx, const u8* pMem, u32 size) __forceinline int mtgsThreadObject::_gifTransferDummy(GIF_PATH pathidx, const u8* pMem, u32 size)
{ {
GIFPath& path = m_path[pathidx]; GIFPath& path = m_path[pathidx];
u8* vuMemEnd = (u8*)pMem + (size<<4); // End of VU Mem const u8* vuMemEnd = pMem + (size<<4); // End of VU Mem
u32 finish = (pathidx == GIF_PATH_1) ? 0x4000 : (size<<4); u32 finish = (pathidx == GIF_PATH_1) ? 0x4000 : (size<<4);
bool EOP = 0; bool EOP = 0;
bool hasRegAD = 0; bool hasRegAD = 0;
size = 0; size = 0;
while(!EOP && size < finish) { while(!EOP && size < finish) {
path.SetTag(pMem); path.SetTag(pMem);
path.PrepRegs(!path.tag.flg); path.PrepRegs(!path.tag.flg);
EOP = (pathidx == GIF_PATH_2) ? 0 : path.tag.eop; EOP = (pathidx == GIF_PATH_2) ? 0 : path.tag.eop;
incPmem(16); incPmem(1);
if (!path.tag.nloop) continue; if (!path.tag.nloop) continue;
int numRegs = ((path.tag.nreg-1)&0xf)+1; int numRegs = ((path.tag.nreg-1)&0xf)+1;
// Assume Path3progress as transfer mode here, and switch to IMAGE mode if needed.
// Path3progress gets reset to STOPPED on EOP only (ie, not on 'partial' transfers)
if( pathidx == GIF_PATH_3 )
Path3progress = TRANSFER_MODE;
switch(path.tag.flg) { switch(path.tag.flg) {
case GIF_FLG_PACKED: case GIF_FLG_PACKED:
for (u32 i = 0; i < path.tag.nloop; i++) { for (u32 i = 0; i < path.tag.nloop; i++) {
@ -263,31 +269,37 @@ __forceinline int mtgsThreadObject::_gifTransferDummy(GIF_PATH pathidx, const u8
} }
hasRegAD = 1; hasRegAD = 1;
} }
incPmem(16); incPmem(1);
if (size >= finish) goto endLoop; if (size >= finish)
goto endLoop;
} }
if (!hasRegAD) { // Optimization: No Need to Loop if (!hasRegAD) { // Optimization: No Need to Loop
incPmem((16 * numRegs * (path.tag.nloop-1))); incPmem(numRegs * (path.tag.nloop-1));
break; break;
} }
} }
break; break;
case GIF_FLG_REGLIST: case GIF_FLG_REGLIST:
numRegs = (numRegs + 1) / 2; numRegs = (numRegs + 1) / 2;
incPmem((16 * numRegs * path.tag.nloop)); incPmem(numRegs * path.tag.nloop);
break; break;
case GIF_FLG_IMAGE: case GIF_FLG_IMAGE:
case GIF_FLG_IMAGE2: case GIF_FLG_IMAGE2:
incPmem((16 * path.tag.nloop)); if( pathidx == GIF_PATH_3 )
Path3progress = IMAGE_MODE;
incPmem(path.tag.nloop);
break; break;
} }
} }
endLoop: endLoop:
// This handles cases where we skipped too far ahead because of bulky IMAGE tags
// or the RegAD tag (they don't check against 'finish' on every qwc like the others).
if (size > finish) size = finish; if (size > finish) size = finish;
if (pathidx == GIF_PATH_3) { if (pathidx == GIF_PATH_3) {
gif->madr += size; gif->madr += size;
gif->qwc -= (size/16); gif->qwc -= (size/16);
Path3progress = STOPPED_MODE; if( EOP ) Path3progress = STOPPED_MODE;
} }
return (size / 16); return (size / 16);
} }

View File

@ -59,7 +59,7 @@ static const unsigned int VIF1dmanum = 1;
int g_vifCycles = 0; int g_vifCycles = 0;
Path3Modes Path3progress = STOPPED_MODE; Path3Modes Path3progress = STOPPED_MODE;
u32 splittransfer[4]; static PCSX2_ALIGNED16( u32 splittransfer[4] );
u32 splitptr = 0; u32 splitptr = 0;
typedef void (__fastcall *UNPACKFUNCTYPE)(u32 *dest, u32 *data, int size); typedef void (__fastcall *UNPACKFUNCTYPE)(u32 *dest, u32 *data, int size);