From 31ca0a1d0b955752c6660a66222286206bad37d2 Mon Sep 17 00:00:00 2001 From: Jean-Philip Desjardins Date: Sun, 18 Sep 2016 17:34:41 -0400 Subject: [PATCH] Simulate data being available in VIF1 FIFO when FDR is set. --- Source/ee/Vif.cpp | 9 +++++++++ Source/ee/Vif.h | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Source/ee/Vif.cpp b/Source/ee/Vif.cpp index ba4516c3..d82d1e10 100644 --- a/Source/ee/Vif.cpp +++ b/Source/ee/Vif.cpp @@ -82,6 +82,12 @@ uint32 CVif::GetRegister(uint32 address) case VIF0_STAT: case VIF1_STAT: result = m_STAT; + if(m_STAT.nFDR != 0) + { + //When FDR is set, it usually means the game is trying to + //read data from GS and that FIFO has some data in it + result |= (0x10 << 24); + } break; case VIF0_MARK: case VIF1_MARK: @@ -139,6 +145,9 @@ void CVif::SetRegister(uint32 address, uint32 value) { switch(address) { + case VIF1_STAT: + m_STAT.nFDR = ((value & STAT_FDR) != 0) ? 1 : 0; + break; case VIF0_FBRST: case VIF1_FBRST: if(value & FBRST_RST) diff --git a/Source/ee/Vif.h b/Source/ee/Vif.h index b34836a7..b7c4dc8f 100644 --- a/Source/ee/Vif.h +++ b/Source/ee/Vif.h @@ -74,6 +74,11 @@ protected: FBRST_STC = 0x08 }; + enum + { + STAT_FDR = 0x00800000, + }; + enum { FIFO_SIZE = 0x100 @@ -129,7 +134,8 @@ protected: unsigned int nINT : 1; unsigned int nER0 : 1; unsigned int nER1 : 1; - unsigned int nReserved2 : 10; + unsigned int nReserved2 : 9; + unsigned int nFDR : 1; //VIF1 only unsigned int nFQC : 4; unsigned int nReserved3 : 4; };