Revision 2822 contains a bug somewhere that we need to figure out.

So this reverts all VIF and GIF related code of that revision, 
leaving only the changes that were made to IPU.

Compatibility should be fixed again, with the added bonus of lots more videos working. 

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2828 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2010-04-09 15:15:43 +00:00
parent 3546591de5
commit 04eb79093d
11 changed files with 68 additions and 169 deletions

View File

@ -60,15 +60,10 @@ void __fastcall ReadFIFO_page_5(u32 mem, u64 *out)
if (vif1Regs->stat.test(VIF1_STAT_INT | VIF1_STAT_VSS | VIF1_STAT_VIS | VIF1_STAT_VFS) ) if (vif1Regs->stat.test(VIF1_STAT_INT | VIF1_STAT_VSS | VIF1_STAT_VIS | VIF1_STAT_VFS) )
DevCon.Warning( "Reading from vif1 fifo when stalled" ); DevCon.Warning( "Reading from vif1 fifo when stalled" );
if(vif1Regs->stat.FQC == 0) Console.Warning("FQC = 0 on VIF FIFO READ!");
if (vif1Regs->stat.FDR) if (vif1Regs->stat.FDR)
{ {
if (vif1Regs->stat.FQC > 0) if (--psHu32(D1_QWC) == 0)
{ vif1Regs->stat.FQC = 0;
GetMTGS().WaitGS();
GSreadFIFO(&psHu64(VIF1_FIFO));
}
if(vif1Regs->stat.FQC > 0)--vif1Regs->stat.FQC;
} }
out[0] = psHu64(VIF1_FIFO); out[0] = psHu64(VIF1_FIFO);

View File

