diff --git a/papers/format.md b/papers/format.md index 5aef984ee..389b6e61e 100644 --- a/papers/format.md +++ b/papers/format.md @@ -32,6 +32,7 @@ these fields are 0 in format versions prior to 100 (0.6pre1). the format versions are: +- 138: Furnace dev138 - 137: Furnace dev137 - 136: Furnace dev136 - 135: Furnace dev135 @@ -399,6 +400,9 @@ size | description 4?? | patchbay | - see next section for more details. 1 | automatic patchbay (>=136) + --- | **a couple more compat flags** (>=138) + 1 | broken portamento during legato + 7 | reserved ``` # patchbay diff --git a/src/engine/engine.h b/src/engine/engine.h index 88e6e6764..75b0ad94c 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -47,8 +47,8 @@ #define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock(); #define BUSY_END isBusy.unlock(); softLocked=false; -#define DIV_VERSION "dev137" -#define DIV_ENGINE_VERSION 137 +#define DIV_VERSION "dev138" +#define DIV_ENGINE_VERSION 138 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index 2365da594..c049545aa 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -1716,6 +1716,9 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { if (ds.version<130) { ds.oldArpStrategy=true; } + if (ds.version<138) { + ds.brokenPortaLegato=true; + } ds.isDMF=false; reader.readS(); // reserved @@ -2221,6 +2224,13 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { if (ds.version>=136) song.patchbayAuto=reader.readC(); + if (ds.version>=138) { + ds.brokenPortaArp=reader.readC(); + for (int i=0; i<7; i++) { + reader.readC(); + } + } + // read system flags if (ds.version>=119) { logD("reading chip flags..."); @@ -4515,6 +4525,12 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) { } w->writeC(song.patchbayAuto); + // even more compat flags + w->writeC(song.brokenPortaLegato); + for (int i=0; i<7; i++) { + w->writeC(0); + } + blockEndSeek=w->tell(); w->seek(blockStartSeek,SEEK_SET); w->writeI(blockEndSeek-blockStartSeek-4); diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 33f2d66c7..88a115a33 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -896,7 +896,7 @@ void DivEngine::processRow(int i, bool afterDelay) { chan[i].vibratoPos=0; } dispatchCmd(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15))); - if (chan[i].legato) { + if (chan[i].legato && (!chan[i].inPorta || song.brokenPortaLegato)) { dispatchCmd(DivCommand(DIV_CMD_LEGATO,i,chan[i].note)); dispatchCmd(DivCommand(DIV_CMD_HINT_LEGATO,i,chan[i].note)); } else { diff --git a/src/engine/song.h b/src/engine/song.h index dfe579bbb..61083c185 100644 --- a/src/engine/song.h +++ b/src/engine/song.h @@ -330,6 +330,7 @@ struct DivSong { bool autoSystem; bool oldArpStrategy; bool patchbayAuto; + bool brokenPortaLegato; std::vector ins; std::vector wave; @@ -439,7 +440,8 @@ struct DivSong { disableSampleMacro(false), autoSystem(true), oldArpStrategy(false), - patchbayAuto(true) { + patchbayAuto(true), + brokenPortaLegato(false) { for (int i=0; isong.brokenPortaLegato); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("behavior changed in 0.6pre4"); + } } if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_COMPAT_FLAGS; ImGui::End();