From e5a5bb01548cffa148403ef475a95f1334a77a7a Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 30 Jun 2023 22:44:08 -0500 Subject: [PATCH] GUI: add setting to see mem usage in bytes --- src/gui/gui.h | 2 ++ src/gui/settings.cpp | 13 +++++++++++++ src/gui/stats.cpp | 7 ++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 8bce5fa4e..8a3aab68b 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1509,6 +1509,7 @@ class FurnaceGUI { int insertBehavior; int pullDeleteRow; int newSongBehavior; + int memUsageUnit; unsigned int maxUndoSteps; String mainFontPath; String patFontPath; @@ -1661,6 +1662,7 @@ class FurnaceGUI { insertBehavior(1), pullDeleteRow(1), newSongBehavior(0), + memUsageUnit(1), maxUndoSteps(100), mainFontPath(""), patFontPath(""), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 3da603169..882bc8075 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -1602,6 +1602,16 @@ void FurnaceGUI::drawSettings() { ImGui::Separator(); + ImGui::Text("Chip memory usage unit:"); + if (ImGui::RadioButton("Bytes##MUU0",settings.memUsageUnit==0)) { + settings.memUsageUnit=0; + } + if (ImGui::RadioButton("Kilobytes##MUU1",settings.memUsageUnit==1)) { + settings.memUsageUnit=1; + } + + ImGui::Separator(); + ImGui::Text("Namco 163 chip name"); ImGui::SameLine(); ImGui::InputTextWithHint("##C163Name",DIV_C163_DEFAULT_NAME,&settings.c163Name); @@ -2766,6 +2776,7 @@ void FurnaceGUI::syncSettings() { settings.insertBehavior=e->getConfInt("insertBehavior",1); settings.pullDeleteRow=e->getConfInt("pullDeleteRow",1); settings.newSongBehavior=e->getConfInt("newSongBehavior",0); + settings.memUsageUnit=e->getConfInt("memUsageUnit",1); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.patFontSize,2,96); @@ -2892,6 +2903,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.insertBehavior,0,1); clampSetting(settings.pullDeleteRow,0,1); clampSetting(settings.newSongBehavior,0,1); + clampSetting(settings.memUsageUnit,0,1); if (settings.exportLoops<0.0) settings.exportLoops=0.0; if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; @@ -3114,6 +3126,7 @@ void FurnaceGUI::commitSettings() { e->setConf("insertBehavior",settings.insertBehavior); e->setConf("pullDeleteRow",settings.pullDeleteRow); e->setConf("newSongBehavior",settings.newSongBehavior); + e->setConf("memUsageUnit",settings.memUsageUnit); // colors for (int i=0; igetSampleMemCapacity(j)>0; j++) { size_t capacity=dispatch->getSampleMemCapacity(j); size_t usage=dispatch->getSampleMemUsage(j); - String usageStr=fmt::sprintf("%d/%dKB",usage/1024,capacity/1024); + String usageStr; + if (settings.memUsageUnit==1) { + usageStr=fmt::sprintf("%d/%dKB",usage/1024,capacity/1024); + } else { + usageStr=fmt::sprintf("%d/%d",usage,capacity); + } ImGui::Text("%s [%d]", e->getSystemName(e->song.system[i]), j); ImGui::SameLine(); ImGui::ProgressBar(((float)usage)/((float)capacity),ImVec2(-FLT_MIN,0),usageStr.c_str());