From 55ba014fedfa80301d15d4c742a9bfbae5e86cc1 Mon Sep 17 00:00:00 2001 From: dreamsyntax Date: Tue, 18 Jun 2024 18:36:04 -0700 Subject: [PATCH] DolphinQt: Adjust CPU Clock Override slider CPU Clock Override slider now increments 1% in the UI, with the new lower limit being 1% instead of 6%. Prior implementation made it impossible to set exactly 150% in the GUI. 147% -> 152%. Now users can set exact clock % without needing to edit INIs. --- Source/Core/DolphinQt/Settings/AdvancedPane.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/Core/DolphinQt/Settings/AdvancedPane.cpp b/Source/Core/DolphinQt/Settings/AdvancedPane.cpp index 9aaef7be2d..cfcc3bba81 100644 --- a/Source/Core/DolphinQt/Settings/AdvancedPane.cpp +++ b/Source/Core/DolphinQt/Settings/AdvancedPane.cpp @@ -100,7 +100,7 @@ void AdvancedPane::CreateLayout() clock_override_layout->addLayout(cpu_clock_override_slider_layout); m_cpu_clock_override_slider = new QSlider(Qt::Horizontal); - m_cpu_clock_override_slider->setRange(0, 150); + m_cpu_clock_override_slider->setRange(1, 400); cpu_clock_override_slider_layout->addWidget(m_cpu_clock_override_slider); m_cpu_clock_override_slider_label = new QLabel(); @@ -203,8 +203,7 @@ void AdvancedPane::ConnectLayout() }); connect(m_cpu_clock_override_slider, &QSlider::valueChanged, [this](int oc_factor) { - // Vaguely exponential scaling? - const float factor = std::exp2f((m_cpu_clock_override_slider->value() - 100.f) / 25.f); + const float factor = m_cpu_clock_override_slider->value() / 100.f; Config::SetBaseOrCurrent(Config::MAIN_OVERCLOCK, factor); Update(); }); @@ -271,8 +270,8 @@ void AdvancedPane::Update() { const QSignalBlocker blocker(m_cpu_clock_override_slider); - m_cpu_clock_override_slider->setValue(static_cast( - std::round(std::log2f(Config::Get(Config::MAIN_OVERCLOCK)) * 25.f + 100.f))); + m_cpu_clock_override_slider->setValue( + static_cast(std::round(Config::Get(Config::MAIN_OVERCLOCK) * 100.f))); } m_cpu_clock_override_slider_label->setText([] {