Skip to content

Commit f4b700c

Browse files
committed
SCI: AdLib: add dummy instruments when there are only 48 in the patch
svn-id: r50035
1 parent 25c86e8 commit f4b700c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

engines/sci/sound/drivers/adlib.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -703,11 +703,8 @@ void MidiDriver_AdLib::setVelocityReg(int regOffset, int velocity, int kbScaleLe
703703

704704
void MidiDriver_AdLib::setPatch(int voice, int patch) {
705705
if ((patch < 0) || ((uint)patch >= _patches.size())) {
706-
// This happens with songs 1 and 23 in PQ2. Song 1 (the title song) uses an invalid
707-
// instrument 80, and song 23 (car horn when the car runs over you at the airport,
708-
// rooms 14/15) an invalid instrument 89. These are probably leftovers from MT32.
709-
warning("ADLIB: Invalid patch %i requested (patch.003 contains %d instruments)",
710-
patch, _patches.size());
706+
warning("ADLIB: Invalid patch %i requested", patch);
707+
// Substitute instrument 0
711708
patch = 0;
712709
}
713710

@@ -760,10 +757,16 @@ bool MidiDriver_AdLib::loadResource(const byte *data, uint size) {
760757
for (int i = 0; i < 48; i++)
761758
loadInstrument(data + (28 * i));
762759

763-
if (size == 2690) {
760+
if (size == 1344) {
761+
byte dummy[28] = {0};
762+
763+
// Only 48 instruments, add dummies
764+
for (int i = 0; i < 48; i++)
765+
loadInstrument(dummy);
766+
} else if (size == 2690) {
764767
for (int i = 48; i < 96; i++)
765768
loadInstrument(data + 2 + (28 * i));
766-
} else if (size == 5382) {
769+
} else {
767770
// SCI1.1 and later
768771
for (int i = 48; i < 190; i++)
769772
loadInstrument(data + (28 * i));

0 commit comments

Comments
 (0)