mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-16 01:35:07 +00:00
Fix GYBv1/2 instrument name read
This commit is contained in:
parent
66b0589959
commit
7cd0d728b2
1 changed files with 11 additions and 10 deletions
|
@ -1228,22 +1228,24 @@ void DivEngine::loadGYB(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
||||||
|
|
||||||
// Instrument data
|
// Instrument data
|
||||||
for (int i = 0; i < (insMelodyCount + insDrumCount); ++i) {
|
for (int i = 0; i < (insMelodyCount + insDrumCount); ++i) {
|
||||||
// TODO determine if a patch is 'empty' -> ignore and move on
|
|
||||||
bool isDrum = (i >= insMelodyCount);
|
bool isDrum = (i >= insMelodyCount);
|
||||||
DivInstrument* newIns = readInstrument(reader, (version == 2));
|
DivInstrument* newIns = readInstrument(reader, (version == 2));
|
||||||
reader.readC(); // skip transpose
|
reader.readC(); // skip transpose
|
||||||
if (version == 2) {
|
if (version == 2) {
|
||||||
reader.readC(); // skip padding
|
reader.readC(); // skip padding
|
||||||
}
|
}
|
||||||
|
reader.readC();
|
||||||
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);
|
insList.push_back(newIns);
|
||||||
++readCount;
|
++readCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Instrument name
|
||||||
|
for (int i = 0; i < (insMelodyCount + insDrumCount); ++i) {
|
||||||
|
uint8_t nameLen = reader.readC();
|
||||||
|
String insName = (nameLen > 0) ? reader.readString(nameLen) : fmt::sprintf("%s [%d]", stripPath, readCount);
|
||||||
|
insList[i]->name = insName;
|
||||||
|
}
|
||||||
|
|
||||||
// Map to note assignment currently not supported.
|
// Map to note assignment currently not supported.
|
||||||
|
|
||||||
} else { // GYBv3+
|
} else { // GYBv3+
|
||||||
|
@ -1280,9 +1282,8 @@ void DivEngine::loadGYB(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
||||||
newIns->name = insName;
|
newIns->name = insName;
|
||||||
insList.push_back(newIns);
|
insList.push_back(newIns);
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.seek(0, SEEK_END);
|
|
||||||
}
|
}
|
||||||
|
reader.seek(0, SEEK_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (EndOfFileException& e) {
|
} catch (EndOfFileException& e) {
|
||||||
|
|
Loading…
Reference in a new issue