aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/midiparser_s1d.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2015-06-21 00:45:45 +0200
committerMartin Kiewitz2015-06-21 00:45:45 +0200
commitd24c68c739dadd1404d937f9a21d93e8841a09ee (patch)
treebe811b96fb4e31b732709d0741cde6be120c1688 /engines/agos/midiparser_s1d.cpp
parent4a88c69b5dedc4acac8bcb9609c1cf44c497c4ff (diff)
downloadscummvm-rg350-d24c68c739dadd1404d937f9a21d93e8841a09ee.tar.gz
scummvm-rg350-d24c68c739dadd1404d937f9a21d93e8841a09ee.tar.bz2
scummvm-rg350-d24c68c739dadd1404d937f9a21d93e8841a09ee.zip
AGOS: implement Accolade AdLib + MT32 music drivers
- both known variants are supported (INSTR.DAT + MUSIC.DRV) - INSTR.DAT/MUSIC.DRV holds channel mapping, instrument mapping, etc. - fixed bug inside S1D MidiParser, that ruined some instrument changes 0xFC header was seen as 2 byte header, but it's 4 bytes in Elvira 2 and 5 bytes in Waxworks / Simon 1 demo - dynamic channel allocation for the MUSIC.DRV adlib driver is not implemented atm, simply because at least the demos of Waxworks and Simon 1 do not use this feature - sound effects of Waxworks are not implemented atm - note: the game "Altered Destiny" uses Accolade INSTR.DAT variant too
Diffstat (limited to 'engines/agos/midiparser_s1d.cpp')
-rw-r--r--engines/agos/midiparser_s1d.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/engines/agos/midiparser_s1d.cpp b/engines/agos/midiparser_s1d.cpp
index c2c08bf451..f07ef5be41 100644
--- a/engines/agos/midiparser_s1d.cpp
+++ b/engines/agos/midiparser_s1d.cpp
@@ -181,10 +181,22 @@ bool MidiParser_S1D::loadMusic(byte *data, uint32 size) {
// The original actually just ignores the first two bytes.
byte *pos = data;
- if (*(pos++) != 0xFC)
- debug(1, "Expected 0xFC header but found 0x%02X instead", (int) *pos);
-
- pos += 1;
+ if (*pos == 0xFC) {
+ // SysEx found right at the start
+ // this seems to happen since Elvira 2, we currently ignore it
+ // the original Accolade code does see 0xFC as end of track, which means there must have been a change
+ if ((pos[1] == 0x29) && (pos[2] == 0x07) && (pos[3] == 0x01)) {
+ // Security check
+ // Last byte is either 0x00 or 0x01. Maybe some looping indicator?
+ pos += 5; // Waxworks / Simon 1 demo
+ } else {
+ if ((pos[1] == 0x04) && (pos[2] == 0x06) && (pos[3] == 06)) {
+ pos += 4; // Elvira 2
+ } else {
+ warning("0xFC startup without proper signature");
+ }
+ }
+ }
// And now we're at the actual data. Only one track.
_numTracks = 1;