From ceffa2a8219196fa30711348db1a064b93ca7bfe Mon Sep 17 00:00:00 2001 From: Gamer64ytb <76565986+Gamer64ytb@users.noreply.github.com> Date: Fri, 26 Jul 2024 00:31:38 +0200 Subject: [PATCH] Implement Custom CPU Ticks to the code --- src/common/settings.h | 4 ++++ src/core/core_timing.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/settings.h b/src/common/settings.h index 1fe7ef8710..f3d92802bf 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -522,6 +522,10 @@ struct Values { SwitchableSetting preload_textures{false, "preload_textures"}; SwitchableSetting async_custom_loading{true, "async_custom_loading"}; + // Tweaks + SwitchableSetting enable_custom_cpu_ticks{false, "enable_custom_cpu_ticks"}; + SwitchableSetting custom_cpu_ticks{16000, 77, 65535, "custom_cpu_ticks"}; + // Audio bool audio_muted; SwitchableSetting audio_emulation{AudioEmulation::HLE, "audio_emulation"}; diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 0d25069183..57881018d4 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -176,7 +176,10 @@ u64 Timing::Timer::GetTicks() const { } void Timing::Timer::AddTicks(u64 ticks) { - downcount -= static_cast(ticks * cpu_clock_scale); + downcount -= static_cast((Settings::values.enable_custom_cpu_ticks + ? Settings::values.custom_cpu_ticks.GetValue() + : ticks) * + cpu_clock_scale); } u64 Timing::Timer::GetIdleTicks() const {