From 7b195696a7eef35fa20e6c3da5df3f1f36127d08 Mon Sep 17 00:00:00 2001 From: "refraction@gmail.com" Date: Sun, 10 Feb 2013 18:31:35 +0000 Subject: [PATCH] VIF: Hack for Dynasty Warriors 5 Empires. Completely harmless hack to make sure we aren't still waiting for PATH 2 data after a VIF reset. Something really odd is going off with the VIF packets in this game (probably SIF or something), but until we know what, this'll do. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5553 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Vif.cpp | 22 ++++++++++++++++++++++ pcsx2/Vif1_Dma.cpp | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pcsx2/Vif.cpp b/pcsx2/Vif.cpp index 7df6e5692..56ef28a81 100644 --- a/pcsx2/Vif.cpp +++ b/pcsx2/Vif.cpp @@ -21,6 +21,7 @@ #include "GS.h" #include "Gif.h" #include "MTVU.h" +#include "Gif_Unit.h" __aligned16 vifStruct vif0, vif1; @@ -178,6 +179,27 @@ __fi void vif1FBRST(u32 value) { psHu64(VIF1_FIFO + 8) = 0; vif1.done = true; vif1ch.chcr.STR = false; + + //HACK!! Dynasty Warriors 5 Empires has some sort of wierd packet alignment thing going off, meaning + //the packet ends before the DirectHL in progress has finished. Not sure what causes that, but the GIF + //Unit is still waiting for more data, so we have to "pretend" it is finished when the game issues a reset + //which it does without causing any pauses. + //In most cases, this will never ever happen, so doing the following won't matter. + if(!gifUnit.gifPath[GIF_PATH_2].isDone()) + { + DevCon.Warning("VIF1 FBRST While GIF Path2 is waiting for data!"); + gifUnit.gifPath[GIF_PATH_2].state = GIF_PATH_IDLE; + gifUnit.gifPath[GIF_PATH_2].curSize = gifUnit.gifPath[GIF_PATH_2].curOffset; + + if( gifRegs.stat.APATH == 2) + { + 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); + } + } #if USE_OLD_GIF == 1 // ... if(vif1Regs.mskpath3 == 1 && GSTransferStatus.PTH3 == STOPPED_MODE && gifch.chcr.STR == true) { diff --git a/pcsx2/Vif1_Dma.cpp b/pcsx2/Vif1_Dma.cpp index da5243568..a48fa5c1c 100644 --- a/pcsx2/Vif1_Dma.cpp +++ b/pcsx2/Vif1_Dma.cpp @@ -267,7 +267,7 @@ __fi void vif1Interrupt() g_vif1Cycles = 0; - if( gifRegs.stat.APATH == 2 && gifUnit.gifPath[1].isDone()) + if( gifRegs.stat.APATH == 2 && gifUnit.gifPath[GIF_PATH_2].isDone()) { gifRegs.stat.APATH = 0; gifRegs.stat.OPH = 0;