[Scummvm-cvs-logs] scummvm master -> 371d5e1d904898a01292db26703d38ee90558bbd

m-kiewitz m_kiewitz at users.sourceforge.net
Sun Jun 21 11:21:07 CEST 2015


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:
155d554183 AGOS: MidiParser_S1D: do proper skipping of SysEx
371d5e1d90 Merge branch 'master' of github.com:scummvm/scummvm


Commit: 155d5541834d220a7b7fe8b73dcf12c65dff6cc3
    https://github.com/scummvm/scummvm/commit/155d5541834d220a7b7fe8b73dcf12c65dff6cc3
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-06-21T11:19:28+02:00

Commit Message:
AGOS: MidiParser_S1D: do proper skipping of SysEx

figured out the code that the original interpreters used to
skip over the header-SysEx

Changed paths:
    engines/agos/midiparser_s1d.cpp



diff --git a/engines/agos/midiparser_s1d.cpp b/engines/agos/midiparser_s1d.cpp
index f07ef5b..7b9a058 100644
--- a/engines/agos/midiparser_s1d.cpp
+++ b/engines/agos/midiparser_s1d.cpp
@@ -179,22 +179,41 @@ void MidiParser_S1D::parseNextEvent(EventInfo &info) {
 bool MidiParser_S1D::loadMusic(byte *data, uint32 size) {
 	unloadMusic();
 
+	if (!size)
+		return false;
+
 	// The original actually just ignores the first two bytes.
 	byte *pos = data;
 	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
+		// this seems to happen since Elvira 2, we ignore it
+		// 3rd byte after the SysEx seems to be saved into a global
+
+		// We expect at least 4 bytes in total
+		if (size < 4)
+			return false;
+
+		byte skipOffset = pos[2]; // get second byte after the SysEx
+		// pos[1] seems to have been ignored
+		// pos[3] is saved into a global inside the original interpreters
+
+		// Waxworks + Simon 1 demo typical header is:
+		//  0xFC 0x29 0x07 0x01 [0x00/0x01]
+		// Elvira 2 typical header is:
+		//  0xFC 0x04 0x06 0x06
+
+		if (skipOffset >= 6) {
+			// should be at least 6, so that we skip over the 2 size bytes and the
+			// smallest SysEx possible
+			skipOffset -= 2; // 2 size bytes were already read by previous code outside of this method
+
+			if (size <= skipOffset) // Skip to the end of file? -> something is not correct
+				return false;
+
+			// Do skip over the bytes
+			pos += skipOffset;
 		} else {
-			if ((pos[1] == 0x04) && (pos[2] == 0x06) && (pos[3] == 06)) {
-				pos += 4; // Elvira 2
-			} else {
-				warning("0xFC startup without proper signature");
-			}
+			warning("MidiParser_S1D: unexpected skip offset in music file");
 		}
 	}
 


Commit: 371d5e1d904898a01292db26703d38ee90558bbd
    https://github.com/scummvm/scummvm/commit/371d5e1d904898a01292db26703d38ee90558bbd
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-06-21T11:20:01+02:00

Commit Message:
Merge branch 'master' of github.com:scummvm/scummvm

Changed paths:
    engines/agos/sound.cpp
    engines/agos/zones.cpp









More information about the Scummvm-git-logs mailing list