@ -56,7 +56,22 @@ __forceinline void gsInterrupt()
} }
if (GSTransferStatus.PTH3 == STOPPED_MODE)
if ((vif1.cmd & 0x7e) == 0x50) // DIRECT/HL
{
//original behaviour here - if (Path3progress != IMAGE_MODE) vif1Regs->stat.VGW = false;
// Transfer in progress on VIF and GIF has finished so let VIF do its bit
if (Path3progress == STOPPED_MODE)
{
vif1Regs->stat.VGW = false;
CPU_INT( DMAC_GIF, 4 );
return;
}
}
if (Path3progress == STOPPED_MODE)
{ {
gifRegs->stat.clear_flags(GIF_STAT_APATH3 | GIF_STAT_OPH); gifRegs->stat.clear_flags(GIF_STAT_APATH3 | GIF_STAT_OPH);
} }
@ -204,16 +219,13 @@ void GIFdma()
gifRegs->stat.FQC |= 0x10;// FQC=31, hack ;) (for values of 31 that equal 16) [ used to be 0xE00; // OPH=1 | APATH=3] gifRegs->stat.FQC |= 0x10;// FQC=31, hack ;) (for values of 31 that equal 16) [ used to be 0xE00; // OPH=1 | APATH=3]
//Path2 gets priority in intermittent mode //Path2 gets priority in intermittent mode
if (GSTransferStatus.PTH1 != STOPPED_MODE || GSTransferStatus.PTH2 != STOPPED_MODE) if ((gifRegs->stat.P1Q || (vif1.cmd & 0x7e) == 0x50) && gifRegs->mode.IMT && (Path3progress == STOPPED_MODE))
{ {
// We are in image mode doing DIRECTHL, Path 1 is in queue, and in intermittant mode. // We are in image mode doing DIRECTHL, Path 1 is in queue, and in intermittant mode.
GIF_LOG("Waiting VU %x, PATH2 %x, GIFMODE %x Progress %x", gifRegs->stat.P1Q, (vif1.cmd & 0x7f), gifRegs->mode._u32, GSTransferStatus.PTH3); GIF_LOG("Waiting VU %x, PATH2 %x, GIFMODE %x Progress %x", gifRegs->stat.P1Q, (vif1.cmd & 0x7f), gifRegs->mode._u32, Path3progress);
if(GSTransferStatus.PTH3 == STOPPED_MODE)
{
CPU_INT(DMAC_GIF, 16); CPU_INT(DMAC_GIF, 16);
return; return;
} }
}
if (vif1Regs->mskpath3 || gifRegs->mode.M3R) if (vif1Regs->mskpath3 || gifRegs->mode.M3R)
{ {
@ -230,9 +242,8 @@ void GIFdma()
} }
} }
if (GSTransferStatus.PTH3 == STOPPED_MODE) /*|| (vif1Regs->stat._u32 |= VIF1_STAT_VGW) == 0*/ if (Path3progress == STOPPED_MODE) /*|| (vif1Regs->stat._u32 |= VIF1_STAT_VGW) == 0*/
{ {
GIF_LOG("PTH3 MASK Continuing VIF");
vif1Regs->stat.VGW = false; vif1Regs->stat.VGW = false;
if (gif->qwc == 0) CPU_INT(DMAC_GIF, 16); if (gif->qwc == 0) CPU_INT(DMAC_GIF, 16);
return; return;
@ -240,7 +251,6 @@ void GIFdma()
//Check with Path3 masking games //Check with Path3 masking games
if (gif->qwc > 0) { if (gif->qwc > 0) {
GIF_LOG("PTH3 MASK Transferring", ptag[1]._u32, ptag[0]._u32, gif->qwc, ptag->ID, gif->madr);
GIFchain(); GIFchain();
CPU_INT(DMAC_GIF, gscycles * BIAS); CPU_INT(DMAC_GIF, gscycles * BIAS);
return; return;
@ -323,7 +333,7 @@ void dmaGIF()
//It takes the time of 24 QW for the BUS to become ready - The Punisher And Streetball //It takes the time of 24 QW for the BUS to become ready - The Punisher And Streetball
GIF_LOG("dmaGIFstart chcr = %lx, madr = %lx, qwc = %lx\n tadr = %lx, asr0 = %lx, asr1 = %lx", gif->chcr._u32, gif->madr, gif->qwc, gif->tadr, gif->asr0, gif->asr1); GIF_LOG("dmaGIFstart chcr = %lx, madr = %lx, qwc = %lx\n tadr = %lx, asr0 = %lx, asr1 = %lx", gif->chcr._u32, gif->madr, gif->qwc, gif->tadr, gif->asr0, gif->asr1);
GSTransferStatus.PTH3 = STOPPED_MODE; Path3progress = STOPPED_MODE;
gspath3done = false; // For some reason this doesn't clear? So when the system starts the thread, we will clear it :) gspath3done = false; // For some reason this doesn't clear? So when the system starts the thread, we will clear it :)
gifRegs->stat.P3Q = true; gifRegs->stat.P3Q = true;
@ -536,7 +546,7 @@ void gifMFIFOInterrupt()
//Console.WriteLn("gifMFIFOInterrupt"); //Console.WriteLn("gifMFIFOInterrupt");
mfifocycles = 0; mfifocycles = 0;
if (GSTransferStatus.PTH3 == STOPPED_MODE) if (Path3progress == STOPPED_MODE)
{ {
gifRegs->stat.APATH = GIF_APATH_IDLE; gifRegs->stat.APATH = GIF_APATH_IDLE;
gifRegs->stat.OPH = false; gifRegs->stat.OPH = false;
@ -555,9 +565,9 @@ void gifMFIFOInterrupt()
return; return;
} }
if ((gifRegs->stat.P1Q || (vif1.cmd & 0x7f) == 0x50) && gifRegs->mode.IMT && GSTransferStatus.PTH3 == IMAGE_MODE) //Path2 gets priority in intermittent mode if ((gifRegs->stat.P1Q || (vif1.cmd & 0x7f) == 0x50) && gifRegs->mode.IMT && Path3progress == IMAGE_MODE) //Path2 gets priority in intermittent mode
{ {
//GIF_LOG("Waiting VU %x, PATH2 %x, GIFMODE %x Progress %x", psHu32(GIF_STAT) & 0x100, (vif1.cmd & 0x7f), psHu32(GIF_MODE), GSTransferStatus.PTH3); //GIF_LOG("Waiting VU %x, PATH2 %x, GIFMODE %x Progress %x", psHu32(GIF_STAT) & 0x100, (vif1.cmd & 0x7f), psHu32(GIF_MODE), Path3progress);
CPU_INT(11,mfifocycles); CPU_INT(11,mfifocycles);
return; return;
} }

View File

@ -26,29 +26,13 @@ enum gifstate_t
GIF_STATE_EMPTY = 0x10 GIF_STATE_EMPTY = 0x10
}; };
enum GSTransferModes //0 = Image Mode (DirectHL), 1 = transferring, 2 = Stopped at End of Packet enum Path3Modes //0 = Image Mode (DirectHL), 1 = transferring, 2 = Stopped at End of Packet
{ {
IMAGE_MODE = 0, IMAGE_MODE = 0,
TRANSFER_MODE = 1, TRANSFER_MODE = 1,
STOPPED_MODE = 2 STOPPED_MODE = 2
}; };
union tGSTransferStatus {
struct {
u32 PTH1 : 2; // Resets Vif(0/1) when written.
u32 PTH2 : 2; // Causes a Forcebreak to Vif((0/1) when true. (Stall)
u32 PTH3 : 2; // Stops after the end of the Vifcode in progress when true. (Stall)
u32 reserved : 26;
};
u32 _u32;
tGSTransferStatus(u32 val) { _u32 = val; }
bool test (u32 flags) const { return !!(_u32 & flags); }
void set_flags (u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"GSTransferStatus.PTH3: 0x%x", _u32); }
};
//GIF_STAT //GIF_STAT
enum gif_stat_flags enum gif_stat_flags
{ {
@ -278,7 +262,7 @@ struct GIFregisters
#define gifRegs ((GIFregisters*)(PS2MEM_HW+0x3000)) #define gifRegs ((GIFregisters*)(PS2MEM_HW+0x3000))
extern tGSTransferStatus GSTransferStatus; extern Path3Modes Path3progress;
extern void gsInterrupt(); extern void gsInterrupt();
extern int _GIFchain(); extern int _GIFchain();

View File

@ -1313,7 +1313,6 @@ static __forceinline int IPU1chain() {
return totalqwc; return totalqwc;
} }
//static __forceinline bool flushGIF() //static __forceinline bool flushGIF()
//{ //{
// //Wait for all GS paths to be clear // //Wait for all GS paths to be clear
@ -1331,7 +1330,7 @@ static __forceinline void flushGIF()
{ {
if (dmacRegs->ctrl.STD != STD_GIF || (gif->madr + (gif->qwc * 16)) < dmacRegs->stadr.ADDR) if (dmacRegs->ctrl.STD != STD_GIF || (gif->madr + (gif->qwc * 16)) < dmacRegs->stadr.ADDR)
{ {
while(gif->chcr.STR && (vif1Regs->mskpath3 == 0) && GSTransferStatus.PTH3 != STOPPED_MODE) 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); GIF_LOG("Flushing gif chcr %x tadr %x madr %x qwc %x", gif->chcr._u32, gif->tadr, gif->madr, gif->qwc);
gsInterrupt(); gsInterrupt();
@ -1339,7 +1338,6 @@ static __forceinline void flushGIF()
} }
} }
int IPU1dma() int IPU1dma()
{ {
bool done = FALSE; bool done = FALSE;
@ -1348,7 +1346,8 @@ int IPU1dma()
//We need to make sure GIF has flushed before sending IPU data, it seems to REALLY screw FFX videos //We need to make sure GIF has flushed before sending IPU data, it seems to REALLY screw FFX videos
//if(!flushGIF()) return totalqwc; //if(!flushGIF()) return totalqwc;
flushGIF();
flushGIF(); // legacy flushGIF() for now
DMA_LOG("IPU1 DMA Called QWC %x Finished %d In Progress %d tadr %x", ipu1dma->qwc, IPU1Status.DMAFinished, IPU1Status.InProgress, ipu1dma->tadr); DMA_LOG("IPU1 DMA Called QWC %x Finished %d In Progress %d tadr %x", ipu1dma->qwc, IPU1Status.DMAFinished, IPU1Status.InProgress, ipu1dma->tadr);

View File

@ -23,7 +23,7 @@
vifStruct vif0; vifStruct vif0;
vifStruct vif1; vifStruct vif1;
tGSTransferStatus GSTransferStatus = (STOPPED_MODE<<4) | (STOPPED_MODE<<2) | STOPPED_MODE; Path3Modes Path3progress = STOPPED_MODE;
void vif0Init() { initNewVif(0); } void vif0Init() { initNewVif(0); }
void vif1Init() { initNewVif(1); } void vif1Init() { initNewVif(1); }
@ -253,23 +253,15 @@ _f void vif1STAT(u32 value) {
if (vif1Regs->stat.FDR) // Vif transferring to memory. if (vif1Regs->stat.FDR) // Vif transferring to memory.
{ {
// Hack but it checks this is true before transfer? (fatal frame) // Hack but it checks this is true before transfer? (fatal frame)
// Update Refraction: Use of this function has been investigated and understood. vif1Regs->stat.FQC = 0x1;
// Before this ever happens, a DIRECT/HL command takes place sending the transfer info to the GS
// One of the registers told about this is TRXREG which tells us how much data is going to transfer (th x tw) in words
// As far as the GS is concerned, the transfer starts as soon as TRXREG is accessed, which is why fatal frame
// was expecting data, the GS should already be sending it over (buffering in the FIFO)
vif1Regs->stat.FQC = max((u32)16, vif1.GSLastTRXPOS);
//Console.Warning("Reversing VIF Transfer for %x QWC", vif1.GSLastTRXPOS);
} }
/*else // Memory transferring to Vif. else // Memory transferring to Vif.
{ {
vif1ch->qwc = 0; vif1ch->qwc = 0;
vif1.vifstalled = false; vif1.vifstalled = false;
vif1.done = true; vif1.done = true;
vif1Regs->stat.FQC = 0; vif1Regs->stat.FQC = 0;
}*/ }
} }
#define caseVif(x) (idx ? VIF1_##x : VIF0_##x) #define caseVif(x) (idx ? VIF1_##x : VIF0_##x)

View File

@ -152,7 +152,7 @@ __forceinline void vif0Interrupt()
// VIF_NORMAL_FROM_MEM_MODE is a very slow operation. // VIF_NORMAL_FROM_MEM_MODE is a very slow operation.
// Timesplitters 2 depends on this beeing a bit higher than 128. // Timesplitters 2 depends on this beeing a bit higher than 128.
if (vif0.dmamode == VIF_NORMAL_FROM_MEM_MODE ) CPU_INT(DMAC_VIF0, 1024); if (vif0.dmamode == VIF_NORMAL_FROM_MEM_MODE ) CPU_INT(DMAC_VIF0, 1024);
else CPU_INT(DMAC_VIF0, g_vifCycles/*VifCycleVoodoo*/); else CPU_INT(DMAC_VIF0, /*g_vifCycles*/ VifCycleVoodoo);
return; return;
} }
@ -167,7 +167,7 @@ __forceinline void vif0Interrupt()
if ((vif0.inprogress & 0x1) == 0) vif0SetupTransfer(); if ((vif0.inprogress & 0x1) == 0) vif0SetupTransfer();
CPU_INT(DMAC_VIF0, g_vifCycles /*VifCycleVoodoo*/); CPU_INT(DMAC_VIF0, /*g_vifCycles*/ VifCycleVoodoo);
return; return;
} }

