Guest User

Dolphin's Watchog Patch (Watchdog_V3_3934+.patch)

a guest
Feb 15th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.30 KB | None | 0 0
  1. Index: Source/Core/Core/Src/ConfigManager.cpp
  2. ===================================================================
  3. --- Source/Core/Core/Src/ConfigManager.cpp  (revision 3934)
  4. +++ Source/Core/Core/Src/ConfigManager.cpp  (working copy)
  5. @@ -121,6 +121,7 @@
  6.         ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
  7.         ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
  8.         ini.Set("Core", "FrameLimit",   m_Framelimit);
  9. +       ini.Set("Core", "Watchdog", m_Watchdog);
  10.  
  11.         // Wii
  12.         ini.Set("Wii", "Widescreen", m_LocalCoreStartupParameter.bWidescreen);
  13. @@ -238,6 +239,7 @@
  14.         ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
  15.         ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0);
  16.         ini.Get("Core", "FrameLimit",   &m_Framelimit,0);
  17. +       ini.Get("Core", "Watchdog", &m_Watchdog,12);
  18.  
  19.         // Wii
  20.         ini.Get("Wii", "Widescreen", &m_LocalCoreStartupParameter.bWidescreen, false);
  21. Index: Source/Core/Core/Src/ConfigManager.h
  22. ===================================================================
  23. --- Source/Core/Core/Src/ConfigManager.h    (revision 3934)
  24. +++ Source/Core/Core/Src/ConfigManager.h    (working copy)
  25. @@ -67,6 +67,7 @@
  26.     INTERFACE_LANGUAGE m_InterfaceLanguage;
  27.     // framelimit choose
  28.     u32 m_Framelimit;
  29. +   u32 m_Watchdog;
  30.     // other interface settings
  31.     bool m_InterfaceToolbar;
  32.     bool m_InterfaceStatusbar;
  33. Index: Source/Core/Core/Src/HW/SystemTimers.cpp
  34. ===================================================================
  35. --- Source/Core/Core/Src/HW/SystemTimers.cpp    (revision 3934)
  36. +++ Source/Core/Core/Src/HW/SystemTimers.cpp    (working copy)
  37. @@ -76,6 +76,7 @@
  38.  #include "../IPC_HLE/WII_IPC_HLE.h"
  39.  #include "Thread.h"
  40.  #include "Timer.h"
  41. +#include "../ConfigManager.h"
  42.  
  43.  /////////////////////////////
  44.  
  45. @@ -108,6 +109,7 @@
  46.  int et_DSP;
  47.  int et_IPC_HLE;
  48.  int et_FakeGPWD; // for DC watchdog hack
  49. +int WatchdogChecker = 0;
  50.  
  51.  // These are badly educated guesses
  52.  // Feel free to experiment. Set these in Init below.
  53. @@ -183,11 +185,35 @@
  54.     CoreTiming::ScheduleEvent(VideoInterface::getTicksPerLine() - cyclesLate, et_VI);
  55.  }
  56.  
  57. +//Real time watchdog change, SICallback takes care of triggering this
  58. +void WatchDogHackReset()
  59. +{
  60. +   u32 targetWatchDog = (SConfig::GetInstance().m_Watchdog)*5;
  61. +   if ( targetWatchDog == 0 )
  62. +       targetWatchDog = 1;
  63. +   int NEW_FAKE_GP_WATCHDOG_PERIOD = GetTicksPerSecond() / targetWatchDog;
  64. +
  65. +   if ((Core::GetStartupParameter().bUseDualCore) && (NEW_FAKE_GP_WATCHDOG_PERIOD != FAKE_GP_WATCHDOG_PERIOD) )
  66. +   {
  67. +       FAKE_GP_WATCHDOG_PERIOD = NEW_FAKE_GP_WATCHDOG_PERIOD;
  68. +       CoreTiming::ScheduleEvent(FAKE_GP_WATCHDOG_PERIOD, et_FakeGPWD);
  69. +   }
  70. +}
  71. +
  72. +
  73.  void SICallback(u64 userdata, int cyclesLate)
  74.  {
  75.     SerialInterface::UpdateDevices();
  76.     CoreTiming::ScheduleEvent(SI_PERIOD-cyclesLate, et_SI);
  77.  
  78. +   // Sorry, i'm adding this checking here.
  79. +   WatchdogChecker++;
  80. +   if ( WatchdogChecker > 59 )
  81. +   {
  82. +       WatchdogChecker = 0;
  83. +       WatchDogHackReset();
  84. +   }
  85. +
  86.     // This is once per frame - good candidate for patching stuff
  87.     // Patch mem and run the Action Replay
  88.     PatchEngine::ApplyFramePatches();
  89. @@ -232,7 +258,10 @@
  90.  
  91.  void Init()
  92.  {
  93. -   FAKE_GP_WATCHDOG_PERIOD = GetTicksPerSecond() / 60;
  94. +   u32 targetWatchDog = (SConfig::GetInstance().m_Watchdog)*5;
  95. +   if ( targetWatchDog == 0 )
  96. +       targetWatchDog = 1;
  97. +   FAKE_GP_WATCHDOG_PERIOD = GetTicksPerSecond() / targetWatchDog;
  98.     if (Core::GetStartupParameter().bWii)
  99.     {
  100.         CPU_CORE_CLOCK = 729000000u;
  101. Index: Source/Core/DolphinWX/Src/ConfigMain.cpp
  102. ===================================================================
  103. --- Source/Core/DolphinWX/Src/ConfigMain.cpp    (revision 3934)
  104. +++ Source/Core/DolphinWX/Src/ConfigMain.cpp    (working copy)
  105. @@ -55,6 +55,7 @@
  106.  EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::CoreSettingsChanged)
  107.  EVT_CHECKBOX(ID_ENABLECHEATS, CConfigMain::CoreSettingsChanged)
  108.  EVT_CHOICE(ID_FRAMELIMIT, CConfigMain::CoreSettingsChanged)
  109. +EVT_CHOICE(ID_WATCHDOG, CConfigMain::CoreSettingsChanged)
  110.  
  111.  EVT_CHOICE(ID_GC_SRAM_LNG, CConfigMain::GCSettingsChanged)
  112.  EVT_CHOICE(ID_GC_EXIDEVICE_SLOTA, CConfigMain::GCSettingsChanged)
  113. @@ -141,7 +142,7 @@
  114.         OptimizeQuantizers->Disable();
  115.         SkipIdle->Disable();
  116.         EnableCheats->Disable();
  117. -      
  118. +
  119.         GCSystemLang->Disable();
  120.        
  121.         WiiPage->Disable();
  122. @@ -187,6 +188,20 @@
  123.     arrayStringFor_Framelimit.Add(wxT("50"));
  124.     arrayStringFor_Framelimit.Add(wxT("55"));
  125.     arrayStringFor_Framelimit.Add(wxT("60"));
  126. +   // WatchDog
  127. +   arrayStringFor_Watchdog.Add(wxT("1"));
  128. +   arrayStringFor_Watchdog.Add(wxT("5"));
  129. +   arrayStringFor_Watchdog.Add(wxT("10"));
  130. +   arrayStringFor_Watchdog.Add(wxT("15"));
  131. +   arrayStringFor_Watchdog.Add(wxT("20"));
  132. +   arrayStringFor_Watchdog.Add(wxT("25"));
  133. +   arrayStringFor_Watchdog.Add(wxT("30"));
  134. +   arrayStringFor_Watchdog.Add(wxT("35"));
  135. +   arrayStringFor_Watchdog.Add(wxT("40"));
  136. +   arrayStringFor_Watchdog.Add(wxT("45"));
  137. +   arrayStringFor_Watchdog.Add(wxT("50"));
  138. +   arrayStringFor_Watchdog.Add(wxT("55"));
  139. +   arrayStringFor_Watchdog.Add(wxT("60"));
  140.        
  141.     // Create the notebook and pages
  142.     Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
  143. @@ -262,7 +277,12 @@
  144.     // need redesign
  145.     InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage);
  146.  
  147. -   // Themes - this should really be a wxChoice...
  148. +   // Choose Watchdog
  149. +   wxStaticText *WatchdogText = new wxStaticText(GeneralPage, ID_WATCHDOG_TEXT, wxT("Watchdog:"), wxDefaultPosition, wxDefaultSize);
  150. +   Watchdog = new wxChoice(GeneralPage, ID_WATCHDOG, wxDefaultPosition, wxDefaultSize, arrayStringFor_Watchdog, 0, wxDefaultValidator);
  151. +   Watchdog->SetSelection(SConfig::GetInstance().m_Watchdog);
  152. +
  153. +
  154.     wxArrayString ThemeChoices;
  155.     ThemeChoices.Add(wxT("Boomy"));
  156.     ThemeChoices.Add(wxT("Vista"));
  157. @@ -337,6 +357,10 @@
  158.     sInterfaceLanguage->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
  159.     sInterfaceLanguage->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5);
  160.     sbInterface->Add(sInterfaceLanguage, 0, wxEXPAND | wxALL, 5);
  161. +   wxBoxSizer *sWatchdog = new wxBoxSizer(wxHORIZONTAL);
  162. +   sFramelimit->Add(WatchdogText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
  163. +   sFramelimit->Add(Watchdog, 0, wxEXPAND | wxALL, 5);
  164. +   sbInterface->Add(sWatchdog, 0, wxEXPAND | wxALL, 5);
  165.  
  166.     // Populate the entire page
  167.     sGeneralPage = new wxBoxSizer(wxVERTICAL);
  168. @@ -660,6 +684,9 @@
  169.     case ID_FRAMELIMIT:
  170.         SConfig::GetInstance().m_Framelimit = (u32)Framelimit->GetSelection();
  171.         break;
  172. +   case ID_WATCHDOG:
  173. +       SConfig::GetInstance().m_Watchdog = (u32)Watchdog->GetSelection();
  174. +       break;
  175.     case ID_ALLWAYS_HLEBIOS: // Core
  176.         SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios = AlwaysUseHLEBIOS->IsChecked();
  177.         break;
  178. Index: Source/Core/DolphinWX/Src/ConfigMain.h
  179. ===================================================================
  180. --- Source/Core/DolphinWX/Src/ConfigMain.h  (revision 3934)
  181. +++ Source/Core/DolphinWX/Src/ConfigMain.h  (working copy)
  182. @@ -59,6 +59,9 @@
  183.         wxArrayString arrayStringFor_Framelimit;
  184.         wxChoice* Framelimit;
  185.  
  186. +       wxArrayString arrayStringFor_Watchdog;
  187. +       wxChoice* Watchdog;
  188. +
  189.         wxRadioBox* Theme;
  190.        
  191.         wxBoxSizer* sCore;
  192. @@ -230,6 +233,7 @@
  193.             ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG,
  194.             ID_INTERFACE_THEME,
  195.             ID_FRAMELIMIT_TEXT, ID_FRAMELIMIT,
  196. +           ID_WATCHDOG_TEXT, ID_WATCHDOG,
  197.  
  198.             ID_GC_SRAM_LNG_TEXT,
  199.             ID_GC_SRAM_LNG,
Add Comment
Please, Sign In to add comment