From f4b700c4c45e601a5d1571f980ec7e5636e0f166 Mon Sep 17 00:00:00 2001 From: Walter van Niftrik Date: Sat, 19 Jun 2010 01:16:25 +0000 Subject: SCI: AdLib: add dummy instruments when there are only 48 in the patch svn-id: r50035 --- engines/sci/sound/drivers/adlib.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/sound/drivers/adlib.cpp b/engines/sci/sound/drivers/adlib.cpp index c2cc49e336..55c3640c9d 100644 --- a/engines/sci/sound/drivers/adlib.cpp +++ b/engines/sci/sound/drivers/adlib.cpp @@ -703,11 +703,8 @@ void MidiDriver_AdLib::setVelocityReg(int regOffset, int velocity, int kbScaleLe void MidiDriver_AdLib::setPatch(int voice, int patch) { if ((patch < 0) || ((uint)patch >= _patches.size())) { - // This happens with songs 1 and 23 in PQ2. Song 1 (the title song) uses an invalid - // instrument 80, and song 23 (car horn when the car runs over you at the airport, - // rooms 14/15) an invalid instrument 89. These are probably leftovers from MT32. - warning("ADLIB: Invalid patch %i requested (patch.003 contains %d instruments)", - patch, _patches.size()); + warning("ADLIB: Invalid patch %i requested", patch); + // Substitute instrument 0 patch = 0; } @@ -760,10 +757,16 @@ bool MidiDriver_AdLib::loadResource(const byte *data, uint size) { for (int i = 0; i < 48; i++) loadInstrument(data + (28 * i)); - if (size == 2690) { + if (size == 1344) { + byte dummy[28] = {0}; + + // Only 48 instruments, add dummies + for (int i = 0; i < 48; i++) + loadInstrument(dummy); + } else if (size == 2690) { for (int i = 48; i < 96; i++) loadInstrument(data + 2 + (28 * i)); - } else if (size == 5382) { + } else { // SCI1.1 and later for (int i = 48; i < 190; i++) loadInstrument(data + (28 * i)); -- cgit v1.2.3