[Scummvm-git-logs] scummvm master -> 7cec1ed3a41a5407614d4f3169ba164753f62fc8

sluicebox noreply at scummvm.org
Mon Oct 30 04:08:11 UTC 2023


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9fa0476b47 SCI: MidiPlayer_Midi formatting
7cec1ed3a4 SCI: Fix KQ4/LSL2 MT32 SysEx message text


Commit: 9fa0476b47aca5405d32510248b7f0c0e57c86fe
    https://github.com/scummvm/scummvm/commit/9fa0476b47aca5405d32510248b7f0c0e57c86fe
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-10-29T21:06:28-07:00

Commit Message:
SCI: MidiPlayer_Midi formatting

Changed paths:
    engines/sci/sound/drivers/midi.cpp


diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index 5a5dea5d06a..f4dcf3dd348 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -230,7 +230,17 @@ private:
 	const char *_missingFiles;
 };
 
-MidiPlayer_Midi::MidiPlayer_Midi(SciVersion version) : MidiPlayer(version), _playSwitch(true), _masterVolume(15), _mt32Type(kMt32TypeNone), _mt32LCDSize(20), _hasReverb(false), _defaultReverb(-1), _useMT32Track(true), _missingFiles(nullptr) {
+MidiPlayer_Midi::MidiPlayer_Midi(SciVersion version) : 
+	MidiPlayer(version),
+	_playSwitch(true),
+	_masterVolume(15),
+	_mt32Type(kMt32TypeNone),
+	_mt32LCDSize(20),
+	_hasReverb(false),
+	_defaultReverb(-1),
+	_useMT32Track(true),
+	_missingFiles(nullptr) {
+
 	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI);
 	_driver = MidiDriver::createMidi(dev);
 


Commit: 7cec1ed3a41a5407614d4f3169ba164753f62fc8
    https://github.com/scummvm/scummvm/commit/7cec1ed3a41a5407614d4f3169ba164753f62fc8
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-10-29T21:06:29-07:00

Commit Message:
SCI: Fix KQ4/LSL2 MT32 SysEx message text

The two messages displayed on the MT32 at the start of KQ4 and LSL2
were being shown in the wrong order, because these games have a
different patch resource format.

Early versions of these games were not affected by thus bug, because
their messages were not stored in patch files.

Big thanks to @PickledDog for testing the original behavior on real
hardware, and @MusicallyInspired for consulting on the patch format.

Changed paths:
    engines/sci/sound/drivers/midi.cpp


diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index f4dcf3dd348..21b765a58f0 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -684,8 +684,8 @@ void MidiPlayer_Midi::sendMt32SysEx(const uint32 addr, const SciSpan<const byte>
 
 void MidiPlayer_Midi::readMt32Patch(const SciSpan<const byte> &data) {
 	// MT-32 patch contents:
-	// - 0-19        after-SysEx message
-	// - 20-39       before-SysEx message
+	// - 0-19        after-SysEx message   (KQ4/LSL2: before)
+	// - 20-39       before-SysEx message  (KQ4/LSL2: after)
 	// - 40-59       goodbye SysEx message
 	// - 60-61       volume
 	// - 62          reverb
@@ -703,12 +703,28 @@ void MidiPlayer_Midi::readMt32Patch(const SciSpan<const byte> &data) {
 
 	Common::MemoryReadStream stream(data.toStream());
 
+	// before-SysEx and after-SysEx texts swapped positions after KQ4 and LSL2.
+	uint beforeTextPos;
+	uint afterTextPos;
+	switch (g_sci->getGameId()) {
+	case GID_KQ4:
+	case GID_LSL2:
+		beforeTextPos = 0;
+		afterTextPos = _mt32LCDSize;
+		break;
+	default:
+		beforeTextPos = _mt32LCDSize;
+		afterTextPos = 0;
+		break;
+	}
+
 	// Send before-SysEx text
-	stream.seek(_mt32LCDSize);
+	stream.seek(beforeTextPos);
 	sendMt32SysEx(0x200000, stream, _mt32LCDSize);
 
 	// Save goodbye message
 	assert(sizeof(_goodbyeMsg) >= _mt32LCDSize);
+	stream.seek(_mt32LCDSize * 2);
 	stream.read(_goodbyeMsg, _mt32LCDSize);
 
 	const uint8 volume = MIN<uint16>(stream.readUint16LE(), 100);
@@ -755,7 +771,7 @@ void MidiPlayer_Midi::readMt32Patch(const SciSpan<const byte> &data) {
 	}
 
 	// Send after-SysEx text
-	stream.seek(0);
+	stream.seek(afterTextPos);
 	sendMt32SysEx(0x200000, stream, _mt32LCDSize);
 
 	if (_mt32Type != kMt32TypeD110) {




More information about the Scummvm-git-logs mailing list