From e615fe1c08fa288917da7432a88b348099e4fa1f Mon Sep 17 00:00:00 2001 From: refraction Date: Sat, 30 Apr 2011 18:30:31 +0000 Subject: [PATCH] Added GameFix for Transformers and Test Drive Unlimited to solve the slow booting issue, Test Drive is now playable at least :P. Also tidied up a small bit of VIF DIRECT/HL, no functional changes made. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4608 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Config.h | 5 ++++- pcsx2/HwRead.cpp | 5 +++++ pcsx2/Pcsx2Config.cpp | 8 ++++++-- pcsx2/Vif_Codes.cpp | 13 +++++++------ pcsx2/gui/Panels/GameFixesPanel.cpp | 8 ++++++++ 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/pcsx2/Config.h b/pcsx2/Config.h index 0209dc62e9..1d56d24060 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -52,6 +52,7 @@ enum GamefixId Fix_SkipMpeg, Fix_OPHFlag, Fix_DMABusy, + Fix_VIFFIFO, GamefixId_COUNT }; @@ -341,7 +342,8 @@ struct Pcsx2Config EETimingHack :1, // General purpose timing hack. SkipMPEGHack :1, // Skips MPEG videos (Katamari and other games need this) OPHFlagHack :1, // Bleach Blade Battlers - DMABusyHack :1; // Denies writes to the DMAC when it's busy. This is correct behaviour but bad timing can cause problems. + DMABusyHack :1, // Denies writes to the DMAC when it's busy. This is correct behaviour but bad timing can cause problems. + VIFFIFOHack :1; // Pretends to fill the non-existant VIF FIFO Buffer. BITFIELD_END GamefixOptions(); @@ -487,6 +489,7 @@ TraceLogFilters& SetTraceConfig(); #define CHECK_SKIPMPEGHACK (EmuConfig.Gamefixes.SkipMPEGHack) // Finds sceMpegIsEnd pattern to tell the game the mpeg is finished (Katamari and a lot of games need this) #define CHECK_OPHFLAGHACK (EmuConfig.Gamefixes.OPHFlagHack) // Bleach Blade Battlers #define CHECK_DMABUSYHACK (EmuConfig.Gamefixes.DMABusyHack) // Denies writes to the DMAC when it's busy. This is correct behaviour but bad timing can cause problems. +#define CHECK_VIFFIFOHACK (EmuConfig.Gamefixes.VIFFIFOHack) // Pretends to fill the non-existant VIF FIFO Buffer. //------------ Advanced Options!!! --------------- #define CHECK_VU_OVERFLOW (EmuConfig.Cpu.Recompiler.vuOverflow) diff --git a/pcsx2/HwRead.cpp b/pcsx2/HwRead.cpp index 7e25c1144a..c9483d3e6f 100644 --- a/pcsx2/HwRead.cpp +++ b/pcsx2/HwRead.cpp @@ -136,6 +136,11 @@ mem32_t __fastcall _hwRead32(u32 mem) } break; } + //Hack for Transformers and Test Drive Unlimited to simulate filling the VIF FIFO + //It actually stalls VIF a few QW before the end of the transfer, so we need to pretend its all gone + //else itll take aaaaaaaaages to boot. + if(mem == (D1_CHCR + 0x10) && CHECK_VIFFIFOHACK) + return psHu32(mem) + (vif1ch.qwc * 16); return psHu32(mem); } diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index ffbf76e410..e0a3536554 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -252,7 +252,8 @@ const wxChar *const tbl_GamefixNames[] = L"EETiming", L"SkipMpeg", L"OPHFlag", - L"DMABusy" + L"DMABusy", + L"VIFFIFO" }; const __fi wxChar* EnumToString( GamefixId id ) @@ -310,6 +311,7 @@ void Pcsx2Config::GamefixOptions::Set( GamefixId id, bool enabled ) case Fix_SkipMpeg: SkipMPEGHack = enabled; break; case Fix_OPHFlag: OPHFlagHack = enabled; break; case Fix_DMABusy: DMABusyHack = enabled; break; + case Fix_VIFFIFO: VIFFIFOHack = enabled; break; jNO_DEFAULT; } @@ -331,8 +333,9 @@ bool Pcsx2Config::GamefixOptions::Get( GamefixId id ) const case Fix_SkipMpeg: return SkipMPEGHack; case Fix_OPHFlag: return OPHFlagHack; case Fix_DMABusy: return DMABusyHack; + case Fix_VIFFIFO: return VIFFIFOHack; - jNO_DEFAULT + jNO_DEFAULT; } return false; // unreachable, but we still need to suppress warnings >_< } @@ -352,6 +355,7 @@ void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini ) IniBitBool( SkipMPEGHack ); IniBitBool( OPHFlagHack ); IniBitBool( DMABusyHack ); + IniBitBool( VIFFIFOHack ); } Pcsx2Config::Pcsx2Config() diff --git a/pcsx2/Vif_Codes.cpp b/pcsx2/Vif_Codes.cpp index 9a2abe9f56..c70bbc42d1 100644 --- a/pcsx2/Vif_Codes.cpp +++ b/pcsx2/Vif_Codes.cpp @@ -200,19 +200,16 @@ template __fi int _vifCode_Direct(int pass, const u8* data, bool isDire // only seems to happen on TTE mode transfers with their split-64-bit packets, there shouldn't // be any need to worry about queuing more than 16 bytes of data, // - - - - ret = 0; minSize = aMin(minSize, 4-partial_count); + for( uint i=0; i<(minSize & 3); ++i) { partial_write[partial_count++] = ((u32*)data)[i]; - ret++; + } pxAssume( partial_count <= 4 ); - + if (partial_count == 4) { GetMTGS().PrepDataPacket(GIF_PATH_2, 1); @@ -220,6 +217,8 @@ template __fi int _vifCode_Direct(int pass, const u8* data, bool isDire GetMTGS().SendDataPacket(); partial_count = 0; } + + ret = minSize; } else { @@ -242,7 +241,9 @@ template __fi int _vifCode_Direct(int pass, const u8* data, bool isDire { vif1.cmd = 0; } + vif1.vifstalled = true; + return ret; } return 0; diff --git a/pcsx2/gui/Panels/GameFixesPanel.cpp b/pcsx2/gui/Panels/GameFixesPanel.cpp index e7f02a045f..ac0d38998f 100644 --- a/pcsx2/gui/Panels/GameFixesPanel.cpp +++ b/pcsx2/gui/Panels/GameFixesPanel.cpp @@ -90,6 +90,14 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) L"Known to affect following games:\n" L" * Mana Khemia 1 (Going \"off campus\")\n" ) + }, + { + _("Simulate VIF1 FIFO read ahead. Fixes slow loading games."), + pxEt( "!ContextTip:Gamefixes:VIF1 FIFO hack", + L"Known to affect following games:\n" + L" * Test Drive Unlimited\n" + L" * Transformers" + ) } };