C64: old test/gate/special macro compatibility
This commit is contained in:
parent
87b8851900
commit
a9201bebdc
2 changed files with 33 additions and 0 deletions
|
|
@ -2685,6 +2685,11 @@ DivDataErrors DivInstrument::readInsDataNew(SafeReader& reader, short version, b
|
||||||
std.volMacro=DivInstrumentMacro(DIV_MACRO_VOL,true);
|
std.volMacro=DivInstrumentMacro(DIV_MACRO_VOL,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// <187 special/test/gate merge
|
||||||
|
if (type==DIV_INS_C64 && version<187) {
|
||||||
|
convertC64SpecialMacro();
|
||||||
|
}
|
||||||
|
|
||||||
return DIV_DATA_SUCCESS;
|
return DIV_DATA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3426,6 +3431,11 @@ DivDataErrors DivInstrument::readInsDataOld(SafeReader &reader, short version) {
|
||||||
std.volMacro=DivInstrumentMacro(DIV_MACRO_VOL,true);
|
std.volMacro=DivInstrumentMacro(DIV_MACRO_VOL,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// <187 special/test/gate merge
|
||||||
|
if (type==DIV_INS_C64 && version<187) {
|
||||||
|
convertC64SpecialMacro();
|
||||||
|
}
|
||||||
|
|
||||||
return DIV_DATA_SUCCESS;
|
return DIV_DATA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3455,6 +3465,27 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version, DivS
|
||||||
return readInsDataOld(reader,version);
|
return readInsDataOld(reader,version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivInstrument::convertC64SpecialMacro() {
|
||||||
|
// merge special and test/gate macros into new special macro
|
||||||
|
int maxLen=MAX(std.ex3Macro.len,std.ex4Macro.len);
|
||||||
|
|
||||||
|
// skip if ex4 is not a sequence macro
|
||||||
|
if (std.ex4Macro.open&6) return;
|
||||||
|
|
||||||
|
// move ex4 macro up and fill in gate
|
||||||
|
for (int i=0; i<std.ex4Macro.len; i++) {
|
||||||
|
std.ex4Macro.val[i]=(std.ex4Macro.val[i]&1)?9:1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// merge ex3 into ex4
|
||||||
|
for (int i=0; i<maxLen; i++) {
|
||||||
|
std.ex4Macro.val[i]|=(std.ex3Macro.val[i]&3)<<1;
|
||||||
|
}
|
||||||
|
std.ex4Macro.len=maxLen;
|
||||||
|
|
||||||
|
std.ex3Macro=DivInstrumentMacro(DIV_MACRO_EX3);
|
||||||
|
}
|
||||||
|
|
||||||
bool DivInstrument::save(const char* path, bool oldFormat, DivSong* song, bool writeInsName) {
|
bool DivInstrument::save(const char* path, bool oldFormat, DivSong* song, bool writeInsName) {
|
||||||
SafeWriter* w=new SafeWriter();
|
SafeWriter* w=new SafeWriter();
|
||||||
w->init();
|
w->init();
|
||||||
|
|
|
||||||
|
|
@ -834,6 +834,8 @@ struct DivInstrument {
|
||||||
|
|
||||||
DivDataErrors readInsDataOld(SafeReader& reader, short version);
|
DivDataErrors readInsDataOld(SafeReader& reader, short version);
|
||||||
DivDataErrors readInsDataNew(SafeReader& reader, short version, bool fui, DivSong* song);
|
DivDataErrors readInsDataNew(SafeReader& reader, short version, bool fui, DivSong* song);
|
||||||
|
|
||||||
|
void convertC64SpecialMacro();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* save the instrument to a SafeWriter.
|
* save the instrument to a SafeWriter.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue