GYBv3 sorta loading... just need to fix up some read issues
This commit is contained in:
parent
7ae72f0fe4
commit
e289ba652d
|
@ -1045,6 +1045,7 @@ void DivEngine::loadGYB(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
|||
// see https://plutiedev.com/ym2612-registers
|
||||
// and https://github.com/Wohlstand/OPN2BankEditor/blob/master/Specifications/GYB-file-specification.txt
|
||||
|
||||
try {
|
||||
uint8_t reg;
|
||||
for (int i : opOrder) {
|
||||
reg = reader.readC(); // MUL/DT
|
||||
|
@ -1089,6 +1090,12 @@ void DivEngine::loadGYB(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
|||
ins->fm.ams = ((reg >> 4) & 0x3);
|
||||
}
|
||||
return ins;
|
||||
|
||||
} catch (...) {
|
||||
// Deallocate and rethrow to outer handler
|
||||
delete ins;
|
||||
throw;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
|
@ -1166,10 +1173,13 @@ void DivEngine::loadGYB(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
|||
reader.readC();
|
||||
}
|
||||
}
|
||||
reader.readC(); // padding
|
||||
reader.readC(); // padding
|
||||
uint8_t nameLen = reader.readC();
|
||||
String insName = (nameLen > 0) ? reader.readString(nameLen) : fmt::sprintf("%s [%d]", stripPath, readCount++);
|
||||
newIns->name = insName;
|
||||
insList.push_back(newIns);
|
||||
++readCount;
|
||||
}
|
||||
}
|
||||
reader.seek(0, SEEK_END);
|
||||
|
|
Loading…
Reference in New Issue