mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-15 17:25:06 +00:00
GYBv3 sorta loading... just need to fix up some read issues
This commit is contained in:
parent
7ae72f0fe4
commit
e289ba652d
1 changed files with 52 additions and 42 deletions
|
@ -1045,50 +1045,57 @@ void DivEngine::loadGYB(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
||||||
// see https://plutiedev.com/ym2612-registers
|
// see https://plutiedev.com/ym2612-registers
|
||||||
// and https://github.com/Wohlstand/OPN2BankEditor/blob/master/Specifications/GYB-file-specification.txt
|
// and https://github.com/Wohlstand/OPN2BankEditor/blob/master/Specifications/GYB-file-specification.txt
|
||||||
|
|
||||||
uint8_t reg;
|
try {
|
||||||
for (int i : opOrder) {
|
uint8_t reg;
|
||||||
reg = reader.readC(); // MUL/DT
|
for (int i : opOrder) {
|
||||||
ins->fm.op[i].mult = reg & 0xF;
|
reg = reader.readC(); // MUL/DT
|
||||||
ins->fm.op[i].dt = fmDtRegisterToFurnace((reg >> 4) & 0x7);
|
ins->fm.op[i].mult = reg & 0xF;
|
||||||
}
|
ins->fm.op[i].dt = fmDtRegisterToFurnace((reg >> 4) & 0x7);
|
||||||
for (int i : opOrder) {
|
}
|
||||||
reg = reader.readC(); // TL
|
for (int i : opOrder) {
|
||||||
ins->fm.op[i].tl = reg & 0x7F;
|
reg = reader.readC(); // TL
|
||||||
}
|
ins->fm.op[i].tl = reg & 0x7F;
|
||||||
for (int i : opOrder) {
|
}
|
||||||
reg = reader.readC(); // AR/RS
|
for (int i : opOrder) {
|
||||||
ins->fm.op[i].ar = reg & 0x1F;
|
reg = reader.readC(); // AR/RS
|
||||||
ins->fm.op[i].rs = ((reg >> 6) & 0x3);
|
ins->fm.op[i].ar = reg & 0x1F;
|
||||||
}
|
ins->fm.op[i].rs = ((reg >> 6) & 0x3);
|
||||||
for (int i : opOrder) {
|
}
|
||||||
reg = reader.readC(); // DR/AM-ENA
|
for (int i : opOrder) {
|
||||||
ins->fm.op[i].dr = reg & 0x1F;
|
reg = reader.readC(); // DR/AM-ENA
|
||||||
ins->fm.op[i].am = ((reg >> 7) & 0x1);
|
ins->fm.op[i].dr = reg & 0x1F;
|
||||||
}
|
ins->fm.op[i].am = ((reg >> 7) & 0x1);
|
||||||
for (int i : opOrder) {
|
}
|
||||||
reg = reader.readC(); // SR (D2R)
|
for (int i : opOrder) {
|
||||||
ins->fm.op[i].d2r = reg & 0x1F;
|
reg = reader.readC(); // SR (D2R)
|
||||||
}
|
ins->fm.op[i].d2r = reg & 0x1F;
|
||||||
for (int i : opOrder) {
|
}
|
||||||
reg = reader.readC(); // RR/SL
|
for (int i : opOrder) {
|
||||||
ins->fm.op[i].rr = reg & 0xF;
|
reg = reader.readC(); // RR/SL
|
||||||
ins->fm.op[i].sl = ((reg >> 4) & 0xF);
|
ins->fm.op[i].rr = reg & 0xF;
|
||||||
}
|
ins->fm.op[i].sl = ((reg >> 4) & 0xF);
|
||||||
for (int i : opOrder) {
|
}
|
||||||
reg = reader.readC(); // SSG-EG
|
for (int i : opOrder) {
|
||||||
ins->fm.op[i].ssgEnv = reg & 0xF;
|
reg = reader.readC(); // SSG-EG
|
||||||
}
|
ins->fm.op[i].ssgEnv = reg & 0xF;
|
||||||
// ALG/FB
|
}
|
||||||
reg = reader.readC();
|
// ALG/FB
|
||||||
ins->fm.alg = reg & 0x7;
|
|
||||||
ins->fm.fb = ((reg >> 3) & 0x7);
|
|
||||||
|
|
||||||
if (readRegB4) { // PAN / PMS / AMS
|
|
||||||
reg = reader.readC();
|
reg = reader.readC();
|
||||||
ins->fm.fms = reg & 0x7;
|
ins->fm.alg = reg & 0x7;
|
||||||
ins->fm.ams = ((reg >> 4) & 0x3);
|
ins->fm.fb = ((reg >> 3) & 0x7);
|
||||||
|
|
||||||
|
if (readRegB4) { // PAN / PMS / AMS
|
||||||
|
reg = reader.readC();
|
||||||
|
ins->fm.fms = reg & 0x7;
|
||||||
|
ins->fm.ams = ((reg >> 4) & 0x3);
|
||||||
|
}
|
||||||
|
return ins;
|
||||||
|
|
||||||
|
} catch (...) {
|
||||||
|
// Deallocate and rethrow to outer handler
|
||||||
|
delete ins;
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
return ins;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1166,10 +1173,13 @@ void DivEngine::loadGYB(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
||||||
reader.readC();
|
reader.readC();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
reader.readC(); // padding
|
||||||
|
reader.readC(); // padding
|
||||||
uint8_t nameLen = reader.readC();
|
uint8_t nameLen = reader.readC();
|
||||||
String insName = (nameLen > 0) ? reader.readString(nameLen) : fmt::sprintf("%s [%d]", stripPath, readCount++);
|
String insName = (nameLen > 0) ? reader.readString(nameLen) : fmt::sprintf("%s [%d]", stripPath, readCount++);
|
||||||
newIns->name = insName;
|
newIns->name = insName;
|
||||||
insList.push_back(newIns);
|
insList.push_back(newIns);
|
||||||
|
++readCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reader.seek(0, SEEK_END);
|
reader.seek(0, SEEK_END);
|
||||||
|
|
Loading…
Reference in a new issue