GUI: fix crash when using MinMod in init pres conf

This commit is contained in:
tildearrow 2024-04-13 14:09:36 -05:00
parent 809ba42ca6
commit e0c575042e

View file

@ -453,13 +453,17 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
if (sampRate>65536) sampRate=65536; if (sampRate>65536) sampRate=65536;
altered=true; altered=true;
} rightClickable } rightClickable
if (chan>=0) {
DivPlatformGBAMinMod* dispatch=(DivPlatformGBAMinMod*)e->getDispatch(chan); DivPlatformGBAMinMod* dispatch=(DivPlatformGBAMinMod*)e->getDispatch(chan);
if (dispatch!=NULL) {
float maxCPU=dispatch->maxCPU*100; float maxCPU=dispatch->maxCPU*100;
ImGui::Text("Actual sample rate: %d Hz", dispatch->chipClock); ImGui::Text("Actual sample rate: %d Hz", dispatch->chipClock);
if (maxCPU>90) ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_WARNING]); if (maxCPU>90) ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_WARNING]);
ImGui::Text("Max mixer CPU usage: %.0f%%", maxCPU); ImGui::Text("Max mixer CPU usage: %.0f%%",maxCPU);
if (maxCPU>90) ImGui::PopStyleColor(); if (maxCPU>90) ImGui::PopStyleColor();
FurnaceGUI::popWarningColor(); FurnaceGUI::popWarningColor();
}
}
if (altered) { if (altered) {
e->lockSave([&]() { e->lockSave([&]() {
flags.set("volScale",volScale); flags.set("volScale",volScale);