From cf1f741769f9ff10e66d6f52fc47de97a0146244 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 3 Aug 2023 14:55:30 -0500 Subject: [PATCH] GUI: fix SNES chip config out of bounds issue #1319 --- src/gui/gui.cpp | 2 +- src/gui/gui.h | 2 +- src/gui/sysConf.cpp | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index d37e04418..a262b9da2 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -4160,7 +4160,7 @@ bool FurnaceGUI::loop() { exitDisabledTimer=1; for (int i=0; isong.systemLen; i++) { if (ImGui::TreeNode(fmt::sprintf("%d. %s##_SYSP%d",i+1,getSystemName(e->song.system[i]),i).c_str())) { - drawSysConf(i,e->song.system[i],e->song.systemFlags[i],true); + drawSysConf(i,e->song.system[i],e->song.systemFlags[i],true,true); ImGui::TreePop(); } } diff --git a/src/gui/gui.h b/src/gui/gui.h index 308e799da..101247dc0 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2083,7 +2083,7 @@ class FurnaceGUI { void drawAlgorithm(unsigned char alg, FurnaceGUIFMAlgs algType, const ImVec2& size); void drawFMEnv(unsigned char tl, unsigned char ar, unsigned char dr, unsigned char d2r, unsigned char rr, unsigned char sl, unsigned char sus, unsigned char egt, unsigned char algOrGlobalSus, float maxTl, float maxArDr, float maxRr, const ImVec2& size, unsigned short instType); void drawGBEnv(unsigned char vol, unsigned char len, unsigned char sLen, bool dir, const ImVec2& size); - bool drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange); + bool drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange, bool fromMenu=false); void kvsConfig(DivInstrument* ins); void drawFMPreview(const ImVec2& size); void renderFMPreview(const DivInstrumentFM& params, int pos=0); diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 0a746e61f..283fad98d 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -22,7 +22,7 @@ #include "misc/cpp/imgui_stdlib.h" #include -bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange) { +bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange, bool fromMenu) { bool altered=false; bool restart=settings.restartOnFlagChange && modifyOnChange; bool supportsCustomRate=true; @@ -1564,7 +1564,13 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo } altered=true; } - if (i<7) ImGui::SameLine(); + if (i<7) { + if (fromMenu) { + ImGui::SameLine(); + } else { + sameLineMaybe(); + } + } } if (CWSliderInt("Delay##EchoDelay",&echoDelay,0,15)) {