mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 04:55:13 +00:00
...
This commit is contained in:
parent
aae9aad4f6
commit
ecd3875a64
5 changed files with 48 additions and 20 deletions
|
@ -1190,6 +1190,25 @@ bool DivEngine::duplicateSystem(int index, bool pat, bool end) {
|
|||
renderSamples();
|
||||
reset();
|
||||
BUSY_END;
|
||||
|
||||
if (!end) {
|
||||
quitDispatch();
|
||||
BUSY_BEGIN;
|
||||
saveLock.lock();
|
||||
|
||||
for (int i=song.systemLen-1; i>index; i--) {
|
||||
swapSystemUnsafe(i,i-1,false);
|
||||
}
|
||||
|
||||
recalcChans();
|
||||
saveLock.unlock();
|
||||
BUSY_END;
|
||||
initDispatch();
|
||||
BUSY_BEGIN;
|
||||
renderSamples();
|
||||
reset();
|
||||
BUSY_END;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1247,24 +1266,7 @@ bool DivEngine::removeSystem(int index, bool preserveOrder) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DivEngine::swapSystem(int src, int dest, bool preserveOrder) {
|
||||
if (src==dest) {
|
||||
lastError="source and destination are equal";
|
||||
return false;
|
||||
}
|
||||
if (src<0 || src>=song.systemLen) {
|
||||
lastError="invalid source index";
|
||||
return false;
|
||||
}
|
||||
if (dest<0 || dest>=song.systemLen) {
|
||||
lastError="invalid destination index";
|
||||
return false;
|
||||
}
|
||||
//int chanCount=chans;
|
||||
quitDispatch();
|
||||
BUSY_BEGIN;
|
||||
saveLock.lock();
|
||||
|
||||
void DivEngine::swapSystemUnsafe(int src, int dest, bool preserveOrder) {
|
||||
if (!preserveOrder) {
|
||||
// move channels
|
||||
unsigned char unswappedChannels[DIV_MAX_CHANS];
|
||||
|
@ -1380,6 +1382,27 @@ bool DivEngine::swapSystem(int src, int dest, bool preserveOrder) {
|
|||
i=(i&(~0xfff00000))|((unsigned int)src<<20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DivEngine::swapSystem(int src, int dest, bool preserveOrder) {
|
||||
if (src==dest) {
|
||||
lastError="source and destination are equal";
|
||||
return false;
|
||||
}
|
||||
if (src<0 || src>=song.systemLen) {
|
||||
lastError="invalid source index";
|
||||
return false;
|
||||
}
|
||||
if (dest<0 || dest>=song.systemLen) {
|
||||
lastError="invalid destination index";
|
||||
return false;
|
||||
}
|
||||
//int chanCount=chans;
|
||||
quitDispatch();
|
||||
BUSY_BEGIN;
|
||||
saveLock.lock();
|
||||
|
||||
swapSystemUnsafe(src,dest,preserveOrder);
|
||||
|
||||
recalcChans();
|
||||
saveLock.unlock();
|
||||
|
|
|
@ -584,6 +584,8 @@ class DivEngine {
|
|||
// change song (UNSAFE)
|
||||
void changeSong(size_t songIndex);
|
||||
|
||||
void swapSystemUnsafe(int src, int dest, bool preserveOrder=true);
|
||||
|
||||
// move an asset
|
||||
void moveAsset(std::vector<DivAssetDir>& dir, int before, int after);
|
||||
|
||||
|
|
|
@ -7319,6 +7319,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
fullScreen(false),
|
||||
preserveChanPos(false),
|
||||
sysDupCloneChannels(true),
|
||||
sysDupEnd(false),
|
||||
wantScrollList(false),
|
||||
noteInputPoly(true),
|
||||
notifyWaveChange(false),
|
||||
|
|
|
@ -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, sysDupCloneChannels, wantScrollList, noteInputPoly, notifyWaveChange;
|
||||
bool displayNew, displayExport, displayPalette, fullScreen, preserveChanPos, sysDupCloneChannels, sysDupEnd, wantScrollList, noteInputPoly, notifyWaveChange;
|
||||
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString;
|
||||
bool mobileEdit;
|
||||
bool killGraphics;
|
||||
|
|
|
@ -42,6 +42,8 @@ void FurnaceGUI::drawSysManager() {
|
|||
ImGui::Checkbox("Preserve channel order",&preserveChanPos);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Clone channel data",&sysDupCloneChannels);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Clone at end",&sysDupEnd);
|
||||
if (ImGui::BeginTable("SystemList",3)) {
|
||||
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch);
|
||||
|
@ -86,7 +88,7 @@ void FurnaceGUI::drawSysManager() {
|
|||
}
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::Button("Clone##SysDup")) {
|
||||
if (!e->duplicateSystem(i,sysDupCloneChannels)) {
|
||||
if (!e->duplicateSystem(i,sysDupCloneChannels,sysDupEnd)) {
|
||||
showError("cannot clone chip! ("+e->getLastError()+")");
|
||||
} else {
|
||||
MARK_MODIFIED;
|
||||
|
|
Loading…
Reference in a new issue