diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index 6a1839b07b..aa0fb09082 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -71,6 +71,8 @@ struct SConfig // framelimit choose int m_Framelimit; bool b_UseFPS; + // FIFO watermark tightness + int m_WatermarkTightness; // other interface settings bool m_InterfaceToolbar; bool m_InterfaceStatusbar; diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index dda9ec2389..1b38ebaef0 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -321,6 +321,10 @@ void CISOProperties::CreateGUIControls(bool IsWad) arrayStringFor_Hack.Add(_("Skies of Arcadia")); Hack = new wxChoice(m_GameConfig, ID_HACK, wxDefaultPosition, wxDefaultSize, arrayStringFor_Hack, 0, wxDefaultValidator); + WMTightnessText = new wxStaticText(m_GameConfig, ID_WMTIGHTNESS_TEXT, wxT("Watermark tightness: "), wxDefaultPosition, wxDefaultSize); + WMTightness = new wxTextCtrl(m_GameConfig, ID_WMTIGHTNESS, wxT(""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); + WMTightness->SetToolTip(wxT("Change this if you get lots of FIFO overflow errors. Reasonable values range from 0 to 200.")); + // Emulation State sEmuState = new wxBoxSizer(wxHORIZONTAL); EmuStateText = new wxStaticText(m_GameConfig, ID_EMUSTATE_TEXT, _("Emulation State: "), wxDefaultPosition, wxDefaultSize); @@ -348,8 +352,14 @@ void CISOProperties::CreateGUIControls(bool IsWad) 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); + + wxFlexGridSizer* fifosizer = new wxFlexGridSizer(2, 2, 0, 0); + fifosizer->Add(Hacktext, 0, wxLEFT, 5); + fifosizer->Add(Hack, 0, wxEXPAND|wxLEFT, 5); + fifosizer->Add(WMTightnessText, 0, wxLEFT, 5); + fifosizer->Add(WMTightness, 0, wxEXPAND|wxLEFT, 5); + sbVideoOverrides->Add(fifosizer); + sbGameConfig->Add(sbCoreOverrides, 0, wxEXPAND); sbGameConfig->Add(sbWiiOverrides, 0, wxEXPAND); sbGameConfig->Add(sbVideoOverrides, 0, wxEXPAND); @@ -846,6 +856,11 @@ void CISOProperties::LoadGameConfig() else BPHack->Set3StateValue(wxCHK_UNDETERMINED); + if (GameIni.Get("Video", "FIFOWatermarkTightness", &sTemp)) + WMTightness->SetValue(wxString(sTemp.c_str(), *wxConvCurrent)); + else + WMTightness->SetValue(wxT("50")); + GameIni.Get("Video", "ProjectionHack", &iTemp, -1); Hack->SetSelection(iTemp); @@ -931,6 +946,15 @@ bool CISOProperties::SaveGameConfig() else GameIni.Set("Video", "ProjectionHack", Hack->GetSelection()); + if (WMTightness->GetValue().size() == 0) + GameIni.DeleteKey("Video", "FIFOWatermarkTightness"); + else + { + long val; + WMTightness->GetValue().ToLong(&val); + GameIni.Set("Video", "FIFOWatermarkTightness", (int)val); + } + if (EmuState->GetSelection() == -1) GameIni.DeleteKey("EmuState", "EmulationStateId"); else diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index 3ea5973dbe..ca8680905c 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -93,6 +93,8 @@ class CISOProperties : public wxDialog wxStaticText *Hacktext; wxArrayString arrayStringFor_Hack; wxChoice *Hack; + wxStaticText *WMTightnessText; + wxTextCtrl *WMTightness; wxButton *EditConfig; wxStaticText *EmuStateText; @@ -169,6 +171,8 @@ class CISOProperties : public wxDialog ID_USEXFB, ID_HACK_TEXT, ID_HACK, + ID_WMTIGHTNESS_TEXT, + ID_WMTIGHTNESS, ID_ENABLEPROGRESSIVESCAN, ID_ENABLEWIDESCREEN, ID_EDITCONFIG, diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.cpp b/Source/Core/VideoCommon/Src/CommandProcessor.cpp index 82e599432b..39da6aeb6f 100644 --- a/Source/Core/VideoCommon/Src/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/Src/CommandProcessor.cpp @@ -495,7 +495,7 @@ void Write16(const u16 _Value, const u32 _Address) case FIFO_HI_WATERMARK_HI: WriteHigh((u32 &)fifo.CPHiWatermark, _Value); // Tune this when you see lots of FIFO overflown by GatherPipe - HiWatermark_Tighter = fifo.CPHiWatermark - 32 * 20; + HiWatermark_Tighter = fifo.CPHiWatermark - 32 * g_ActiveConfig.iFIFOWatermarkTightness; DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_HI : %04x", _Value); break; @@ -616,7 +616,7 @@ void STACKALIGN GatherPipeBursted() } _assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase, - "FIFO is overflown by GatherPipe !\nCPU thread is too fast, lower the HiWatermark may help."); + "FIFO is overflown by GatherPipe !\nCPU thread is too fast, try changing the watermark tightness in the game properties."); // check if we are in sync _assert_msg_(COMMANDPROCESSOR, fifo.CPWritePointer == *(g_VideoInitialize.Fifo_CPUWritePointer), "FIFOs linked but out of sync"); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 6df9bdd756..93b0548304 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -95,6 +95,7 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, false); iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true); iniFile.Get("Hacks", "FIFOBPHack", &bFIFOBPhack, false); + iniFile.Get("Hacks", "FIFOWatermarkTightness", &iFIFOWatermarkTightness, 50); iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0); iniFile.Get("Hardware", "Adapter", &iAdapter, 0); @@ -145,6 +146,8 @@ void VideoConfig::GameIniLoad(const char *ini_file) iniFile.Get("Video", "UseRealXFB", &bUseRealXFB); if (iniFile.Exists("Video", "FIFOBPHack")) iniFile.Get("Video", "FIFOBPHack", &bFIFOBPhack); + if (iniFile.Exists("Video", "FIFOWatermarkTightness")) + iniFile.Get("Video", "FIFOWatermarkTightness", &iFIFOWatermarkTightness); if (iniFile.Exists("Video", "ProjectionHack")) iniFile.Get("Video", "ProjectionHack", &iPhackvalue); if (iniFile.Exists("Video", "UseNativeMips")) diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 1184d2a6b4..2ace261fe6 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -120,6 +120,7 @@ struct VideoConfig bool bSafeTextureCache; int iSafeTextureCache_ColorSamples; bool bFIFOBPhack; + int iFIFOWatermarkTightness; int iPhackvalue; bool bPhackvalue1, bPhackvalue2; float fhackvalue1, fhackvalue2;