aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorJamieson Christian2003-06-01 03:06:10 +0000
committerJamieson Christian2003-06-01 03:06:10 +0000
commit2ef36da81971f76a54a85bd620c7e07567cf5355 (patch)
tree1205f6e6fe66f2c133261feae2953126a6fedc2d /scumm
parent6f9af8707e54fe594f44072ef71ce02d5b03c6bf (diff)
downloadscummvm-rg350-2ef36da81971f76a54a85bd620c7e07567cf5355.tar.gz
scummvm-rg350-2ef36da81971f76a54a85bd620c7e07567cf5355.tar.bz2
scummvm-rg350-2ef36da81971f76a54a85bd620c7e07567cf5355.zip
Fixed checksum error
svn-id: r8216
Diffstat (limited to 'scumm')
-rw-r--r--scumm/instrument.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/scumm/instrument.cpp b/scumm/instrument.cpp
index c845ab8ec2..dbe0d0eae0 100644
--- a/scumm/instrument.cpp
+++ b/scumm/instrument.cpp
@@ -421,10 +421,21 @@ void Instrument_Roland::send (MidiChannel *mc) {
if (_native_mt32) {
// _instrument.device_id = mc->getNumber();
_instrument.device_id = 0x10;
+
+ // Remap instrument to appropriate address space.
int address = 0x010000 + mc->getNumber() * 246;
_instrument.address[0] = (address >> 14) & 0x7F;
_instrument.address[1] = (address >> 7) & 0x7F;
_instrument.address[2] = (address ) & 0x7F;
+
+ // Recompute checksum.
+ byte checksum = 0;
+ byte *ptr = (byte *) &_instrument + 4;
+ int i;
+ for (i = 4; i < sizeof (_instrument) - 1; ++i)
+ checksum -= *ptr++;
+ _instrument.checksum = checksum & 0x7F;
+
mc->device()->sysEx ((byte *) &_instrument, sizeof (_instrument));
} else {
// Convert to a GM program change.