From 01db0f7e542ee560bd1c27a0e8db0d915d76d689 Mon Sep 17 00:00:00 2001 From: Natt Akuma Date: Mon, 18 Mar 2024 12:22:38 +0700 Subject: [PATCH] MinMod: Fix CPU usage warning --- src/engine/platform/gbaminmod.cpp | 4 ++-- src/gui/sysConf.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/engine/platform/gbaminmod.cpp b/src/engine/platform/gbaminmod.cpp index a1ad0efe0..3e573811d 100644 --- a/src/engine/platform/gbaminmod.cpp +++ b/src/engine/platform/gbaminmod.cpp @@ -219,10 +219,10 @@ void DivPlatformGBAMinMod::acquire(short** buf, size_t len) { void DivPlatformGBAMinMod::tick(bool sysTick) { // collect stats for display in chip config // logV("rendered=%d,updTot=%d",sampsRendered,updCyclesTotal); - if (sysTick && sampsRendered>0) { + if (sysTick && updCyclesTotal>0) { // assuming new sample, L!=R and lowest ROM access wait in all channels // this gives 39.5 cycles/sample, rounded up to 40 for loops - maxCPU=(float)sampsRendered*chanMax*40/updCyclesTotal; + maxCPU=(float)sampsRendered*chanMax*40/(float)updCyclesTotal; } sampsRendered=0; updCyclesTotal=0; diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index b62fe7f2a..b1c996113 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -448,8 +448,9 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl DivPlatformGBAMinMod* dispatch=(DivPlatformGBAMinMod*)e->getDispatch(chan); float maxCPU=dispatch->maxCPU*100; ImGui::Text("Actual sample rate: %d Hz", dispatch->chipClock); - FurnaceGUI::pushWarningColor(maxCPU>90); + if (maxCPU>90) ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_WARNING]); ImGui::Text("Max mixer CPU usage: %.0f%%", maxCPU); + if (maxCPU>90) ImGui::PopStyleColor(); FurnaceGUI::popWarningColor(); if (altered) { e->lockSave([&]() {