GUI: make memory usage unit setting effective

This commit is contained in:
tildearrow 2024-03-28 13:50:15 -05:00
parent b88a37d671
commit 065db6b7bd
3 changed files with 19 additions and 8 deletions

View file

@ -479,9 +479,9 @@ below all the binds, select a key from the dropdown list to add it. it will appe
- **Use separate colors for carriers/modulators in FM editor**
- **Unsigned FM detune values**: uses the internal representation of detune values, such that detune amounts of -1, -2, and -3 are shown as 5, 6, and 7.
### Statistics
### Memory Composition
- **Chip memory usage unit:** unit for displaying memory usage in the Statistics window.
- **Chip memory usage unit:** unit for displaying memory usage in the Memory Composition window.
- **Bytes**
- **Kilobytes**

View file

@ -47,7 +47,11 @@ void FurnaceGUI::drawMemory() {
ImGui::Text("%s: %s",e->getSystemName(e->song.system[i]),mc->name.c_str());
ImGui::SameLine();
ImGui::Text("%d/%d (%.1f%%)",(int)mc->used,(int)mc->capacity,100.0*(double)mc->used/(double)mc->capacity);
if (mc->capacity>=1024 && settings.memUsageUnit==1) {
ImGui::Text("%dK/%dK (%.1f%%)",(int)mc->used>>10,(int)mc->capacity>>10,100.0*(double)mc->used/(double)mc->capacity);
} else {
ImGui::Text("%d/%d (%.1f%%)",(int)mc->used,(int)mc->capacity,100.0*(double)mc->used/(double)mc->capacity);
}
ImVec2 size=ImVec2(ImGui::GetContentRegionAvail().x,36.0f*dpiScale);
ImVec2 minArea=window->DC.CursorPos;
@ -141,13 +145,20 @@ void FurnaceGUI::drawMemory() {
if ((int)entry.type>=(int)DIV_MEMORY_BANK0) {
ImGui::Text("bank %d",(int)entry.type-(int)DIV_MEMORY_BANK0);
}
ImGui::Text("%d-%d ($%x-$%x): %d bytes ($%x)",(int)entry.begin,(int)entry.end-1,(int)entry.begin,(int)entry.end-1,(int)(entry.end-entry.begin),(int)(entry.end-entry.begin));
ImGui::Text("click to open sample editor");
if ((entry.end-entry.begin)>=1024 && settings.memUsageUnit==1) {
ImGui::Text("%d-%d ($%x-$%x): %dK ($%x)",(int)entry.begin,(int)entry.end-1,(int)entry.begin,(int)entry.end-1,(int)(entry.end-entry.begin)>>10,(int)(entry.end-entry.begin));
} else {
ImGui::Text("%d-%d ($%x-$%x): %d bytes ($%x)",(int)entry.begin,(int)entry.end-1,(int)entry.begin,(int)entry.end-1,(int)(entry.end-entry.begin),(int)(entry.end-entry.begin));
}
break;
}
default:
ImGui::Text("%d: %s",curHover,entry.name.c_str());
ImGui::Text("%d-%d ($%x-$%x): %d bytes ($%x)",(int)entry.begin,(int)entry.end-1,(int)entry.begin,(int)entry.end-1,(int)(entry.end-entry.begin),(int)(entry.end-entry.begin));
if ((entry.end-entry.begin)>=1024 && settings.memUsageUnit==1) {
ImGui::Text("%d-%d ($%x-$%x): %dK ($%x)",(int)entry.begin,(int)entry.end-1,(int)entry.begin,(int)entry.end-1,(int)(entry.end-entry.begin)>>10,(int)(entry.end-entry.begin));
} else {
ImGui::Text("%d-%d ($%x-$%x): %d bytes ($%x)",(int)entry.begin,(int)entry.end-1,(int)entry.begin,(int)entry.end-1,(int)(entry.end-entry.begin),(int)(entry.end-entry.begin));
}
break;
}

View file

@ -3179,8 +3179,8 @@ void FurnaceGUI::drawSettings() {
settingsChanged=true;
}
// SUBSECTION STATISTICS
CONFIG_SUBSECTION("Statistics");
// SUBSECTION MEMORY COMPOSITION
CONFIG_SUBSECTION("Memory Composition");
ImGui::Text("Chip memory usage unit:");
ImGui::Indent();
if (ImGui::RadioButton("Bytes##MUU0",settings.memUsageUnit==0)) {