- hopefully fixed the MUS precaching for good.

According to blzut3, it looks like it is a byte followed by a variable length field. It can be any value 0-15 and will be followed by that many bytes one for each bank used. If the bank count is 0 then it is shorthand for using one bank (bank 0).
This commit is contained in:
Christoph Oelckers 2015-12-30 20:32:19 +01:00
parent be6daf5d78
commit 3c40d71c20
2 changed files with 14 additions and 14 deletions

View File

@ -228,19 +228,19 @@ void MUSSong2::Precache()
val = instr - 100 + (1 << 14); val = instr - 100 + (1 << 14);
} }
BYTE moreparam = used[k++]; int numbanks = used[k++];
if (moreparam == 1) if (numbanks > 0)
{ {
BYTE bank = used[k++]; for (int b = 0; b < numbanks; b++)
val |= (bank << 7);
}
else if (moreparam > 0)
{ {
// No information if this is even valid. Print a message so it can be investigated later work[j++] = val | used[k++];
Printf("Unknown instrument data found in music\n");
} }
}
else
{
work[j++] = val; work[j++] = val;
} }
}
MIDI->PrecacheInstruments(&work[0], j); MIDI->PrecacheInstruments(&work[0], j);
} }