Committed my fix for bug #1662549 ("SCUMM: MIDI music is broken"). Apparently,

'len' is now one less than it used to in sysexHandler_Scumm(). Let's hope I
changed all the cases that needed changing, and nothing else...

svn-id: r25671
This commit is contained in:
Torbjörn Andersson 2007-02-18 09:10:50 +00:00
parent 4e6e57eb53
commit 1a6361038e

View File

@ -106,11 +106,11 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
++p; // Skip hardware type ++p; // Skip hardware type
part = player->getPart(a); part = player->getPart(a);
if (part) { if (part) {
if (len == 63) { if (len == 62) {
player->decode_sysex_bytes(p, buf, len - 3); player->decode_sysex_bytes(p, buf, len - 2);
part->set_instrument((byte *)buf); part->set_instrument((byte *)buf);
} else { } else {
// SPK tracks have len == 49 here, and are not supported // SPK tracks have len == 48 here, and are not supported
part->programChange(254); // Must be invalid, but not 255 (which is reserved) part->programChange(254); // Must be invalid, but not 255 (which is reserved)
} }
} }
@ -119,14 +119,14 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
case 17: // Adlib instrument definition(Global) case 17: // Adlib instrument definition(Global)
p += 2; // Skip hardware type and... whatever came right before it p += 2; // Skip hardware type and... whatever came right before it
a = *p++; a = *p++;
player->decode_sysex_bytes(p, buf, len - 4); player->decode_sysex_bytes(p, buf, len - 3);
se->setGlobalAdlibInstrument(a, buf); se->setGlobalAdlibInstrument(a, buf);
break; break;
case 33: // Parameter adjust case 33: // Parameter adjust
a = *p++ & 0x0F; a = *p++ & 0x0F;
++p; // Skip hardware type ++p; // Skip hardware type
player->decode_sysex_bytes(p, buf, len - 3); player->decode_sysex_bytes(p, buf, len - 2);
part = player->getPart(a); part = player->getPart(a);
if (part) if (part)
part->set_param(READ_BE_UINT16(buf), READ_BE_UINT16(buf + 2)); part->set_param(READ_BE_UINT16(buf), READ_BE_UINT16(buf + 2));
@ -135,49 +135,49 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
case 48: // Hook - jump case 48: // Hook - jump
if (player->_scanning) if (player->_scanning)
break; break;
player->decode_sysex_bytes(p + 1, buf, len - 2); player->decode_sysex_bytes(p + 1, buf, len - 1);
player->maybe_jump(buf[0], READ_BE_UINT16(buf + 1), READ_BE_UINT16(buf + 3), READ_BE_UINT16(buf + 5)); player->maybe_jump(buf[0], READ_BE_UINT16(buf + 1), READ_BE_UINT16(buf + 3), READ_BE_UINT16(buf + 5));
break; break;
case 49: // Hook - global transpose case 49: // Hook - global transpose
player->decode_sysex_bytes(p + 1, buf, len - 2); player->decode_sysex_bytes(p + 1, buf, len - 1);
player->maybe_set_transpose(buf); player->maybe_set_transpose(buf);
break; break;
case 50: // Hook - part on/off case 50: // Hook - part on/off
buf[0] = *p++ & 0x0F; buf[0] = *p++ & 0x0F;
player->decode_sysex_bytes(p, buf + 1, len - 2); player->decode_sysex_bytes(p, buf + 1, len - 1);
player->maybe_part_onoff(buf); player->maybe_part_onoff(buf);
break; break;
case 51: // Hook - set volume case 51: // Hook - set volume
buf[0] = *p++ & 0x0F; buf[0] = *p++ & 0x0F;
player->decode_sysex_bytes(p, buf + 1, len - 2); player->decode_sysex_bytes(p, buf + 1, len - 1);
player->maybe_set_volume(buf); player->maybe_set_volume(buf);
break; break;
case 52: // Hook - set program case 52: // Hook - set program
buf[0] = *p++ & 0x0F; buf[0] = *p++ & 0x0F;
player->decode_sysex_bytes(p, buf + 1, len - 2); player->decode_sysex_bytes(p, buf + 1, len - 1);
player->maybe_set_program(buf); player->maybe_set_program(buf);
break; break;
case 53: // Hook - set transpose case 53: // Hook - set transpose
buf[0] = *p++ & 0x0F; buf[0] = *p++ & 0x0F;
player->decode_sysex_bytes(p, buf + 1, len - 2); player->decode_sysex_bytes(p, buf + 1, len - 1);
player->maybe_set_transpose_part(buf); player->maybe_set_transpose_part(buf);
break; break;
case 64: // Marker case 64: // Marker
p++; p++;
len -= 2; len--;
while (len--) { while (len--) {
se->handle_marker(player->_id, *p++); se->handle_marker(player->_id, *p++);
} }
break; break;
case 80: // Loop case 80: // Loop
player->decode_sysex_bytes(p + 1, buf, len - 2); player->decode_sysex_bytes(p + 1, buf, len - 1);
player->setLoop player->setLoop
(READ_BE_UINT16(buf), READ_BE_UINT16(buf + 2), (READ_BE_UINT16(buf), READ_BE_UINT16(buf + 2),
READ_BE_UINT16(buf + 4), READ_BE_UINT16(buf + 6), READ_BE_UINT16(buf + 4), READ_BE_UINT16(buf + 6),