View File

@ -200,7 +200,7 @@ __forceinline void vif1Interrupt()
if ((vif1Regs->stat.VGW)) if ((vif1Regs->stat.VGW))
{ {
if ((gif->chcr.STR && (GSTransferStatus.PTH3 != STOPPED_MODE)) || (GSTransferStatus.PTH1 != STOPPED_MODE)) if (gif->chcr.STR && (Path3progress != STOPPED_MODE))
{ {
CPU_INT(DMAC_VIF1, 4); CPU_INT(DMAC_VIF1, 4);
return; return;
@ -240,10 +240,8 @@ __forceinline void vif1Interrupt()
_VIF1chain(); _VIF1chain();
// VIF_NORMAL_FROM_MEM_MODE is a very slow operation. // VIF_NORMAL_FROM_MEM_MODE is a very slow operation.
// Timesplitters 2 depends on this beeing a bit higher than 128. // Timesplitters 2 depends on this beeing a bit higher than 128.
if (vif1.dmamode == VIF_NORMAL_FROM_MEM_MODE ) CPU_INT(DMAC_VIF1, 1024);
// Refraction - Removing voodoo timings for now, completely messes a lot of Path3 masked games. else CPU_INT(DMAC_VIF1, /*g_vifCycles*/ VifCycleVoodoo);
/*if (vif1.dmamode == VIF_NORMAL_FROM_MEM_MODE ) CPU_INT(DMAC_VIF1, 1024);
else */CPU_INT(DMAC_VIF1, g_vifCycles /*VifCycleVoodoo*/);
return; return;
} }
@ -258,7 +256,7 @@ __forceinline void vif1Interrupt()
if ((vif1.inprogress & 0x1) == 0) vif1SetupTransfer(); if ((vif1.inprogress & 0x1) == 0) vif1SetupTransfer();
CPU_INT(DMAC_VIF1, g_vifCycles /*VifCycleVoodoo*/); CPU_INT(DMAC_VIF1, /*g_vifCycles*/ VifCycleVoodoo);
return; return;
} }

