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
This commit is contained in:
Filippos Karapetis 2010-06-18 15:18:14 +00:00
parent 874eeb2370
commit 5d378574a4
2 changed files with 16 additions and 17 deletions

View File

@ -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(",");
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;
DebugPrintf(" %d", instrument);
instruments[instrument]++;
instrumentsSongs[instrument][itr->getNumber()] = true;
}
break;
case 0xD:

View File

@ -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];