diff --git a/doc/8-advanced/chip-manager.md b/doc/8-advanced/chip-manager.md index 72d8ff66a..41a187fd9 100644 --- a/doc/8-advanced/chip-manager.md +++ b/doc/8-advanced/chip-manager.md @@ -6,8 +6,12 @@ the **chip manager** window allows you to manage chips, including adding, changi **Preserve channel order**: make existing pattern data stay in place even when chips are rearranged. when turned off, pattern data will be arranged to match (the default, and usually desired behavior). +**Clone channel data**: when cloning chips, also copy patterns, pattern names, channel names and other parameters to the clone. + to move a chip around, click and drag the ![crossed-arrows](chip-manager-move.png) button to the left. +to duplicate a chip, click the **Clone** button. + to replace a chip with a different one, click the **Change** button. this will display the chip selector. to remove a chip, click the ![X](chip-manager-remove.png) button. diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 79163b402..d859c7961 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -1158,7 +1158,33 @@ bool DivEngine::duplicateSystem(int index, bool pat, bool end) { // duplicate patterns if (pat) { - + int srcChan=0; + int destChan=0; + for (int i=0; ipat[destChan+j].effectCols=i->pat[srcChan+j].effectCols; + i->chanShow[destChan+j]=i->chanShow[srcChan+j]; + i->chanShowChanOsc[destChan+j]=i->chanShowChanOsc[srcChan+j]; + i->chanCollapse[destChan+j]=i->chanCollapse[srcChan+j]; + i->chanName[destChan+j]=i->chanName[srcChan+j]; + i->chanShortName[destChan+j]=i->chanShortName[srcChan+j]; + for (int k=0; kpat[srcChan+j].data[k]!=NULL) { + i->pat[srcChan+j].data[k]->copyOn(i->pat[destChan+j].getPattern(k,true)); + } + } + + for (int k=0; korders.ord[destChan+j][k]=i->orders.ord[srcChan+j][k]; + } + } + } } saveLock.unlock(); renderSamples(); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 6403c3591..3a4717c19 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -7318,6 +7318,7 @@ FurnaceGUI::FurnaceGUI(): displayPalette(false), fullScreen(false), preserveChanPos(false), + sysDupCloneChannels(true), wantScrollList(false), noteInputPoly(true), notifyWaveChange(false), diff --git a/src/gui/gui.h b/src/gui/gui.h index c15167410..fbc9e5daf 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1503,7 +1503,7 @@ class FurnaceGUI { bool vgmExportDirectStream, displayInsTypeList, displayWaveSizeList; bool portrait, injectBackUp, mobileMenuOpen, warnColorPushed; bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu; - bool displayNew, displayExport, displayPalette, fullScreen, preserveChanPos, wantScrollList, noteInputPoly, notifyWaveChange; + bool displayNew, displayExport, displayPalette, fullScreen, preserveChanPos, sysDupCloneChannels, wantScrollList, noteInputPoly, notifyWaveChange; bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString; bool mobileEdit; bool killGraphics; diff --git a/src/gui/sysManager.cpp b/src/gui/sysManager.cpp index 17489c923..faff75a1f 100644 --- a/src/gui/sysManager.cpp +++ b/src/gui/sysManager.cpp @@ -40,6 +40,8 @@ void FurnaceGUI::drawSysManager() { } if (ImGui::Begin("Chip Manager",&sysManagerOpen,globalWinFlags)) { ImGui::Checkbox("Preserve channel order",&preserveChanPos); + ImGui::SameLine(); + ImGui::Checkbox("Clone channel data",&sysDupCloneChannels); if (ImGui::BeginTable("SystemList",3)) { ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch); @@ -84,7 +86,7 @@ void FurnaceGUI::drawSysManager() { } ImGui::TableNextColumn(); if (ImGui::Button("Clone##SysDup")) { - if (!e->duplicateSystem(i)) { + if (!e->duplicateSystem(i,sysDupCloneChannels)) { showError("cannot clone chip! ("+e->getLastError()+")"); } else { MARK_MODIFIED;