View File

@ -78,9 +78,9 @@ void Vif1MskPath3() {
if (!vif1Regs->mskpath3) { if (!vif1Regs->mskpath3) {
//Let the Gif know it can transfer again (making sure any vif stall isnt unset prematurely) //Let the Gif know it can transfer again (making sure any vif stall isnt unset prematurely)
GSTransferStatus.PTH3 = TRANSFER_MODE; Path3progress = TRANSFER_MODE;
gifRegs->stat.IMT = false; gifRegs->stat.IMT = false;
if(gif->chcr.STR == true) CPU_INT(DMAC_GIF, 4); CPU_INT(DMAC_GIF, 4);
} }
else gifRegs->stat.M3P = true; else gifRegs->stat.M3P = true;
@ -111,7 +111,7 @@ template<int idx> _f int _vifCode_Direct(int pass, u8* data, bool isDirectHL) {
//Should probably do this for both types of transfer seen as the GS hates taking 2 seperate chunks //Should probably do this for both types of transfer seen as the GS hates taking 2 seperate chunks
//if (isDirectHL) { //if (isDirectHL) {
if (gif->chcr.STR && (!vif1Regs->mskpath3 && (GSTransferStatus.PTH3 != STOPPED_MODE))) if (gif->chcr.STR && (!vif1Regs->mskpath3 && (Path3progress != STOPPED_MODE)))
{ {
/*if(!isDirectHL) DevCon.WriteLn("Direct: Waiting for Path3 to finish!"); /*if(!isDirectHL) DevCon.WriteLn("Direct: Waiting for Path3 to finish!");
else DevCon.WriteLn("DirectHL: Waiting for Path3 to finish!");*/ else DevCon.WriteLn("DirectHL: Waiting for Path3 to finish!");*/
@ -125,7 +125,7 @@ template<int idx> _f int _vifCode_Direct(int pass, u8* data, bool isDirectHL) {
Registers::Freeze(); Registers::Freeze();
nVifStruct& v = nVif[1]; nVifStruct& v = nVif[1];
const int ret = aMin(vif1.vifpacketsize, vif1.tag.size); const int ret = aMin(vif1.vifpacketsize, vif1.tag.size);
u32 size = ret << 2; s32 size = ret << 2;
if (ret == v.vif->tag.size) { // Full Transfer if (ret == v.vif->tag.size) { // Full Transfer
if (v.bSize) { // Last transfer was partial if (v.bSize) { // Last transfer was partial
@ -138,14 +138,13 @@ template<int idx> _f int _vifCode_Direct(int pass, u8* data, bool isDirectHL) {
const uint count = GetMTGS().PrepDataPacket(GIF_PATH_2, data, size >> 4); const uint count = GetMTGS().PrepDataPacket(GIF_PATH_2, data, size >> 4);
memcpy_fast(GetMTGS().GetDataPacketPtr(), data, count << 4); memcpy_fast(GetMTGS().GetDataPacketPtr(), data, count << 4);
GetMTGS().SendDataPacket(); GetMTGS().SendDataPacket();
if((count << 4) < size) Console.Warning("PATH2 end early, count %x, size %x", count << 4, size);
vif1.tag.size = 0; vif1.tag.size = 0;
vif1.cmd = 0; vif1.cmd = 0;
v.bSize = 0; v.bSize = 0;
gifRegs->stat.clear_flags(GIF_STAT_APATH2 | GIF_STAT_OPH); gifRegs->stat.clear_flags(GIF_STAT_APATH2 | GIF_STAT_OPH);
} }
else { // Partial Transfer else { // Partial Transfer
DevCon.WriteLn("DirectHL: Partial Transfer [%d]", size); //DevCon.WriteLn("DirectHL: Partial Transfer [%d]", size);
gifRegs->stat.set_flags(GIF_STAT_APATH2 | GIF_STAT_OPH); gifRegs->stat.set_flags(GIF_STAT_APATH2 | GIF_STAT_OPH);
memcpy_fast(&v.buffer[v.bSize], data, size); memcpy_fast(&v.buffer[v.bSize], data, size);
v.bSize += size; v.bSize += size;
@ -181,7 +180,7 @@ vifOp(vifCode_FlushA) {
vif1Only(); vif1Only();
pass1 { pass1 {
// Gif is already transferring so wait for it. // Gif is already transferring so wait for it.
if (((GSTransferStatus.PTH3 != STOPPED_MODE) || !vif1Regs->mskpath3) && gif->chcr.STR) { if (((Path3progress != STOPPED_MODE) || !vif1Regs->mskpath3) && gif->chcr.STR) {
//DevCon.WriteLn("FlushA path3 Wait!"); //DevCon.WriteLn("FlushA path3 Wait!");
vif1Regs->stat.VGW = true; vif1Regs->stat.VGW = true;
vifX.vifstalled = true; vifX.vifstalled = true;

View File

@ -24,18 +24,6 @@ struct vifCode {
u16 cl; u16 cl;
}; };
union tBITBLT {
struct {
u32 reserved : 8;
u32 BLTDIVIDE : 8; // This is the value we want to work out the divider for the reverse transfer
u32 reserved2 : 6;
u32 TRXPOS : 16;
};
u32 _u32;
};
// NOTE, if debugging vif stalls, use sega classics, spyro, gt4, and taito // NOTE, if debugging vif stalls, use sega classics, spyro, gt4, and taito
struct vifStruct { struct vifStruct {
vifCode tag; vifCode tag;
@ -48,8 +36,6 @@ struct vifStruct {
bool done; bool done;
bool vifstalled; bool vifstalled;
bool stallontag; bool stallontag;
tBITBLT TRXPOS; //used for reversed fifo operations, sometimes only the GS knows how big (like on HW register fifo read)!
u32 GSLastTRXPOS;
u8 irqoffset; // 32bit offset where next vif code is u8 irqoffset; // 32bit offset where next vif code is
u32 savedtag; // need this for backwards compat with save states u32 savedtag; // need this for backwards compat with save states

View File

@ -74,7 +74,6 @@ _vifT void vifTransferLoop(u32* &data) {
iBit = data[0] >> 31; iBit = data[0] >> 31;
vifXCode[vifX.cmd & 0x7f](0, data); vifXCode[vifX.cmd & 0x7f](0, data);
VIF_LOG("New Vif%d CMD, CMD = %x, iBit = %x, data %x", idx, vifX.cmd, iBit, data[0]);
data++; pSize--; data++; pSize--;
if (analyzeIbit<idx>(data, iBit)) break; if (analyzeIbit<idx>(data, iBit)) break;
continue; continue;

View File

@ -236,7 +236,7 @@ __forceinline bool GIFPath::StepReg()
return true; return true;
} }
__forceinline u8 GIFPath::GetReg() { GIF_LOG("Checking reg %x", regs[curreg]); return regs[curreg]; } __forceinline u8 GIFPath::GetReg() { return regs[curreg]; }
// Unpack the registers - registers are stored as a sequence of 4 bit values in the // Unpack the registers - registers are stored as a sequence of 4 bit values in the
// upper 64 bits of the GIFTAG. That sucks for us when handling partialized GIF packets // upper 64 bits of the GIFTAG. That sucks for us when handling partialized GIF packets
@ -277,40 +277,6 @@ void SaveStateBase::gifPathFreeze()
static __forceinline void gsHandler(const u8* pMem) static __forceinline void gsHandler(const u8* pMem)
{ {
const int handler = pMem[8]; const int handler = pMem[8];
if(handler == 0x50)
{
const u16* pMem16 = (const u16*)pMem;
vif1.TRXPOS._u32 = pMem16[1];
//Console.Warning("BLITBUF = %x %x_%x_%x_%x", vif1.TRXPOS.BLTDIVIDE, pMem16[0], pMem16[1], pMem16[2], pMem16[3]);
switch(vif1.TRXPOS.BLTDIVIDE & 0x3)
{
case 0x3:
//Console.Warning("8bit");
vif1.TRXPOS.BLTDIVIDE = 16; //8bit
break;
case 0x2:
//Console.Warning("16bit");
vif1.TRXPOS.BLTDIVIDE = 8; //16bit
break;
case 0x1:
//Console.Warning("16bit");
vif1.TRXPOS.BLTDIVIDE = 6; //16bit
break;
default:
//Console.Warning("32bit");
vif1.TRXPOS.BLTDIVIDE = 4; //32bit
break;
}
}
if(handler == 0x52)
{
const u16* pMem16 = (const u16*)pMem;
//Console.Warning("TRX REG = %x_%x_%x_%x", pMem16[0], pMem16[1], pMem16[2], pMem16[3]);
vif1.GSLastTRXPOS = (pMem16[0] * pMem16[2]) / (u8)vif1.TRXPOS.BLTDIVIDE;
}
if (handler >= 0x60) if (handler >= 0x60)
{ {
// Question: What happens if an app writes to uncharted register space on real PS2 // Question: What happens if an app writes to uncharted register space on real PS2
@ -344,28 +310,14 @@ __forceinline int GIFPath::ParseTag(GIF_PATH pathidx, const u8* pMem, u32 size)
SetTag(pMem); SetTag(pMem);
incTag(16, 1); incTag(16, 1);
//if (pathidx == GIF_PATH_3) { if (pathidx == GIF_PATH_3) {
switch(pathidx) if (tag.FLG&2) Path3progress = IMAGE_MODE;
{ else Path3progress = TRANSFER_MODE;
case GIF_PATH_1:
if (tag.FLG&2) GSTransferStatus.PTH1 = IMAGE_MODE;
else GSTransferStatus.PTH1 = TRANSFER_MODE;
break;
case GIF_PATH_2:
if (tag.FLG&2) GSTransferStatus.PTH2 = IMAGE_MODE;
else GSTransferStatus.PTH2 = TRANSFER_MODE;
break;
case GIF_PATH_3:
if (tag.FLG&2) GSTransferStatus.PTH3 = IMAGE_MODE;
else GSTransferStatus.PTH3 = TRANSFER_MODE;
break;
} }
//}
} }
else { else {
switch(tag.FLG) { switch(tag.FLG) {
case GIF_FLG_PACKED: case GIF_FLG_PACKED:
GIF_LOG("Packed Mode");
PrepPackedRegs(); PrepPackedRegs();
do { do {
if (GetReg() == 0xe) { if (GetReg() == 0xe) {
@ -376,7 +328,6 @@ __forceinline int GIFPath::ParseTag(GIF_PATH pathidx, const u8* pMem, u32 size)
break; break;
case GIF_FLG_REGLIST: case GIF_FLG_REGLIST:
{ {
GIF_LOG("Reglist Mode");
size *= 2; size *= 2;
do { incTag(8, 1); } do { incTag(8, 1); }
@ -389,7 +340,6 @@ __forceinline int GIFPath::ParseTag(GIF_PATH pathidx, const u8* pMem, u32 size)
case GIF_FLG_IMAGE: case GIF_FLG_IMAGE:
case GIF_FLG_IMAGE2: case GIF_FLG_IMAGE2:
{ {
GIF_LOG("IMAGE Mode");
int len = aMin(size, nloop); int len = aMin(size, nloop);
incTag(( len * 16 ), len); incTag(( len * 16 ), len);
nloop -= len; nloop -= len;
@ -407,23 +357,10 @@ __forceinline int GIFPath::ParseTag(GIF_PATH pathidx, const u8* pMem, u32 size)
size = (startSize - size); size = (startSize - size);
if (tag.EOP && !nloop) {
//Console.Warning("Finishing path %x", pathidx);
switch(pathidx)
{
case GIF_PATH_1:
GSTransferStatus.PTH1 = STOPPED_MODE;
break;
case GIF_PATH_2:
GSTransferStatus.PTH2 = STOPPED_MODE;
break;
case GIF_PATH_3:
GSTransferStatus.PTH3 = STOPPED_MODE;
break;
}
}
if (pathidx == GIF_PATH_3) { if (pathidx == GIF_PATH_3) {
if (tag.EOP && !nloop) {
Path3progress = STOPPED_MODE;
}
gif->madr += size * 16; gif->madr += size * 16;
gif->qwc -= size; gif->qwc -= size;
} }