From 83af776c60d61a4be897051118d3c6153638f8e2 Mon Sep 17 00:00:00 2001 From: spidy123222 Date: Wed, 23 Aug 2023 04:57:05 +0000 Subject: [PATCH] Fix Nit's --- config_spec.yml | 2 +- hw/i386/x86.c | 3 +-- ui/xui/main-menu.cc | 8 ++++---- ui/xui/widgets.cc | 3 ++- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config_spec.yml b/config_spec.yml index 5db1a23f3ea..b8090035d18 100644 --- a/config_spec.yml +++ b/config_spec.yml @@ -256,6 +256,6 @@ perf: override_clockspeed: type: bool default: false - cpu_clockspeed: + cpu_clockspeed_scale: type: number default: 1 diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 88cdd6f0785..6c5e27dc02a 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -536,11 +536,10 @@ static long get_file_size(FILE *f) uint64_t cpu_get_tsc(CPUX86State *env) { #ifdef XBOX - float clock_multiplier = g_config.perf.cpu_clockspeed; int cpu_clock_hz = 733333333; if (g_config.perf.override_clockspeed) { - cpu_clock_hz *= clock_multiplier; + cpu_clock_hz *= g_config.perf.cpu_clockspeed_scale; } return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), cpu_clock_hz, NANOSECONDS_PER_SECOND); #else diff --git a/ui/xui/main-menu.cc b/ui/xui/main-menu.cc index 1bf016fbfc3..5c6f9dde42b 100644 --- a/ui/xui/main-menu.cc +++ b/ui/xui/main-menu.cc @@ -70,11 +70,11 @@ void MainMenuGeneralView::Draw() "Enables to override default CPU clock speed"); char buf[32]; - snprintf(buf, sizeof(buf), "Clock Speed %d%% (%.2f MHz)", (int)(g_config.perf.cpu_clockspeed * 100), (733333333 * g_config.perf.cpu_clockspeed)/1000000); - Slider("Virtual CPU clock", &g_config.perf.cpu_clockspeed, buf, 0.01f, 2.f, 0.01f); + snprintf(buf, sizeof(buf), "Clock Speed %d%% (%.2f MHz)", (int)(g_config.perf.cpu_clockspeed_scale * 100), (733333333 * g_config.perf.cpu_clockspeed_scale) / 1000000); + Slider("Virtual CPU clock", &g_config.perf.cpu_clockspeed_scale, buf, 0.01f, 2.f, 0.01f); - if (fabs(g_config.perf.cpu_clockspeed - 1.f) <= 0.0099f) { - g_config.perf.cpu_clockspeed = 1; + if (fabs(g_config.perf.cpu_clockspeed_scale - 1.f) <= 0.0099f) { + g_config.perf.cpu_clockspeed_scale = 1; } SectionTitle("Miscellaneous"); diff --git a/ui/xui/widgets.cc b/ui/xui/widgets.cc index d8e930bca8a..3809a4a227f 100644 --- a/ui/xui/widgets.cc +++ b/ui/xui/widgets.cc @@ -223,7 +223,8 @@ bool Toggle(const char *str_id, bool *v, const char *description) return status; } -void Slider(const char *str_id, float *v, const char *description, float min, float max, float increment) { +void Slider(const char *str_id, float *v, const char *description, float min, float max, float increment) +{ float x = (*v - min) / (max - min); ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32_BLACK_TRANS);