Skip to content

Instantly share code, notes, and snippets.

Created February 15, 2018 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a97bfb957e265f5d6d450f7671d8aed8 to your computer and use it in GitHub Desktop.
Save anonymous/a97bfb957e265f5d6d450f7671d8aed8 to your computer and use it in GitHub Desktop.
Dolphin watchdog patch
Index: Source/Core/Core/Src/ConfigManager.cpp
===================================================================
--- Source/Core/Core/Src/ConfigManager.cpp (revision 3934)
+++ Source/Core/Core/Src/ConfigManager.cpp (working copy)
@@ -121,6 +121,7 @@
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
ini.Set("Core", "FrameLimit", m_Framelimit);
+ ini.Set("Core", "Watchdog", m_Watchdog);
// Wii
ini.Set("Wii", "Widescreen", m_LocalCoreStartupParameter.bWidescreen);
@@ -238,6 +239,7 @@
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0);
ini.Get("Core", "FrameLimit", &m_Framelimit,0);
+ ini.Get("Core", "Watchdog", &m_Watchdog,12);
// Wii
ini.Get("Wii", "Widescreen", &m_LocalCoreStartupParameter.bWidescreen, false);
Index: Source/Core/Core/Src/ConfigManager.h
===================================================================
--- Source/Core/Core/Src/ConfigManager.h (revision 3934)
+++ Source/Core/Core/Src/ConfigManager.h (working copy)
@@ -67,6 +67,7 @@
INTERFACE_LANGUAGE m_InterfaceLanguage;
// framelimit choose
u32 m_Framelimit;
+ u32 m_Watchdog;
// other interface settings
bool m_InterfaceToolbar;
bool m_InterfaceStatusbar;
Index: Source/Core/Core/Src/HW/SystemTimers.cpp
===================================================================
--- Source/Core/Core/Src/HW/SystemTimers.cpp (revision 3934)
+++ Source/Core/Core/Src/HW/SystemTimers.cpp (working copy)
@@ -76,6 +76,7 @@
#include "../IPC_HLE/WII_IPC_HLE.h"
#include "Thread.h"
#include "Timer.h"
+#include "../ConfigManager.h"
/////////////////////////////
@@ -108,6 +109,7 @@
int et_DSP;
int et_IPC_HLE;
int et_FakeGPWD; // for DC watchdog hack
+int WatchdogChecker = 0;
// These are badly educated guesses
// Feel free to experiment. Set these in Init below.
@@ -183,11 +185,35 @@
CoreTiming::ScheduleEvent(VideoInterface::getTicksPerLine() - cyclesLate, et_VI);
}
+//Real time watchdog change, SICallback takes care of triggering this
+void WatchDogHackReset()
+{
+ u32 targetWatchDog = (SConfig::GetInstance().m_Watchdog)*5;
+ if ( targetWatchDog == 0 )
+ targetWatchDog = 1;
+ int NEW_FAKE_GP_WATCHDOG_PERIOD = GetTicksPerSecond() / targetWatchDog;
+
+ if ((Core::GetStartupParameter().bUseDualCore) && (NEW_FAKE_GP_WATCHDOG_PERIOD != FAKE_GP_WATCHDOG_PERIOD) )
+ {
+ FAKE_GP_WATCHDOG_PERIOD = NEW_FAKE_GP_WATCHDOG_PERIOD;
+ CoreTiming::ScheduleEvent(FAKE_GP_WATCHDOG_PERIOD, et_FakeGPWD);
+ }
+}
+
+
void SICallback(u64 userdata, int cyclesLate)
{
SerialInterface::UpdateDevices();
CoreTiming::ScheduleEvent(SI_PERIOD-cyclesLate, et_SI);
+ // Sorry, i'm adding this checking here.
+ WatchdogChecker++;
+ if ( WatchdogChecker > 59 )
+ {
+ WatchdogChecker = 0;
+ WatchDogHackReset();
+ }
+
// This is once per frame - good candidate for patching stuff
// Patch mem and run the Action Replay
PatchEngine::ApplyFramePatches();
@@ -232,7 +258,10 @@
void Init()
{
- FAKE_GP_WATCHDOG_PERIOD = GetTicksPerSecond() / 60;
+ u32 targetWatchDog = (SConfig::GetInstance().m_Watchdog)*5;
+ if ( targetWatchDog == 0 )
+ targetWatchDog = 1;
+ FAKE_GP_WATCHDOG_PERIOD = GetTicksPerSecond() / targetWatchDog;
if (Core::GetStartupParameter().bWii)
{
CPU_CORE_CLOCK = 729000000u;
Index: Source/Core/DolphinWX/Src/ConfigMain.cpp
===================================================================
--- Source/Core/DolphinWX/Src/ConfigMain.cpp (revision 3934)
+++ Source/Core/DolphinWX/Src/ConfigMain.cpp (working copy)
@@ -55,6 +55,7 @@
EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_ENABLECHEATS, CConfigMain::CoreSettingsChanged)
EVT_CHOICE(ID_FRAMELIMIT, CConfigMain::CoreSettingsChanged)
+EVT_CHOICE(ID_WATCHDOG, CConfigMain::CoreSettingsChanged)
EVT_CHOICE(ID_GC_SRAM_LNG, CConfigMain::GCSettingsChanged)
EVT_CHOICE(ID_GC_EXIDEVICE_SLOTA, CConfigMain::GCSettingsChanged)
@@ -141,7 +142,7 @@
OptimizeQuantizers->Disable();
SkipIdle->Disable();
EnableCheats->Disable();
-
+
GCSystemLang->Disable();
WiiPage->Disable();
@@ -187,6 +188,20 @@
arrayStringFor_Framelimit.Add(wxT("50"));
arrayStringFor_Framelimit.Add(wxT("55"));
arrayStringFor_Framelimit.Add(wxT("60"));
+ // WatchDog
+ arrayStringFor_Watchdog.Add(wxT("1"));
+ arrayStringFor_Watchdog.Add(wxT("5"));
+ arrayStringFor_Watchdog.Add(wxT("10"));
+ arrayStringFor_Watchdog.Add(wxT("15"));
+ arrayStringFor_Watchdog.Add(wxT("20"));
+ arrayStringFor_Watchdog.Add(wxT("25"));
+ arrayStringFor_Watchdog.Add(wxT("30"));
+ arrayStringFor_Watchdog.Add(wxT("35"));
+ arrayStringFor_Watchdog.Add(wxT("40"));
+ arrayStringFor_Watchdog.Add(wxT("45"));
+ arrayStringFor_Watchdog.Add(wxT("50"));
+ arrayStringFor_Watchdog.Add(wxT("55"));
+ arrayStringFor_Watchdog.Add(wxT("60"));
// Create the notebook and pages
Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
@@ -262,7 +277,12 @@
// need redesign
InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage);
- // Themes - this should really be a wxChoice...
+ // Choose Watchdog
+ wxStaticText *WatchdogText = new wxStaticText(GeneralPage, ID_WATCHDOG_TEXT, wxT("Watchdog:"), wxDefaultPosition, wxDefaultSize);
+ Watchdog = new wxChoice(GeneralPage, ID_WATCHDOG, wxDefaultPosition, wxDefaultSize, arrayStringFor_Watchdog, 0, wxDefaultValidator);
+ Watchdog->SetSelection(SConfig::GetInstance().m_Watchdog);
+
+
wxArrayString ThemeChoices;
ThemeChoices.Add(wxT("Boomy"));
ThemeChoices.Add(wxT("Vista"));
@@ -337,6 +357,10 @@
sInterfaceLanguage->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sInterfaceLanguage->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5);
sbInterface->Add(sInterfaceLanguage, 0, wxEXPAND | wxALL, 5);
+ wxBoxSizer *sWatchdog = new wxBoxSizer(wxHORIZONTAL);
+ sFramelimit->Add(WatchdogText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
+ sFramelimit->Add(Watchdog, 0, wxEXPAND | wxALL, 5);
+ sbInterface->Add(sWatchdog, 0, wxEXPAND | wxALL, 5);
// Populate the entire page
sGeneralPage = new wxBoxSizer(wxVERTICAL);
@@ -660,6 +684,9 @@
case ID_FRAMELIMIT:
SConfig::GetInstance().m_Framelimit = (u32)Framelimit->GetSelection();
break;
+ case ID_WATCHDOG:
+ SConfig::GetInstance().m_Watchdog = (u32)Watchdog->GetSelection();
+ break;
case ID_ALLWAYS_HLEBIOS: // Core
SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios = AlwaysUseHLEBIOS->IsChecked();
break;
Index: Source/Core/DolphinWX/Src/ConfigMain.h
===================================================================
--- Source/Core/DolphinWX/Src/ConfigMain.h (revision 3934)
+++ Source/Core/DolphinWX/Src/ConfigMain.h (working copy)
@@ -59,6 +59,9 @@
wxArrayString arrayStringFor_Framelimit;
wxChoice* Framelimit;
+ wxArrayString arrayStringFor_Watchdog;
+ wxChoice* Watchdog;
+
wxRadioBox* Theme;
wxBoxSizer* sCore;
@@ -230,6 +233,7 @@
ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG,
ID_INTERFACE_THEME,
ID_FRAMELIMIT_TEXT, ID_FRAMELIMIT,
+ ID_WATCHDOG_TEXT, ID_WATCHDOG,
ID_GC_SRAM_LNG_TEXT,
ID_GC_SRAM_LNG,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment