diff --git a/src/engine/fileOpsIns.cpp b/src/engine/fileOpsIns.cpp index 1e38f9f3e..d60366286 100644 --- a/src/engine/fileOpsIns.cpp +++ b/src/engine/fileOpsIns.cpp @@ -498,10 +498,35 @@ void DivEngine::loadVGI(SafeReader& reader, std::vector& ret, St void DivEngine::loadEIF(SafeReader& reader, std::vector& ret, String& stripPath) { DivInstrument* ins=new DivInstrument; try { + unsigned char bytes[29]; + reader.seek(0,SEEK_SET); ins->type=DIV_INS_FM; ins->name=stripPath; + + for (int i=0; i < 29; i++) { + bytes[i] = reader.readC(); + } + + ins->fm.fb=(bytes[0]>>3)&0x7; + ins->fm.alg=bytes[0]&0x7; + + for (int i=0; i<4; i++) { + DivInstrumentFM::Operator& op=ins->fm.op[i]; + + //TODO: finish missing parameters + + op.mult=bytes[1+i]&0xF; + op.dt=(bytes[1+i]>>4)&0x07; + op.tl=bytes[5+i]&0x7F; + op.ar=bytes[9+i]&0x1F; + op.rs=(bytes[9+i]>>6)&0x03; + op.dr=bytes[13+i]&0x1F; + op.d2r=bytes[17+i]&0x1F; + op.sl=(bytes[21+i]>>4)&0x0F; + op.rr=bytes[21+i]&0x0F; + } } catch (EndOfFileException& e) { lastError="premature end of file"; logE("premature end of file");