diff --git a/src/engine/export/tiuna.cpp b/src/engine/export/tiuna.cpp index 985eba49f..397cee34f 100644 --- a/src/engine/export/tiuna.cpp +++ b/src/engine/export/tiuna.cpp @@ -183,16 +183,15 @@ static void writeCmd(std::vector& cmds, TiunaCmd& cmd, unsigned char void DivExportTiuna::run() { int loopOrder, loopOrderRow, loopEnd; - int tiaIdx; int tick=0; SafeWriter* w; std::map allCmds[2]; // config - int* sysToExport=NULL; String baseLabel=conf.getString("baseLabel","song"); int firstBankSize=conf.getInt("firstBankSize",3072); int otherBankSize=conf.getInt("otherBankSize",4096-48); + int tiaIdx=conf.getInt("sysToExport",-1); e->stop(); e->repeatPattern=false; @@ -210,23 +209,29 @@ void DivExportTiuna::run() { w=new SafeWriter; w->init(); - tiaIdx=-1; - - for (int i=0; isong.systemLen; i++) { - if (sysToExport!=NULL && !sysToExport[i]) continue; - if (e->song.system[i]==DIV_SYSTEM_TIA) { - tiaIdx=i; - e->disCont[i].dispatch->toggleRegisterDump(true); - break; + if (tiaIdx<0 || tiaIdx>=e->song.systemLen) { + tiaIdx=-1; + for (int i=0; isong.systemLen; i++) { + if (e->song.system[i]==DIV_SYSTEM_TIA) { + tiaIdx=i; + break; + } } - } - if (tiaIdx<0) { - logAppend("ERROR: selected TIA system not found"); + if (tiaIdx<0) { + logAppend("ERROR: selected TIA system not found"); + failed=true; + running=false; + return; + } + } else if (e->song.system[tiaIdx]!=DIV_SYSTEM_TIA) { + logAppend("ERROR: selected chip is not a TIA!"); failed=true; running=false; return; } + e->disCont[tiaIdx].dispatch->toggleRegisterDump(true); + // write patterns // bool writeLoop=false; logAppend("recording sequence..."); diff --git a/src/gui/exportOptions.cpp b/src/gui/exportOptions.cpp index 2ca8fa7e0..aca5523f0 100644 --- a/src/gui/exportOptions.cpp +++ b/src/gui/exportOptions.cpp @@ -281,6 +281,7 @@ void FurnaceGUI::drawExportROM(bool onWindow) { String asmBaseLabel=romConfig.getString("baseLabel","song"); int firstBankSize=romConfig.getInt("firstBankSize",3072); int otherBankSize=romConfig.getInt("otherBankSize",4096-48); + int sysToExport=romConfig.getInt("sysToExport",-1); // TODO; validate label if (ImGui::InputText(_("base song label name"),&asmBaseLabel)) { @@ -297,30 +298,22 @@ void FurnaceGUI::drawExportROM(bool onWindow) { altered=true; } - ImGui::Text(_("chips to export:")); - int selected=0; + ImGui::Text(_("chip to export:")); for (int i=0; isong.systemLen; i++) { DivSystem sys=e->song.system[i]; - bool isTIA=sys==DIV_SYSTEM_TIA; - ImGui::BeginDisabled((!isTIA) || (selected>=1)); - if (ImGui::Checkbox(fmt::sprintf("%d. %s##_SYSV%d",i+1,getSystemName(e->song.system[i]),i).c_str(),&willExport[i])) { + bool isTIA=(sys==DIV_SYSTEM_TIA); + ImGui::BeginDisabled(!isTIA); + if (ImGui::RadioButton(fmt::sprintf("%d. %s##_SYSV%d",i+1,getSystemName(e->song.system[i]),i).c_str(),sysToExport==i)) { + sysToExport=i; altered=true; } ImGui::EndDisabled(); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { - if (!isTIA) { - ImGui::SetTooltip(_("this chip is not supported by the file format!")); - } else if (selected>=1) { - ImGui::SetTooltip(_("only one Atari TIA is supported!")); - } - } - if (isTIA && willExport[i]) selected++; - - if (altered) { - romConfig.set("baseLabel",asmBaseLabel); - romConfig.set("firstBankSize",firstBankSize); - romConfig.set("otherBankSize",otherBankSize); - } + } + if (altered) { + romConfig.set("baseLabel",asmBaseLabel); + romConfig.set("firstBankSize",firstBankSize); + romConfig.set("otherBankSize",otherBankSize); + romConfig.set("sysToExport",sysToExport); } break; }