From 75d75f68e6de77cdc8a54beb24598e4d6e9b88a5 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 8 Oct 2022 00:53:01 -0500 Subject: [PATCH] dev121 - NES/SN: Defle compat fixes FOR REAL THIS IS MOST LIKELY THE LAST DEFLE COMPAT FLAG I ADD ...besides future "no arp+porta in linear pitch" compat flag --- papers/format.md | 5 ++++- src/engine/fileOps.cpp | 16 +++++++++++++--- src/engine/platform/nes.cpp | 2 ++ src/engine/platform/sms.cpp | 2 +- src/engine/song.h | 2 ++ src/gui/compatFlags.cpp | 4 ++++ 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/papers/format.md b/papers/format.md index 2649cd298..6e4954e87 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: +- 121: Furnace dev121 - 120: Furnace dev120 - 119: Furnace dev119 - 118: Furnace dev118 @@ -351,7 +352,9 @@ size | description 1 | 0B/0D effect treatment (>=113) or reserved 1 | automatic system name detection (>=115) or reserved | - this one isn't a compatibility flag, but it's here for convenience... - 3 | reserved + 1 | disable sample macro (>=117) or reserved + 1 | broken outVol episode 2 (>=121) or reserved + 1 | reserved --- | **virtual tempo data** 2 | virtual tempo numerator of first song (>=96) or reserved 2 | virtual tempo denominator of first song (>=96) or reserved diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index c2888e34e..41ec55e62 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -174,7 +174,8 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) { ds.noOPN2Vol=true; ds.newVolumeScaling=false; ds.volMacroLinger=false; - ds.brokenOutVol=true; // ??? + ds.brokenOutVol=true; + ds.brokenOutVol2=true; ds.e1e2StopOnSameNote=true; ds.brokenPortaArp=false; ds.snNoLowPeriods=true; @@ -1689,6 +1690,9 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { if (ds.version<117) { ds.disableSampleMacro=true; } + if (ds.version<121) { + ds.brokenOutVol2=false; + } ds.isDMF=false; reader.readS(); // reserved @@ -2126,7 +2130,12 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { } else { reader.readC(); } - for (int i=0; i<2; i++) { + if (ds.version>=121) { + ds.brokenOutVol2=reader.readC(); + } else { + reader.readC(); + } + for (int i=0; i<1; i++) { reader.readC(); } } @@ -4464,7 +4473,8 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) { w->writeC(song.jumpTreatment); w->writeC(song.autoSystem); w->writeC(song.disableSampleMacro); - for (int i=0; i<2; i++) { + w->writeC(song.brokenOutVol2); + for (int i=0; i<1; i++) { w->writeC(0); } diff --git a/src/engine/platform/nes.cpp b/src/engine/platform/nes.cpp index 1ca95245d..a338cca8c 100644 --- a/src/engine/platform/nes.cpp +++ b/src/engine/platform/nes.cpp @@ -415,6 +415,8 @@ int DivPlatformNES::dispatch(DivCommand c) { chan[c.chan].macroInit(parent->getIns(chan[c.chan].ins,DIV_INS_STD)); if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) { chan[c.chan].outVol=chan[c.chan].vol; + } + if (!parent->song.brokenOutVol2) { if (c.chan==2) { rWrite(0x4000+c.chan*4,0xff); } else { diff --git a/src/engine/platform/sms.cpp b/src/engine/platform/sms.cpp index 5e484c5d4..83ce707f6 100644 --- a/src/engine/platform/sms.cpp +++ b/src/engine/platform/sms.cpp @@ -249,7 +249,7 @@ int DivPlatformSMS::dispatch(DivCommand c) { chan[c.chan].actualNote=c.value; } chan[c.chan].active=true; - if (!parent->song.brokenOutVol) { + if (!parent->song.brokenOutVol2) { rWrite(0,0x90|c.chan<<5|(isMuted[c.chan]?15:(15-(chan[c.chan].vol&15)))); } chan[c.chan].macroInit(parent->getIns(chan[c.chan].ins,DIV_INS_STD)); diff --git a/src/engine/song.h b/src/engine/song.h index ba66337bc..f87160aa9 100644 --- a/src/engine/song.h +++ b/src/engine/song.h @@ -314,6 +314,7 @@ struct DivSong { bool newVolumeScaling; bool volMacroLinger; bool brokenOutVol; + bool brokenOutVol2; bool e1e2StopOnSameNote; bool brokenPortaArp; bool snNoLowPeriods; @@ -420,6 +421,7 @@ struct DivSong { newVolumeScaling(true), volMacroLinger(true), brokenOutVol(false), + brokenOutVol2(false), e1e2StopOnSameNote(false), brokenPortaArp(false), snNoLowPeriods(false), diff --git a/src/gui/compatFlags.cpp b/src/gui/compatFlags.cpp index fcea0fa06..e3ad642c7 100644 --- a/src/gui/compatFlags.cpp +++ b/src/gui/compatFlags.cpp @@ -139,6 +139,10 @@ void FurnaceGUI::drawCompatFlags() { if (ImGui::IsItemHovered()) { ImGui::SetTooltip("if enabled, no checks for the presence of a volume macro will be made.\nthis will cause the last macro value to linger unless a value in the volume column is present."); } + ImGui::Checkbox("Broken output volume - Episode 2 (PLEASE KEEP ME DISABLED)",&e->song.brokenOutVol2); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("these compatibility flags are getting SO damn ridiculous and out of control.\nas you may have guessed, this one exists due to yet ANOTHER DefleMask-specific behavior.\nplease keep this off at all costs, because I will not support it when ROM export comes.\noh, and don't start an argument out of it. Furnace isn't a DefleMask replacement, and no,\nI am not trying to make it look like one with all these flags.\n\noh, and what about the other flags that don't have to do with DefleMask?\nthose are for .mod import, future FamiTracker import and personal taste!\n\nend of rant"); + } ImGui::Checkbox("Treat SN76489 periods under 8 as 1",&e->song.snNoLowPeriods); if (ImGui::IsItemHovered()) { ImGui::SetTooltip("when enabled, any SN period under 8 will be written as 1 instead.\nthis replicates DefleMask behavior, but reduces available period range.");