GUI: fix SNES chip config out of bounds

issue #1319
This commit is contained in:
tildearrow 2023-08-03 14:55:30 -05:00
parent a192274e29
commit cf1f741769
3 changed files with 10 additions and 4 deletions

View File

@ -4160,7 +4160,7 @@ bool FurnaceGUI::loop() {
exitDisabledTimer=1;
for (int i=0; i<e->song.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();
}
}

View File

@ -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);

View File

@ -22,7 +22,7 @@
#include "misc/cpp/imgui_stdlib.h"
#include <imgui.h>
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)) {