diff --git a/papers/format.md b/papers/format.md index 38696622a..267b74108 100644 --- a/papers/format.md +++ b/papers/format.md @@ -348,7 +348,8 @@ size | description --- | **a couple more compat flags** (>=138) 1 | broken portamento during legato 1 | broken macro during note off in some FM chips (>=155) - 6 | reserved + 1 | pre note (C64) does not compensate for portamento or legato (>=168) + 5 | reserved --- | **speed pattern of first song** (>=139) 1 | length of speed pattern (fail if this is lower than 0 or higher than 16) 16 | speed pattern (this overrides speed 1 and speed 2 settings) diff --git a/src/engine/engine.h b/src/engine/engine.h index 3a2972170..683289edd 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -56,8 +56,8 @@ #define DIV_UNSTABLE -#define DIV_VERSION "dev167" -#define DIV_ENGINE_VERSION 167 +#define DIV_VERSION "dev168" +#define DIV_ENGINE_VERSION 168 // 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 9cf94547b..1465c816e 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -183,6 +183,7 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) { ds.brokenPortaArp=false; ds.snNoLowPeriods=true; ds.disableSampleMacro=true; + ds.preNoteNoEffect=true; ds.delayBehavior=0; ds.jumpTreatment=2; @@ -1844,6 +1845,9 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { if (ds.version<155) { ds.brokenFMOff=true; } + if (ds.version<168) { + ds.preNoteNoEffect=true; + } ds.isDMF=false; reader.readS(); // reserved @@ -2355,7 +2359,12 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { } else { reader.readC(); } - for (int i=0; i<6; i++) { + if (ds.version>=168) { + ds.preNoteNoEffect=reader.readC(); + } else { + reader.readC(); + } + for (int i=0; i<5; i++) { reader.readC(); } } @@ -5383,7 +5392,9 @@ SafeWriter* DivEngine::saveFur(bool notPrimary, bool newPatternFormat) { // even more compat flags w->writeC(song.brokenPortaLegato); - for (int i=0; i<7; i++) { + w->writeC(song.brokenFMOff); + w->writeC(song.preNoteNoEffect); + for (int i=0; i<5; i++) { w->writeC(0); } diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index f379b7219..0078b015b 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -1208,8 +1208,26 @@ void DivEngine::nextRow() { if (disCont[dispatchOfChan[i]].dispatch!=NULL) { wantPreNote=disCont[dispatchOfChan[i]].dispatch->getWantPreNote(); if (wantPreNote) { + bool doPreparePreNote=true; int addition=0; + for (int j=0; jdata[curRow][4+(j<<1)]==0x03) { + doPreparePreNote=false; + break; + } + if (pat->data[curRow][4+(j<<1)]==0x06) { + doPreparePreNote=false; + break; + } + if (pat->data[curRow][4+(j<<1)]==0xea) { + if (pat->data[curRow][5+(j<<1)]>0) { + doPreparePreNote=false; + break; + } + } + } if (pat->data[curRow][4+(j<<1)]==0xed) { if (pat->data[curRow][5+(j<<1)]>0) { addition=pat->data[curRow][5+(j<<1)]&255; @@ -1217,7 +1235,7 @@ void DivEngine::nextRow() { } } } - dispatchCmd(DivCommand(DIV_CMD_PRE_NOTE,i,ticks+addition)); + if (doPreparePreNote) dispatchCmd(DivCommand(DIV_CMD_PRE_NOTE,i,ticks+addition)); } } diff --git a/src/engine/song.h b/src/engine/song.h index 803f87360..f05100798 100644 --- a/src/engine/song.h +++ b/src/engine/song.h @@ -375,6 +375,7 @@ struct DivSong { bool patchbayAuto; bool brokenPortaLegato; bool brokenFMOff; + bool preNoteNoEffect; std::vector ins; std::vector wave; @@ -493,7 +494,8 @@ struct DivSong { oldArpStrategy(false), patchbayAuto(true), brokenPortaLegato(false), - brokenFMOff(false) { + brokenFMOff(false), + preNoteNoEffect(false) { for (int i=0; i