more .dmp loading fixes

this time for OPLL
This commit is contained in:
tildearrow 2022-09-10 00:28:21 -05:00
parent 3c5d71ce4c
commit 9ac9cfc903

View file

@ -156,7 +156,7 @@ void DivEngine::loadDMP(SafeReader& reader, std::vector<DivInstrument*>& ret, St
break;
default:
logD("instrument type is unknown");
lastError="unknown instrument type!";
lastError=fmt::sprintf("unknown instrument type %d!",sys);
delete ins;
return;
break;
@ -183,7 +183,14 @@ void DivEngine::loadDMP(SafeReader& reader, std::vector<DivInstrument*>& ret, St
}
}
} else {
ins->type=DIV_INS_FM;
if (sys==3 || sys==6) {
ins->type=DIV_INS_OPLL;
} else if (sys==1) {
ins->type=DIV_INS_OPL;
} else {
ins->type=DIV_INS_FM;
}
}
} else {
ins->type=DIV_INS_FM;
@ -240,12 +247,23 @@ void DivEngine::loadDMP(SafeReader& reader, std::vector<DivInstrument*>& ret, St
ins->fm.op[j].dvb=reader.readC();
ins->fm.op[j].dam=reader.readC();
} else {
ins->fm.op[j].rs=reader.readC();
ins->fm.op[j].dt=reader.readC();
ins->fm.op[j].dt2=ins->fm.op[j].dt>>4;
ins->fm.op[j].dt&=15;
ins->fm.op[j].d2r=reader.readC();
ins->fm.op[j].ssgEnv=reader.readC();
if (sys==3 || sys==6) { // OPLL/VRC7
ins->fm.op[j].ksr=reader.readC()?1:0;
ins->fm.op[j].vib=reader.readC();
if (j==0) {
ins->fm.opllPreset=ins->fm.op[j].vib>>4;
}
ins->fm.op[j].vib=ins->fm.op[j].vib?1:0;
ins->fm.op[j].ksl=reader.readC()?1:0;
ins->fm.op[j].ssgEnv=reader.readC();
} else {
ins->fm.op[j].rs=reader.readC();
ins->fm.op[j].dt=reader.readC();
ins->fm.op[j].dt2=ins->fm.op[j].dt>>4;
ins->fm.op[j].dt&=15;
ins->fm.op[j].d2r=reader.readC();
ins->fm.op[j].ssgEnv=reader.readC();
}
}
}
} else { // STD