From ac79e7d6af862b511623f8640d08f51eaa80d1c6 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 23 Mar 2022 01:35:57 -0500 Subject: [PATCH] add broken speed alternation flag - dev70 --- papers/format.md | 4 ++++ src/engine/engine.h | 4 ++-- src/engine/fileOps.cpp | 15 +++++++++++++++ src/engine/playback.cpp | 22 ++++++++++++++++------ src/engine/song.h | 4 +++- src/gui/compatFlags.cpp | 4 ++++ 6 files changed, 44 insertions(+), 9 deletions(-) diff --git a/papers/format.md b/papers/format.md index 51dc8dd93..af2c4a5c3 100644 --- a/papers/format.md +++ b/papers/format.md @@ -29,6 +29,7 @@ furthermore, an `or reserved` indicates this field is always present, but is res the format versions are: +- 70: Furnace dev70 - 69: Furnace dev69 - 68: Furnace dev68 - 67: Furnace dev67 @@ -235,6 +236,9 @@ size | description STR | song comment 4f | master volume, 1.0f=100% (>=59) | this is 2.0f for modules before 59 + --- | **extended compatibility flags** (>=70) + 1 | broken speed selection + 31 | reserved ``` # instrument diff --git a/src/engine/engine.h b/src/engine/engine.h index 9f7464e37..911a33c7c 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -38,8 +38,8 @@ warnings+=(String("\n")+x); \ } -#define DIV_VERSION "dev69" -#define DIV_ENGINE_VERSION 69 +#define DIV_VERSION "dev70" +#define DIV_ENGINE_VERSION 70 // for imports #define DIV_VERSION_MOD 0xff01 diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index b50eb74ae..f267e2c23 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -144,6 +144,7 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) { ds.oneTickCut=false; ds.newInsTriggersInPorta=true; ds.arp0Reset=true; + ds.brokenSpeedSel=true; // 1.1 compat flags if (ds.version>24) { @@ -1067,6 +1068,14 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { ds.masterVol=2.0f; } + if (ds.version>=70) { + // extended compat flags + ds.brokenSpeedSel=reader.readC(); + for (int i=0; i<31; i++) { + reader.readC(); + } + } + // read instruments for (int i=0; iwriteF(song.masterVol); + // extended compat flags + w->writeC(song.brokenSpeedSel); + for (int i=0; i<31; i++) { + w->writeC(0); + } + /// INSTRUMENT for (int i=0; i ins; @@ -373,7 +374,8 @@ struct DivSong { brokenDACMode(false), oneTickCut(false), newInsTriggersInPorta(true), - arp0Reset(true) { + arp0Reset(true), + brokenSpeedSel(false) { for (int i=0; i<32; i++) { system[i]=DIV_SYSTEM_NULL; systemVol[i]=64; diff --git a/src/gui/compatFlags.cpp b/src/gui/compatFlags.cpp index 46424fc52..b49c251f8 100644 --- a/src/gui/compatFlags.cpp +++ b/src/gui/compatFlags.cpp @@ -81,6 +81,10 @@ void FurnaceGUI::drawCompatFlags() { if (ImGui::IsItemHovered()) { ImGui::SetTooltip("when enabled, a one-tick note cut will be inserted between non-legato/non-portamento notes.\nthis simulates the behavior of some Amiga/SNES music engines."); } + ImGui::Checkbox("Broken speed alternation",&e->song.brokenSpeedSel); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("determines next speed based on whether the row is odd/even instead of alternating between speeds."); + } ImGui::Text("Loop modality:"); if (ImGui::RadioButton("Reset channels",e->song.loopModality==0)) {