fix crash when changing chip
it was somehow possible to exceed the channel limit...
This commit is contained in:
parent
9dbb1f7371
commit
f0bf58eef2
4 changed files with 99 additions and 12 deletions
|
|
@ -4284,12 +4284,15 @@ bool FurnaceGUI::loop() {
|
|||
if (ImGui::BeginMenu(fmt::sprintf("%d. %s##_SYSC%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {
|
||||
DivSystem picked=systemPicker();
|
||||
if (picked!=DIV_SYSTEM_NULL) {
|
||||
e->changeSystem(i,picked,preserveChanPos);
|
||||
MARK_MODIFIED;
|
||||
if (e->song.autoSystem) {
|
||||
autoDetectSystem();
|
||||
if (e->changeSystem(i,picked,preserveChanPos)) {
|
||||
MARK_MODIFIED;
|
||||
if (e->song.autoSystem) {
|
||||
autoDetectSystem();
|
||||
}
|
||||
updateWindowTitle();
|
||||
} else {
|
||||
showError("cannot change chip! ("+e->getLastError()+")");
|
||||
}
|
||||
updateWindowTitle();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
|
|
|
|||
|
|
@ -83,16 +83,27 @@ void FurnaceGUI::drawSysManager() {
|
|||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::Button("Clone##SysDup")) {
|
||||
if (!e->duplicateSystem(i)) {
|
||||
showError("cannot clone chip! ("+e->getLastError()+")");
|
||||
} else {
|
||||
MARK_MODIFIED;
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Button("Change##SysChange");
|
||||
if (ImGui::BeginPopupContextItem("SysPickerC",ImGuiPopupFlags_MouseButtonLeft)) {
|
||||
DivSystem picked=systemPicker();
|
||||
if (picked!=DIV_SYSTEM_NULL) {
|
||||
e->changeSystem(i,picked,preserveChanPos);
|
||||
MARK_MODIFIED;
|
||||
if (e->song.autoSystem) {
|
||||
autoDetectSystem();
|
||||
if (e->changeSystem(i,picked,preserveChanPos)) {
|
||||
MARK_MODIFIED;
|
||||
if (e->song.autoSystem) {
|
||||
autoDetectSystem();
|
||||
}
|
||||
updateWindowTitle();
|
||||
} else {
|
||||
showError("cannot change chip! ("+e->getLastError()+")");
|
||||
}
|
||||
updateWindowTitle();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue