diff --git a/papers/newIns.md b/papers/newIns.md index f37a54deb..e5eee2d14 100644 --- a/papers/newIns.md +++ b/papers/newIns.md @@ -361,6 +361,7 @@ size | description 1 | sound length | - 64 is infinity 1 | flags + | - bit 2: double wave width for GBA (>=196) | - bit 1: always init envelope | - bit 0: software envelope (zombie mode) 1 | hardware sequence length diff --git a/src/engine/engine.h b/src/engine/engine.h index 601d750e4..d224cfd65 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -54,8 +54,8 @@ class DivWorkPool; #define DIV_UNSTABLE -#define DIV_VERSION "dev195" -#define DIV_ENGINE_VERSION 195 +#define DIV_VERSION "dev196" +#define DIV_ENGINE_VERSION 196 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 diff --git a/src/engine/instrument.cpp b/src/engine/instrument.cpp index eddeeb807..6225765aa 100644 --- a/src/engine/instrument.cpp +++ b/src/engine/instrument.cpp @@ -83,7 +83,8 @@ bool DivInstrumentGB::operator==(const DivInstrumentGB& other) { _C(soundLen) && _C(hwSeqLen) && _C(softEnv) && - _C(alwaysInit) + _C(alwaysInit) && + _C(doubleWave) ); } @@ -484,6 +485,7 @@ void DivInstrument::writeFeatureGB(SafeWriter* w) { w->writeC(gb.soundLen); w->writeC( + (gb.doubleWave?4:0)| (gb.alwaysInit?2:0)| (gb.softEnv?1:0) ); @@ -1633,6 +1635,7 @@ void DivInstrument::readFeatureGB(SafeReader& reader, short version) { gb.soundLen=reader.readC(); next=reader.readC(); + if (version>=196) gb.doubleWave=next&4; gb.alwaysInit=next&2; gb.softEnv=next&1; diff --git a/src/engine/instrument.h b/src/engine/instrument.h index 45b02c727..21de82121 100644 --- a/src/engine/instrument.h +++ b/src/engine/instrument.h @@ -384,7 +384,7 @@ struct DivInstrumentSTD { struct DivInstrumentGB { unsigned char envVol, envDir, envLen, soundLen, hwSeqLen; - bool softEnv, alwaysInit, doubleWave; // TODO file save/load of doubleWave + bool softEnv, alwaysInit, doubleWave; enum HWSeqCommands: unsigned char { DIV_GB_HWCMD_ENVELOPE=0, DIV_GB_HWCMD_SWEEP,