diff --git a/Core/Config.cpp b/Core/Config.cpp index c8155bce66..f1b5d5a4f2 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -293,6 +293,8 @@ static ConfigSetting generalSettings[] = { ReportedConfigSetting("NumWorkerThreads", &g_Config.iNumWorkerThreads, &DefaultNumWorkers, true, true), ConfigSetting("EnableAutoLoad", &g_Config.bEnableAutoLoad, false, true, true), ReportedConfigSetting("EnableCheats", &g_Config.bEnableCheats, false, true, true), + ConfigSetting("CwCheatRefreshRate", &g_Config.iCwCheatRefreshRate, 77, true, true), + ConfigSetting("ScreenshotsAsPNG", &g_Config.bScreenshotsAsPNG, false, true, true), ConfigSetting("StateSlot", &g_Config.iCurrentStateSlot, 0, true, true), ConfigSetting("RewindFlipFrequency", &g_Config.iRewindFlipFrequency, 0, true, true), diff --git a/Core/Config.h b/Core/Config.h index ddab87cced..32eb5731b9 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -182,6 +182,7 @@ public: bool bEnableAutoLoad; bool bEnableCheats; bool bReloadCheats; + int iCwCheatRefreshRate; bool bDisableStencilTest; bool bAlwaysDepthWrite; bool bDepthRangeHack; diff --git a/Core/CwCheat.cpp b/Core/CwCheat.cpp index 77e8c8bf42..35f297dcfb 100644 --- a/Core/CwCheat.cpp +++ b/Core/CwCheat.cpp @@ -56,8 +56,10 @@ void __CheatInit() { __CheatStart(); } + int refresh = g_Config.iCwCheatRefreshRate; + // Only check once a second for cheats to be enabled. - CoreTiming::ScheduleEvent(msToCycles(cheatsEnabled ? 77 : 1000), CheatEvent, 0); + CoreTiming::ScheduleEvent(msToCycles(cheatsEnabled ? refresh : 1000), CheatEvent, 0); } void __CheatShutdown() { @@ -73,11 +75,13 @@ void __CheatDoState(PointerWrap &p) { p.Do(CheatEvent); CoreTiming::RestoreRegisterEvent(CheatEvent, "CheatEvent", &hleCheat); + int refresh = g_Config.iCwCheatRefreshRate; + if (s < 2) { // Before this we didn't have a checkpoint, so reset didn't work. // Let's just force one in. CoreTiming::RemoveEvent(CheatEvent); - CoreTiming::ScheduleEvent(msToCycles(cheatsEnabled ? 77 : 1000), CheatEvent, 0); + CoreTiming::ScheduleEvent(msToCycles(cheatsEnabled ? refresh : 1000), CheatEvent, 0); } } @@ -91,8 +95,10 @@ void hleCheat(u64 userdata, int cyclesLate) { } } + int refresh = g_Config.iCwCheatRefreshRate; + // Only check once a second for cheats to be enabled. - CoreTiming::ScheduleEvent(msToCycles(cheatsEnabled ? 77 : 1000), CheatEvent, 0); + CoreTiming::ScheduleEvent(msToCycles(cheatsEnabled ? refresh : 1000), CheatEvent, 0); if (!cheatEngine || !cheatsEnabled) return; diff --git a/UI/CwCheatScreen.cpp b/UI/CwCheatScreen.cpp index 5462301a2e..9b4b760f1a 100644 --- a/UI/CwCheatScreen.cpp +++ b/UI/CwCheatScreen.cpp @@ -76,6 +76,7 @@ void CwCheatScreen::CreateViews() { leftColumn->Add(new Choice(k->T("Edit Cheat File")))->OnClick.Handle(this, &CwCheatScreen::OnEditCheatFile); #endif leftColumn->Add(new Choice(k->T("Enable/Disable All")))->OnClick.Handle(this, &CwCheatScreen::OnEnableAll); + leftColumn->Add(new PopupSliderChoice(&g_Config.iCwCheatRefreshRate, 1, 1000, k->T("Refresh Rate"), 1, screenManager())); ScrollView *rightScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(0.5f)); rightScroll->SetScrollToTop(false);