GUI: add setting to see mem usage in bytes

This commit is contained in:
tildearrow 2023-06-30 22:44:08 -05:00
parent a69b02f525
commit e5a5bb0154
3 changed files with 21 additions and 1 deletions

View file

@ -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(""),

View file

@ -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; i<GUI_COLOR_MAX; i++) {

View file

@ -41,7 +41,12 @@ void FurnaceGUI::drawStats() {
for (int j=0; dispatch!=NULL && dispatch->getSampleMemCapacity(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());