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;
@ -182,9 +182,16 @@ void DivEngine::loadDMP(SafeReader& reader, std::vector<DivInstrument*>& ret, St
ins->type=DIV_INS_STD;
}
}
} else {
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;
}
@ -239,6 +246,16 @@ void DivEngine::loadDMP(SafeReader& reader, std::vector<DivInstrument*>& ret, St
ins->fm.op[j].ksr=reader.readC();
ins->fm.op[j].dvb=reader.readC();
ins->fm.op[j].dam=reader.readC();
} else {
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();
@ -248,6 +265,7 @@ void DivEngine::loadDMP(SafeReader& reader, std::vector<DivInstrument*>& ret, St
ins->fm.op[j].ssgEnv=reader.readC();
}
}
}
} else { // STD
logD("reading STD data...");
if (ins->type!=DIV_INS_GB) {