Path3 Masking: Games should no longer need the EE Timing fix. General fixes for Need for Speed Underground 2 and other games affected by the change. Hopefully Outrun and Terminator 3 will be ok now too, no promises (as i don't have the games)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5222 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
refraction 2012-05-23 16:22:03 +00:00
parent 31956dcb87
commit 739bcc6886
5 changed files with 26 additions and 8 deletions

View File

@ -50,6 +50,17 @@ void incGifChAddr(u32 qwc) {
__fi void gifInterrupt()
{
GIF_LOG("gifInterrupt caught!");
//Required for Path3 Masking timing!
if(gifUnit.gifPath[GIF_PATH_3].state == GIF_PATH_WAIT)
{
gifUnit.gifPath[GIF_PATH_3].state = GIF_PATH_IDLE;
if(vif1Regs.stat.VGW)
{
CPU_INT(DMAC_GIF, 16);
return;
}
}
if (dmacRegs.ctrl.MFD == MFD_GIF) { // GIF MFIFO
//Console.WriteLn("GIF MFIFO");
@ -238,7 +249,7 @@ void GIFdma()
GIFchain(); //Transfers the data set by the switch
CPU_INT(DMAC_GIF, gscycles);
return;
}
} else if(gspath3done == false) GIFdma();
prevcycles = 0;
CPU_INT(DMAC_GIF, gscycles);

View File

@ -56,7 +56,8 @@ enum GIF_PATH_STATE {
GIF_PATH_IDLE = 0, // Path is idle (hasn't started a GS packet)
GIF_PATH_PACKED = 1, // Path is on a PACKED gif tag
GIF_PATH_REGLIST = 2, // Path is on a REGLIST gif tag
GIF_PATH_IMAGE = 3 // Path is on a IMAGE gif tag
GIF_PATH_IMAGE = 3, // Path is on a IMAGE gif tag
GIF_PATH_WAIT = 4 // Used only by PATH3 to simulate packet length (Path 3 Masking)
};
enum GIF_FLG {

View File

@ -72,7 +72,7 @@ bool Gif_HandlerAD(u8* pMem) {
GSSIGLBLID.LBLID = (GSSIGLBLID.LBLID&~data[1])|(data[0]&data[1]);
}
elif (reg >= 0x63 && reg != 0x7f) {
DevCon.Warning("GIF Handler - Write to unknown register! [reg=%x]", reg);
//DevCon.Warning("GIF Handler - Write to unknown register! [reg=%x]", reg);
}
return false;
}

View File

@ -183,7 +183,7 @@ struct Gif_Path {
s32 getReadAmount() { return AtomicRead(readAmount) + gsPack.readAmount; }
bool hasDataRemaining() { return curOffset < curSize; }
bool isDone() { return isMTVU() ? !mtvu.fakePackets
: (!hasDataRemaining() && state == GIF_PATH_IDLE); }
: (!hasDataRemaining() && (state == GIF_PATH_IDLE || state == GIF_PATH_WAIT)); }
// Waits on the MTGS to process gs packets
void mtgsReadWait() {
@ -295,7 +295,13 @@ struct Gif_Path {
if (gifTag.tag.EOP) {
GS_Packet t = gsPack;
t.done = 1;
state = GIF_PATH_IDLE;
//Path 3 Masking is timing sensitive, we need to simulate its length! (NFSU2)
if((gifRegs.stat.APATH-1) == GIF_PATH_3)
state = GIF_PATH_WAIT;
else
state = GIF_PATH_IDLE;
gsPack.Reset();
gsPack.offset = curOffset;
return t; // Complete GS packet
@ -584,7 +590,7 @@ struct Gif_Unit {
bool CanDoP3Slice() { return stat.IMT == 1 && gifPath[GIF_PATH_3].state == GIF_PATH_IMAGE; }
bool CanDoGif() { return stat.PSE == 0 && (CHECK_GIFREVERSEHACK ? 1 : stat.DIR == 0) && gsSIGNAL.queued == 0; }
//Mask stops the next packet which hasnt started from transferring
bool Path3Masked() { return ((stat.M3R || stat.M3P) && (gifPath[GIF_PATH_3].state == GIF_PATH_IDLE)); }
bool Path3Masked() { return ((stat.M3R || stat.M3P) && (gifPath[GIF_PATH_3].state == GIF_PATH_IDLE || gifPath[GIF_PATH_3].state == GIF_PATH_WAIT)); }
void PrintInfo(bool printP1=1, bool printP2=1, bool printP3=1) {
u32 a = checkPaths(1,1,1), b = checkQueued(1,1,1);

View File

@ -360,14 +360,14 @@ vifOp(vifCode_MskPath3) {
vifOp(vifCode_Nop) {
pass1 {
GetVifX.cmd = 0;
if(idx && vif1ch.chcr.STR == true)
/*if(idx && vif1ch.chcr.STR == true)
{
//Some games use a huge stream of NOPS to wait for a GIF packet to start, alas the way PCSX2 works it never starts
//So the mask can go on before the packet continues, causing desync.
if(((data[1] >> 24) & 0x7f) == 0x6) //Look in to the future and see if we have a mask path 3 command (NFSU)
GetVifX.vifstalled = true; //Stall if we do to get the timing right.
}
}*/
}
pass3 { VifCodeLog("Nop"); }
return 0;