From 1aef0079d14eb47e6895e8706c786e50b0d48c6f Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 29 Jul 2023 03:17:15 -0500 Subject: [PATCH] the first step to deprecating Defle compat Furnace will support .dmf loading/saving however in a far future, compatibility may not be guaranteed... I am not sure this setting is off by default (for now) --- src/engine/fileOps.cpp | 134 +++++++++++++++++++++-------------------- src/gui/gui.h | 2 + src/gui/settings.cpp | 11 ++++ 3 files changed, 81 insertions(+), 66 deletions(-) diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index ec7b6495..0ba5a132 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -142,76 +142,78 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) { } // compatibility flags - ds.limitSlides=true; - ds.linearPitch=1; - ds.loopModality=0; - ds.properNoiseLayout=false; - ds.waveDutyIsVol=false; - // TODO: WHAT?! geodude.dmf fails when this is true - // but isn't that how Defle behaves??? - ds.resetMacroOnPorta=false; - ds.legacyVolumeSlides=true; - ds.compatibleArpeggio=true; - ds.noteOffResetsSlides=true; - ds.targetResetsSlides=true; - ds.arpNonPorta=false; - ds.algMacroBehavior=false; - ds.brokenShortcutSlides=false; - ds.ignoreDuplicateSlides=true; - ds.brokenDACMode=true; - ds.oneTickCut=false; - ds.newInsTriggersInPorta=true; - ds.arp0Reset=true; - ds.brokenSpeedSel=true; - ds.noSlidesOnFirstTick=false; - ds.rowResetsArpPos=false; - ds.ignoreJumpAtEnd=true; - ds.buggyPortaAfterSlide=true; - ds.gbInsAffectsEnvelope=true; - ds.ignoreDACModeOutsideIntendedChannel=false; - ds.e1e2AlsoTakePriority=true; - ds.fbPortaPause=true; - ds.snDutyReset=true; - ds.oldOctaveBoundary=false; - ds.noOPN2Vol=true; - ds.newVolumeScaling=false; - ds.volMacroLinger=false; - ds.brokenOutVol=true; - ds.brokenOutVol2=true; - ds.e1e2StopOnSameNote=true; - ds.brokenPortaArp=false; - ds.snNoLowPeriods=true; - ds.disableSampleMacro=true; - ds.delayBehavior=0; - ds.jumpTreatment=2; + if (!getConfInt("noDMFCompat",0)) { + ds.limitSlides=true; + ds.linearPitch=1; + ds.loopModality=0; + ds.properNoiseLayout=false; + ds.waveDutyIsVol=false; + // TODO: WHAT?! geodude.dmf fails when this is true + // but isn't that how Defle behaves??? + ds.resetMacroOnPorta=false; + ds.legacyVolumeSlides=true; + ds.compatibleArpeggio=true; + ds.noteOffResetsSlides=true; + ds.targetResetsSlides=true; + ds.arpNonPorta=false; + ds.algMacroBehavior=false; + ds.brokenShortcutSlides=false; + ds.ignoreDuplicateSlides=true; + ds.brokenDACMode=true; + ds.oneTickCut=false; + ds.newInsTriggersInPorta=true; + ds.arp0Reset=true; + ds.brokenSpeedSel=true; + ds.noSlidesOnFirstTick=false; + ds.rowResetsArpPos=false; + ds.ignoreJumpAtEnd=true; + ds.buggyPortaAfterSlide=true; + ds.gbInsAffectsEnvelope=true; + ds.ignoreDACModeOutsideIntendedChannel=false; + ds.e1e2AlsoTakePriority=true; + ds.fbPortaPause=true; + ds.snDutyReset=true; + ds.oldOctaveBoundary=false; + ds.noOPN2Vol=true; + ds.newVolumeScaling=false; + ds.volMacroLinger=false; + ds.brokenOutVol=true; + ds.brokenOutVol2=true; + ds.e1e2StopOnSameNote=true; + ds.brokenPortaArp=false; + ds.snNoLowPeriods=true; + ds.disableSampleMacro=true; + ds.delayBehavior=0; + ds.jumpTreatment=2; - // 1.1 compat flags - if (ds.version>24) { - ds.waveDutyIsVol=true; - ds.legacyVolumeSlides=false; - } + // 1.1 compat flags + if (ds.version>24) { + ds.waveDutyIsVol=true; + ds.legacyVolumeSlides=false; + } - // Neo Geo detune is caused by Defle running Neo Geo at the wrong clock. - /* - if (ds.system[0]==DIV_SYSTEM_YM2610 || ds.system[0]==DIV_SYSTEM_YM2610_EXT - || ds.system[0]==DIV_SYSTEM_YM2610_FULL || ds.system[0]==DIV_SYSTEM_YM2610_FULL_EXT - || ds.system[0]==DIV_SYSTEM_YM2610B || ds.system[0]==DIV_SYSTEM_YM2610B_EXT) { - ds.tuning=443.23; - } - */ + // Neo Geo detune is caused by Defle running Neo Geo at the wrong clock. + /* + if (ds.system[0]==DIV_SYSTEM_YM2610 || ds.system[0]==DIV_SYSTEM_YM2610_EXT + || ds.system[0]==DIV_SYSTEM_YM2610_FULL || ds.system[0]==DIV_SYSTEM_YM2610_FULL_EXT + || ds.system[0]==DIV_SYSTEM_YM2610B || ds.system[0]==DIV_SYSTEM_YM2610B_EXT) { + ds.tuning=443.23; + } + */ - // Genesis detuned on Defle v10 and earlier - /*if (ds.version<19 && ds.system[0]==DIV_SYSTEM_GENESIS) { - ds.tuning=443.23; - }*/ - // C64 detuned on Defle v11 and earlier - /*if (ds.version<21 && (ds.system[0]==DIV_SYSTEM_C64_6581 || ds.system[0]==DIV_SYSTEM_C64_8580)) { - ds.tuning=433.2; - }*/ + // Genesis detuned on Defle v10 and earlier + /*if (ds.version<19 && ds.system[0]==DIV_SYSTEM_GENESIS) { + ds.tuning=443.23; + }*/ + // C64 detuned on Defle v11 and earlier + /*if (ds.version<21 && (ds.system[0]==DIV_SYSTEM_C64_6581 || ds.system[0]==DIV_SYSTEM_C64_8580)) { + ds.tuning=433.2; + }*/ - // Game Boy arp+soundLen screwery - if (ds.system[0]==DIV_SYSTEM_GB) { - ds.systemFlags[0].set("enoughAlready",true); + // Game Boy arp+soundLen screwery + if (ds.system[0]==DIV_SYSTEM_GB) { + ds.systemFlags[0].set("enoughAlready",true); + } } logI("reading module data..."); diff --git a/src/gui/gui.h b/src/gui/gui.h index 42cec092..43305603 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1523,6 +1523,7 @@ class FurnaceGUI { int newSongBehavior; int memUsageUnit; int cursorFollowsWheel; + int noDMFCompat; unsigned int maxUndoSteps; String mainFontPath; String patFontPath; @@ -1677,6 +1678,7 @@ class FurnaceGUI { newSongBehavior(0), memUsageUnit(1), cursorFollowsWheel(0), + noDMFCompat(0), maxUndoSteps(100), mainFontPath(""), patFontPath(""), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 57f1fa32..41f3ff22 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -676,6 +676,14 @@ void FurnaceGUI::drawSettings() { settings.blankIns=blankInsB; } + bool noDMFCompatB=settings.noDMFCompat; + if (ImGui::Checkbox("Don't apply compatibility flags when loading .dmf",&noDMFCompatB)) { + settings.noDMFCompat=noDMFCompatB; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("do not report any issues arising from the use of this option!"); + } + bool saveUnusedPatternsB=settings.saveUnusedPatterns; if (ImGui::Checkbox("Save unused patterns",&saveUnusedPatternsB)) { settings.saveUnusedPatterns=saveUnusedPatternsB; @@ -2821,6 +2829,7 @@ void FurnaceGUI::syncSettings() { settings.newSongBehavior=e->getConfInt("newSongBehavior",0); settings.memUsageUnit=e->getConfInt("memUsageUnit",1); settings.cursorFollowsWheel=e->getConfInt("cursorFollowsWheel",0); + settings.noDMFCompat=e->getConfInt("noDMFCompat",0); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.patFontSize,2,96); @@ -2950,6 +2959,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.newSongBehavior,0,1); clampSetting(settings.memUsageUnit,0,1); clampSetting(settings.cursorFollowsWheel,0,1); + clampSetting(settings.noDMFCompat,0,1); if (settings.exportLoops<0.0) settings.exportLoops=0.0; if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; @@ -3175,6 +3185,7 @@ void FurnaceGUI::commitSettings() { e->setConf("newSongBehavior",settings.newSongBehavior); e->setConf("memUsageUnit",settings.memUsageUnit); e->setConf("cursorFollowsWheel",settings.cursorFollowsWheel); + e->setConf("noDMFCompat",settings.noDMFCompat); // colors for (int i=0; i