From 429691ce96edab0bee2d8e111b90b4f12fa4daff Mon Sep 17 00:00:00 2001 From: ayuanx Date: Wed, 13 Jan 2010 11:42:04 +0000 Subject: [PATCH] This should settle the FIFO BP critical games like Metroid Prime 2 G2ME01.ini [Video] FIFOBPHack = 1 git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4823 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/LuaInterface.cpp | 4 ++-- Source/Core/DolphinWX/Src/ISOProperties.cpp | 14 +++++++++++++- Source/Core/DolphinWX/Src/ISOProperties.h | 3 ++- Source/Core/VideoCommon/Src/CommandProcessor.cpp | 12 +++++++++++- Source/Core/VideoCommon/Src/VideoConfig.cpp | 4 ++++ Source/Core/VideoCommon/Src/VideoConfig.h | 1 + 6 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Src/LuaInterface.cpp b/Source/Core/Core/Src/LuaInterface.cpp index 7d7e10f3a5..ef71d5355f 100644 --- a/Source/Core/Core/Src/LuaInterface.cpp +++ b/Source/Core/Core/Src/LuaInterface.cpp @@ -1459,7 +1459,7 @@ DEFINE_LUA_FUNCTION(memory_readqword, "address") int address = (int)luaL_checkinteger(L,1); unsigned long long value = Memory::Read_U64(address); lua_settop(L,0); - lua_pushinteger(L, value); + lua_pushinteger(L, (lua_Integer)value); return 1; } DEFINE_LUA_FUNCTION(memory_readqwordsigned, "address") @@ -1467,7 +1467,7 @@ DEFINE_LUA_FUNCTION(memory_readqwordsigned, "address") int address = (int)luaL_checkinteger(L,1); signed long long value = (signed long long)(Memory::Read_U64(address)); lua_settop(L,0); - lua_pushinteger(L, value); + lua_pushinteger(L, (lua_Integer)value); return 1; } diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index 6535c37688..3b30c614b1 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -311,6 +311,7 @@ void CISOProperties::CreateGUIControls(bool IsWad) DstAlphaPass = new wxCheckBox(m_GameConfig, ID_DSTALPHAPASS, _("Distance Alpha Pass"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); UseXFB = new wxCheckBox(m_GameConfig, ID_USEXFB, _("Use XFB"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); // Hack + BPHack = new wxCheckBox(m_GameConfig, ID_BPHACK, _("FIFO BP Hack"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); Hacktext = new wxStaticText(m_GameConfig, ID_HACK_TEXT, _("Projection Hack for: "), wxDefaultPosition, wxDefaultSize); arrayStringFor_Hack.Add(_("None")); arrayStringFor_Hack.Add(_("Zelda Twilight Princess Bloom hack")); @@ -355,6 +356,7 @@ void CISOProperties::CreateGUIControls(bool IsWad) sbVideoOverrides->Add(SafeTextureCache, 0, wxEXPAND|wxLEFT, 5); sbVideoOverrides->Add(DstAlphaPass, 0, wxEXPAND|wxLEFT, 5); sbVideoOverrides->Add(UseXFB, 0, wxEXPAND|wxLEFT, 5); + sbVideoOverrides->Add(BPHack, 0, wxEXPAND|wxLEFT, 5); sbVideoOverrides->Add(Hacktext, 0, wxEXPAND|wxLEFT, 5); sbVideoOverrides->Add(Hack, 0, wxEXPAND|wxLEFT, 5); sbHLEaudioOverrides->Add(UseRE0Fix, 0, wxEXPAND|wxLEFT, 5); @@ -858,7 +860,12 @@ void CISOProperties::LoadGameConfig() UseRE0Fix->Set3StateValue((wxCheckBoxState)bTemp); else UseRE0Fix->Set3StateValue(wxCHK_UNDETERMINED); - + + if (GameIni.Get("Video", "FIFOBPHack", &bTemp)) + BPHack->Set3StateValue((wxCheckBoxState)bTemp); + else + BPHack->Set3StateValue(wxCHK_UNDETERMINED); + GameIni.Get("Video", "ProjectionHack", &iTemp, -1); Hack->SetSelection(iTemp); @@ -944,6 +951,11 @@ bool CISOProperties::SaveGameConfig() else GameIni.Set("HLEaudio", "UseRE0Fix", UseRE0Fix->Get3StateValue()); + if (BPHack->Get3StateValue() == wxCHK_UNDETERMINED) + GameIni.DeleteKey("Video", "FIFOBPHack"); + else + GameIni.Set("Video", "FIFOBPHack", BPHack->Get3StateValue()); + if (EmuState->GetSelection() == -1) GameIni.DeleteKey("Video", "ProjectionHack"); else diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index 6e69c0cec8..bee7ad7742 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -81,7 +81,7 @@ class CISOProperties : public wxDialog wxStaticText *OverrideText; // Core - wxCheckBox *CPUThread, *SkipIdle, *OptimizeQuantizers, *TLBHack; + wxCheckBox *CPUThread, *SkipIdle, *OptimizeQuantizers, *TLBHack, *BPHack; // Wii wxCheckBox *EnableProgressiveScan, *EnableWideScreen; // Video @@ -160,6 +160,7 @@ class CISOProperties : public wxDialog ID_USEDUALCORE, ID_IDLESKIP, ID_TLBHACK, + ID_BPHACK, ID_FORCEFILTERING, ID_EFBCOPYDISABLE, ID_EFBTOTEXTUREENABLE, diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.cpp b/Source/Core/VideoCommon/Src/CommandProcessor.cpp index dff94e2184..c02fd492c7 100644 --- a/Source/Core/VideoCommon/Src/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/Src/CommandProcessor.cpp @@ -69,6 +69,7 @@ #include "Common.h" #include "VideoCommon.h" +#include "VideoConfig.h" #include "MathUtil.h" #include "Thread.h" #include "Atomic.h" @@ -408,6 +409,12 @@ void Write16(const u16 _Value, const u32 _Address) { // Clear old BP and initiate new BP Common::AtomicStore(fifo.bFF_Breakpoint, 0); + + // The following is a hack of Synchronized Breakpoint for dual core mode + // Some games only waits a finite N cycles for FIFO interrupts, then hangs up on time out + // e.g. Metriod Prime 2 + if (g_VideoInitialize.bOnThread && g_ActiveConfig.bFIFOBPhack) + UpdateInterrupts(true); } INFO_LOG(COMMANDPROCESSOR,"\t write to CTRL_REGISTER : %04x", _Value); @@ -730,7 +737,10 @@ void UpdateInterrupts(bool active) void UpdateInterruptsFromVideoPlugin(bool active) { - g_VideoInitialize.pScheduleEvent_Threadsafe(0, et_UpdateInterrupts, active); + if (g_ActiveConfig.bFIFOBPhack) + return; + else + g_VideoInitialize.pScheduleEvent_Threadsafe(0, et_UpdateInterrupts, active); } void SetFifoIdleFromVideoPlugin() diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 2a2503dec6..100176863f 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -92,6 +92,7 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0); iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToRAM, true); iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true); + iniFile.Get("Hacks", "FIFOBPHack", &bFIFOBPhack, false); iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0); iniFile.Get("Hardware", "Adapter", &iAdapter, 0); @@ -131,6 +132,8 @@ void VideoConfig::GameIniLoad(const char *ini_file) iniFile.Get("Video", "DstAlphaPass", &bDstAlphaPass, false); if (iniFile.Exists("Video", "UseXFB")) iniFile.Get("Video", "UseXFB", &bUseXFB, 0); + if (iniFile.Exists("Video", "FIFOBPHack")) + iniFile.Get("Video", "FIFOBPHack", &bFIFOBPhack, false); if (iniFile.Exists("Video", "ProjectionHack")) iniFile.Get("Video", "ProjectionHack", &iPhackvalue, 0); } @@ -185,6 +188,7 @@ void VideoConfig::Save(const char *ini_file) iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey); iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToRAM); iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled); + iniFile.Set("Hacks", "FIFOBPHack", bFIFOBPhack); iniFile.Set("Hacks", "ProjectionHack", iPhackvalue); iniFile.Set("Hardware", "Adapter", iAdapter); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 23bc326178..e3dd402c5f 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -111,6 +111,7 @@ struct VideoConfig bool bCopyEFBToRAM; bool bCopyEFBScaled; bool bSafeTextureCache; + bool bFIFOBPhack; int iPhackvalue; bool bPhackvalue1, bPhackvalue2; float fhackvalue1, fhackvalue2;