diff options
author | Martin Kiewitz | 2015-06-30 16:49:47 +0200 |
---|---|---|
committer | Martin Kiewitz | 2015-06-30 16:49:47 +0200 |
commit | 7c3574ed52f8cb88eec25b26d6a1fe2750fc8e77 (patch) | |
tree | 466c3cefea9c2dd2d6c284befc4c35d2f60ef42a | |
parent | bf180101a696b5def2335ad296dc7949969ebd99 (diff) | |
download | scummvm-rg350-7c3574ed52f8cb88eec25b26d6a1fe2750fc8e77.tar.gz scummvm-rg350-7c3574ed52f8cb88eec25b26d6a1fe2750fc8e77.tar.bz2 scummvm-rg350-7c3574ed52f8cb88eec25b26d6a1fe2750fc8e77.zip |
AUDIO: Miles Audio MT32: adjust sysex target address
sysex may not contain bytes above or equal 0x80, so we adjust
the address accordingly. fixes weird sound getting played
during 7th guest MT32 setup screen
-rw-r--r-- | audio/miles_mt32.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/audio/miles_mt32.cpp b/audio/miles_mt32.cpp index d28006e772..3acd2a91bf 100644 --- a/audio/miles_mt32.cpp +++ b/audio/miles_mt32.cpp @@ -301,6 +301,17 @@ void MidiDriver_Miles_MT32::MT32SysEx(const uint32 targetAddress, const byte *da sysExMessage[5] = (targetAddress >> 8) & 0xFF; sysExMessage[6] = targetAddress & 0xFF; + // Adjust address in case it's needed + if (sysExMessage[6] >= 0x80) { + sysExMessage[5]++; + sysExMessage[6] -= 0x80; + } + if (sysExMessage[5] >= 0x80) { + sysExMessage[4]++; + sysExMessage[5] -= 0x80; + } + assert(sysExMessage[4] < 0x80); // security check + sysExChecksum -= sysExMessage[4]; sysExChecksum -= sysExMessage[5]; sysExChecksum -= sysExMessage[6]; @@ -312,6 +323,7 @@ void MidiDriver_Miles_MT32::MT32SysEx(const uint32 targetAddress, const byte *da break; // Message done assert(sysExPos < sizeof(sysExMessage)); + assert(sysExByte < 0x80); // security check sysExMessage[sysExPos++] = sysExByte; sysExChecksum -= sysExByte; } |