diff --git a/src/engine/engine.h b/src/engine/engine.h index 8b8100500..8cc74dba3 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -54,8 +54,8 @@ class DivWorkPool; #define DIV_UNSTABLE -#define DIV_VERSION "dev192 new osc" -#define DIV_ENGINE_VERSION 192 +#define DIV_VERSION "dev193" +#define DIV_ENGINE_VERSION 193 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 diff --git a/src/engine/fileOps/dmf.cpp b/src/engine/fileOps/dmf.cpp index fda0c27d8..f55e10da8 100644 --- a/src/engine/fileOps/dmf.cpp +++ b/src/engine/fileOps/dmf.cpp @@ -558,6 +558,11 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) { } else { ins->std.waveMacro.val[j]=reader.readI(); } + + // piece of crap offset by 1 + if (ds.system[0]==DIV_SYSTEM_YM2610 || ds.system[0]==DIV_SYSTEM_YM2610_EXT) { + ins->std.waveMacro.val[j]++; + } } if (ins->std.waveMacro.len>0) { ins->std.waveMacro.open=true; @@ -1435,7 +1440,12 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) { if (realWaveMacroLen>127) realWaveMacroLen=127; w->writeC(realWaveMacroLen); for (int j=0; jwriteI(i->std.waveMacro.val[j]); + // piece of crap offset by 1 + if (song.system[0]==DIV_SYSTEM_YM2610 || song.system[0]==DIV_SYSTEM_YM2610_EXT) { + w->writeI(i->std.waveMacro.val[j]-1); + } else { + w->writeI(i->std.waveMacro.val[j]); + } } if (realWaveMacroLen>0) { w->writeC(i->std.waveMacro.loop); diff --git a/src/engine/instrument.cpp b/src/engine/instrument.cpp index db9c7b2ab..b04da0735 100644 --- a/src/engine/instrument.cpp +++ b/src/engine/instrument.cpp @@ -1525,6 +1525,14 @@ void DivInstrument::readFeatureMA(SafeReader& reader, short version) { } } + if (version<193) { + if (type==DIV_INS_AY || type==DIV_INS_AY8930) { + for (int j=0; j=17) { READ_MACRO_VALS(std.pitchMacro.val,std.pitchMacro.len); READ_MACRO_VALS(std.ex1Macro.val,std.ex1Macro.len); diff --git a/src/engine/platform/ay.cpp b/src/engine/platform/ay.cpp index 2bfc36fff..a15d04f27 100644 --- a/src/engine/platform/ay.cpp +++ b/src/engine/platform/ay.cpp @@ -266,9 +266,7 @@ void DivPlatformAY8910::tick(bool sysTick) { } if (chan[i].std.wave.had) { if (!(chan[i].nextPSGMode.val&8)) { - // TODO: clean up. - // why does Defle start from 1?! - chan[i].nextPSGMode.val=(chan[i].std.wave.val+1)&7; + chan[i].nextPSGMode.val=chan[i].std.wave.val&7; if (chan[i].active) { chan[i].curPSGMode.val=chan[i].nextPSGMode.val; } diff --git a/src/engine/platform/ay8930.cpp b/src/engine/platform/ay8930.cpp index c32e57987..997e4cc32 100644 --- a/src/engine/platform/ay8930.cpp +++ b/src/engine/platform/ay8930.cpp @@ -256,9 +256,7 @@ void DivPlatformAY8930::tick(bool sysTick) { } if (chan[i].std.wave.had) { if (!(chan[i].nextPSGMode.val&8)) { - // TODO: clean up. - // why does Defle start from 1?! - chan[i].nextPSGMode.val=(chan[i].std.wave.val+1)&7; + chan[i].nextPSGMode.val=chan[i].std.wave.val&7; if (chan[i].active) { chan[i].curPSGMode.val=chan[i].nextPSGMode.val; } diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index f34ed226d..f7b5f9808 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -1529,6 +1529,9 @@ void FurnaceGUI::drawMacroEdit(FurnaceGUIMacroDesc& i, int totalFit, float avail static float bit30Indicator[256]; static bool doHighlight[256]; + // TODO: clean up + assert(i.bitOffset==0); + if ((i.macro->open&6)==0) { for (int j=0; j<256; j++) { bit30Indicator[j]=0; @@ -7136,7 +7139,7 @@ void FurnaceGUI::drawInsEdit() { } } if (waveMax>0) { - macroList.push_back(FurnaceGUIMacroDesc(waveLabel,&ins->std.waveMacro,0,waveMax,(waveBitMode && ins->type!=DIV_INS_PET)?64:160,uiColors[GUI_COLOR_MACRO_WAVE],false,NULL,NULL,waveBitMode,waveNames,((ins->type==DIV_INS_AY || ins->type==DIV_INS_AY8930)?1:0))); + macroList.push_back(FurnaceGUIMacroDesc(waveLabel,&ins->std.waveMacro,0,waveMax,(waveBitMode && ins->type!=DIV_INS_PET)?64:160,uiColors[GUI_COLOR_MACRO_WAVE],false,NULL,NULL,waveBitMode,waveNames,0)); } if (panMax>0) { if (panSingle) {