From 5d378574a438f7b7f60fd01b88dd58e05c0bcd9b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 18 Jun 2010 15:18:14 +0000 Subject: Fixed show_instruments to ignore instruments in Sierra's special MIDI channel 15, and updated the comment regarding PQ2 accordingly (it only has 2 incorrect instruments) svn-id: r50021 --- engines/sci/console.cpp | 24 +++++++++++++----------- engines/sci/sound/drivers/adlib.cpp | 11 ++++------- 2 files changed, 17 insertions(+), 18 deletions(-) (limited to 'engines') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index b46e03830d..1fdcd579c0 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -919,19 +919,21 @@ bool Console::cmdShowInstruments(int argc, const char **argv) { prevEvent = curEvent; command = curEvent >> 4; + byte channel; + switch (command) { case 0xC: // program change - { - //byte channel = curEvent & 0x0F; - byte instrument = *channelData++; - if (!firstOneShown) - firstOneShown = true; - else - DebugPrintf(","); - - DebugPrintf(" %d", instrument); - instruments[instrument]++; - instrumentsSongs[instrument][itr->getNumber()] = true; + channel = curEvent & 0x0F; + if (channel != 15) { // SCI special + byte instrument = *channelData++; + if (!firstOneShown) + firstOneShown = true; + else + DebugPrintf(","); + + DebugPrintf(" %d", instrument); + instruments[instrument]++; + instrumentsSongs[instrument][itr->getNumber()] = true; } break; case 0xD: diff --git a/engines/sci/sound/drivers/adlib.cpp b/engines/sci/sound/drivers/adlib.cpp index d0ca00fe0f..c2cc49e336 100644 --- a/engines/sci/sound/drivers/adlib.cpp +++ b/engines/sci/sound/drivers/adlib.cpp @@ -703,13 +703,9 @@ 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 a lot at least in PQ2. This game has a small patch.003 (1344 bytes), - // containing 48 instruments. However it has several songs which use instruments - // not specified in that patch (namely, songs 1, 3, 5, 9, 15, 16, 17, 23, 25, 27, - // 29, 32, 36, 38, 44, 45, 46 all use instruments not specified in patch.003). - // These were probably written for MT32. These warnings in PQ2 can probably go away - // if a bigger patch.003 file is used (one that contains all the instruments used - // by the songs, i.e. 5382 bytes) + // 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()); patch = 0; @@ -768,6 +764,7 @@ bool MidiDriver_AdLib::loadResource(const byte *data, uint size) { for (int i = 48; i < 96; i++) loadInstrument(data + 2 + (28 * i)); } else if (size == 5382) { + // SCI1.1 and later for (int i = 48; i < 190; i++) loadInstrument(data + (28 * i)); _rhythmKeyMap = new byte[kRhythmKeys]; -- cgit v1.2.3