dev127 - experiment with new ins on .fur

This commit is contained in:
tildearrow 2022-11-21 04:04:26 -05:00
parent 51f5ffe05b
commit 8f59ceb6a6
3 changed files with 80 additions and 75 deletions

View file

@ -47,8 +47,8 @@
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock(); #define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
#define BUSY_END isBusy.unlock(); softLocked=false; #define BUSY_END isBusy.unlock(); softLocked=false;
#define DIV_VERSION "dev126" #define DIV_VERSION "dev127"
#define DIV_ENGINE_VERSION 126 #define DIV_ENGINE_VERSION 127
// for imports // for imports
#define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_MOD 0xff01
#define DIV_VERSION_FC 0xff02 #define DIV_VERSION_FC 0xff02

View file

@ -4503,7 +4503,8 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
for (int i=0; i<song.insLen; i++) { for (int i=0; i<song.insLen; i++) {
DivInstrument* ins=song.ins[i]; DivInstrument* ins=song.ins[i];
insPtr.push_back(w->tell()); insPtr.push_back(w->tell());
ins->putInsData(w); logV("writing instrument %d...",i);
ins->putInsData2(w,false);
} }
/// WAVETABLE /// WAVETABLE

View file

@ -213,6 +213,7 @@ bool DivInstrumentSNES::operator==(const DivInstrumentSNES& other) {
#undef _C #undef _C
#define FEATURE_BEGIN(x) \ #define FEATURE_BEGIN(x) \
logV("- %s",x); \
w->write(x,2); \ w->write(x,2); \
size_t featStartSeek=w->tell(); \ size_t featStartSeek=w->tell(); \
w->writeS(0); w->writeS(0);
@ -1878,7 +1879,7 @@ void DivInstrument::readFeatureMA(SafeReader& reader) {
unsigned short macroHeaderLen=reader.readS(); unsigned short macroHeaderLen=reader.readS();
DivInstrumentMacro& target=std.volMacro; DivInstrumentMacro* target=&std.volMacro;
while (reader.tell()<endOfFeat) { while (reader.tell()<endOfFeat) {
size_t endOfMacroHeader=reader.tell()+macroHeaderLen; size_t endOfMacroHeader=reader.tell()+macroHeaderLen;
@ -1889,101 +1890,104 @@ void DivInstrument::readFeatureMA(SafeReader& reader) {
switch (macroCode) { switch (macroCode) {
case 0: case 0:
target=std.volMacro; target=&std.volMacro;
break; break;
case 1: case 1:
target=std.arpMacro; target=&std.arpMacro;
break; break;
case 2: case 2:
target=std.dutyMacro; target=&std.dutyMacro;
break; break;
case 3: case 3:
target=std.waveMacro; target=&std.waveMacro;
break; break;
case 4: case 4:
target=std.pitchMacro; target=&std.pitchMacro;
break; break;
case 5: case 5:
target=std.ex1Macro; target=&std.ex1Macro;
break; break;
case 6: case 6:
target=std.ex2Macro; target=&std.ex2Macro;
break; break;
case 7: case 7:
target=std.ex3Macro; target=&std.ex3Macro;
break; break;
case 8: case 8:
target=std.algMacro; target=&std.algMacro;
break; break;
case 9: case 9:
target=std.fbMacro; target=&std.fbMacro;
break; break;
case 10: case 10:
target=std.fmsMacro; target=&std.fmsMacro;
break; break;
case 11: case 11:
target=std.amsMacro; target=&std.amsMacro;
break; break;
case 12: case 12:
target=std.panLMacro; target=&std.panLMacro;
break; break;
case 13: case 13:
target=std.panRMacro; target=&std.panRMacro;
break; break;
case 14: case 14:
target=std.phaseResetMacro; target=&std.phaseResetMacro;
break; break;
case 15: case 15:
target=std.ex4Macro; target=&std.ex4Macro;
break; break;
case 16: case 16:
target=std.ex5Macro; target=&std.ex5Macro;
break; break;
case 17: case 17:
target=std.ex6Macro; target=&std.ex6Macro;
break; break;
case 18: case 18:
target=std.ex7Macro; target=&std.ex7Macro;
break; break;
case 19: case 19:
target=std.ex8Macro; target=&std.ex8Macro;
break;
default:
logW("invalid macro code %d!");
break; break;
} }
target.len=reader.readC(); target->len=reader.readC();
target.loop=reader.readC(); target->loop=reader.readC();
target.rel=reader.readC(); target->rel=reader.readC();
target.mode=reader.readC(); target->mode=reader.readC();
unsigned char wordSize=reader.readC(); unsigned char wordSize=reader.readC();
target.open=wordSize&7; target->open=wordSize&7;
wordSize>>=6; wordSize>>=6;
target.delay=reader.readC(); target->delay=reader.readC();
target.speed=reader.readC(); target->speed=reader.readC();
reader.seek(endOfMacroHeader,SEEK_SET); reader.seek(endOfMacroHeader,SEEK_SET);
// read macro // read macro
switch (wordSize) { switch (wordSize) {
case 0: case 0:
for (int i=0; i<target.len; i++) { for (int i=0; i<target->len; i++) {
target.val[i]=(unsigned char)reader.readC(); target->val[i]=(unsigned char)reader.readC();
} }
break; break;
case 1: case 1:
for (int i=0; i<target.len; i++) { for (int i=0; i<target->len; i++) {
target.val[i]=(signed char)reader.readC(); target->val[i]=(signed char)reader.readC();
} }
break; break;
case 2: case 2:
for (int i=0; i<target.len; i++) { for (int i=0; i<target->len; i++) {
target.val[i]=reader.readS(); target->val[i]=reader.readS();
} }
break; break;
default: default:
for (int i=0; i<target.len; i++) { for (int i=0; i<target->len; i++) {
target.val[i]=reader.readI(); target->val[i]=reader.readI();
} }
break; break;
} }
@ -2082,7 +2086,7 @@ void DivInstrument::readFeatureOx(SafeReader& reader, int op) {
unsigned short macroHeaderLen=reader.readS(); unsigned short macroHeaderLen=reader.readS();
DivInstrumentMacro& target=std.opMacros[op].amMacro; DivInstrumentMacro* target=&std.opMacros[op].amMacro;
while (reader.tell()<endOfFeat) { while (reader.tell()<endOfFeat) {
size_t endOfMacroHeader=reader.tell()+macroHeaderLen; size_t endOfMacroHeader=reader.tell()+macroHeaderLen;
@ -2093,101 +2097,101 @@ void DivInstrument::readFeatureOx(SafeReader& reader, int op) {
switch (macroCode) { switch (macroCode) {
case 0: case 0:
target=std.opMacros[op].amMacro; target=&std.opMacros[op].amMacro;
break; break;
case 1: case 1:
target=std.opMacros[op].arMacro; target=&std.opMacros[op].arMacro;
break; break;
case 2: case 2:
target=std.opMacros[op].drMacro; target=&std.opMacros[op].drMacro;
break; break;
case 3: case 3:
target=std.opMacros[op].multMacro; target=&std.opMacros[op].multMacro;
break; break;
case 4: case 4:
target=std.opMacros[op].rrMacro; target=&std.opMacros[op].rrMacro;
break; break;
case 5: case 5:
target=std.opMacros[op].slMacro; target=&std.opMacros[op].slMacro;
break; break;
case 6: case 6:
target=std.opMacros[op].tlMacro; target=&std.opMacros[op].tlMacro;
break; break;
case 7: case 7:
target=std.opMacros[op].dt2Macro; target=&std.opMacros[op].dt2Macro;
break; break;
case 8: case 8:
target=std.opMacros[op].rsMacro; target=&std.opMacros[op].rsMacro;
break; break;
case 9: case 9:
target=std.opMacros[op].dtMacro; target=&std.opMacros[op].dtMacro;
break; break;
case 10: case 10:
target=std.opMacros[op].d2rMacro; target=&std.opMacros[op].d2rMacro;
break; break;
case 11: case 11:
target=std.opMacros[op].ssgMacro; target=&std.opMacros[op].ssgMacro;
break; break;
case 12: case 12:
target=std.opMacros[op].damMacro; target=&std.opMacros[op].damMacro;
break; break;
case 13: case 13:
target=std.opMacros[op].dvbMacro; target=&std.opMacros[op].dvbMacro;
break; break;
case 14: case 14:
target=std.opMacros[op].egtMacro; target=&std.opMacros[op].egtMacro;
break; break;
case 15: case 15:
target=std.opMacros[op].kslMacro; target=&std.opMacros[op].kslMacro;
break; break;
case 16: case 16:
target=std.opMacros[op].susMacro; target=&std.opMacros[op].susMacro;
break; break;
case 17: case 17:
target=std.opMacros[op].vibMacro; target=&std.opMacros[op].vibMacro;
break; break;
case 18: case 18:
target=std.opMacros[op].wsMacro; target=&std.opMacros[op].wsMacro;
break; break;
case 19: case 19:
target=std.opMacros[op].ksrMacro; target=&std.opMacros[op].ksrMacro;
break; break;
} }
target.len=reader.readC(); target->len=reader.readC();
target.loop=reader.readC(); target->loop=reader.readC();
target.rel=reader.readC(); target->rel=reader.readC();
target.mode=reader.readC(); target->mode=reader.readC();
unsigned char wordSize=reader.readC(); unsigned char wordSize=reader.readC();
target.open=wordSize&7; target->open=wordSize&7;
wordSize>>=6; wordSize>>=6;
target.delay=reader.readC(); target->delay=reader.readC();
target.speed=reader.readC(); target->speed=reader.readC();
reader.seek(endOfMacroHeader,SEEK_SET); reader.seek(endOfMacroHeader,SEEK_SET);
// read macro // read macro
switch (wordSize) { switch (wordSize) {
case 0: case 0:
for (int i=0; i<target.len; i++) { for (int i=0; i<target->len; i++) {
target.val[i]=(unsigned char)reader.readC(); target->val[i]=(unsigned char)reader.readC();
} }
break; break;
case 1: case 1:
for (int i=0; i<target.len; i++) { for (int i=0; i<target->len; i++) {
target.val[i]=(signed char)reader.readC(); target->val[i]=(signed char)reader.readC();
} }
break; break;
case 2: case 2:
for (int i=0; i<target.len; i++) { for (int i=0; i<target->len; i++) {
target.val[i]=reader.readS(); target->val[i]=reader.readS();
} }
break; break;
default: default:
for (int i=0; i<target.len; i++) { for (int i=0; i<target->len; i++) {
target.val[i]=reader.readI(); target->val[i]=reader.readI();
} }
break; break;
} }