[Scummvm-git-logs] scummvm master -> 2e65886f65e054c382a202a224b6a5a4876bd18a

bluegr bluegr at gmail.com
Sun Aug 30 10:37:43 UTC 2020


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

Summary:
648d669c2d SCI: Properly handle alternative MIDI sound effects for SCI01/CI1 games
ef6f8c008f SCI: Ignore digital channel data in midiMixChannels(), and remove some GOTOs
2e65886f65 STARTREK: Fix infinite loop while reading some RDF files


Commit: 648d669c2dd3ddeaeb3d2ab4d3480ae08be85dd4
    https://github.com/scummvm/scummvm/commit/648d669c2dd3ddeaeb3d2ab4d3480ae08be85dd4
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2020-08-30T13:37:19+03:00

Commit Message:
SCI: Properly handle alternative MIDI sound effects for SCI01/CI1 games

SCI01/SCI1 games have sound effects in SND files, which contain both
digital sounds and their alternative MIDI counterparts. Allow the user
to listen to the alternative MIDI counterparts by unchecking the
"Prefer digital sound effects" checkbox, like with other SCI versions.
Fixes bug #11587

Changed paths:
    engines/sci/sound/music.cpp


diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 8a24429b30..a624e4040b 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -393,7 +393,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
 				}
 			}
 		} else
-			playSample = (track->digitalChannelNr != -1);
+			playSample = (track->digitalChannelNr != -1 && (_useDigitalSFX || track->channelCount == 1));
 
 		// Play digital sample
 		if (playSample) {


Commit: ef6f8c008f40b505f51aca85a021989c3555658c
    https://github.com/scummvm/scummvm/commit/ef6f8c008f40b505f51aca85a021989c3555658c
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2020-08-30T13:37:19+03:00

Commit Message:
SCI: Ignore digital channel data in midiMixChannels(), and remove some GOTOs

These are found at the end of SCI01/SCI1 SND files with sound effects

Changed paths:
    engines/sci/sound/midiparser_sci.cpp


diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp
index c3b967414d..38e7643bab 100644
--- a/engines/sci/sound/midiparser_sci.cpp
+++ b/engines/sci/sound/midiparser_sci.cpp
@@ -158,6 +158,9 @@ void MidiParser_SCI::midiMixChannels() {
 		_track->channels[i].time = 0;
 		_track->channels[i].prev = 0;
 		_track->channels[i].curPos = 0;
+		// Ignore the digital channel data, if it exists - it's not MIDI data
+		if (i == _track->digitalChannelNr)
+			continue;
 		totalSize += _track->channels[i].data.size();
 	}
 
@@ -168,11 +171,12 @@ void MidiParser_SCI::midiMixChannels() {
 	byte midiCommand = 0, midiParam, globalPrev = 0;
 	long newDelta;
 	SoundResource::Channel *channel;
+	bool breakOut = false;
 
 	while ((channelNr = midiGetNextChannel(ticker)) != 0xFF) { // there is still an active channel
 		channel = &_track->channels[channelNr];
 		if (!validateNextRead(channel))
-			goto end;
+			break;
 		curDelta = channel->data[channel->curPos++];
 		channel->time += (curDelta == 0xF8 ? 240 : curDelta); // when the command is supposed to occur
 		if (curDelta == 0xF8)
@@ -180,8 +184,10 @@ void MidiParser_SCI::midiMixChannels() {
 		newDelta = channel->time - ticker;
 		ticker += newDelta;
 
+		if (channelNr == _track->digitalChannelNr)
+			continue;
 		if (!validateNextRead(channel))
-			goto end;
+			break;
 		midiCommand = channel->data[channel->curPos++];
 		if (midiCommand != kEndOfTrack) {
 			// Write delta
@@ -191,13 +197,16 @@ void MidiParser_SCI::midiMixChannels() {
 			}
 			*outData++ = (byte)newDelta;
 		}
+
 		// Write command
 		switch (midiCommand) {
 		case 0xF0: // sysEx
 			*outData++ = midiCommand;
 			do {
-				if (!validateNextRead(channel))
-					goto end;
+				if (!validateNextRead(channel)) {
+					breakOut = true;
+					break;
+				}
 				midiParam = channel->data[channel->curPos++];
 				*outData++ = midiParam;
 			} while (midiParam != 0xF7);
@@ -207,8 +216,10 @@ void MidiParser_SCI::midiMixChannels() {
 			break;
 		default: // MIDI command
 			if (midiCommand & 0x80) {
-				if (!validateNextRead(channel))
-					goto end;
+				if (!validateNextRead(channel)) {
+					breakOut = true;
+					break;
+				}
 				midiParam = channel->data[channel->curPos++];
 			} else {// running status
 				midiParam = midiCommand;
@@ -223,16 +234,20 @@ void MidiParser_SCI::midiMixChannels() {
 				*outData++ = midiCommand;
 			*outData++ = midiParam;
 			if (nMidiParams[(midiCommand >> 4) - 8] == 2) {
-				if (!validateNextRead(channel))
-					goto end;
+				if (!validateNextRead(channel)) {
+					breakOut = true;
+					break;
+				}
 				*outData++ = channel->data[channel->curPos++];
 			}
 			channel->prev = midiCommand;
 			globalPrev = midiCommand;
 		}
+
+		if (breakOut)
+			break;
 	}
 
-end:
 	// Insert stop event
 	*outData++ = 0;    // Delta
 	*outData++ = 0xFF; // Meta event


Commit: 2e65886f65e054c382a202a224b6a5a4876bd18a
    https://github.com/scummvm/scummvm/commit/2e65886f65e054c382a202a224b6a5a4876bd18a
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2020-08-30T13:37:20+03:00

Commit Message:
STARTREK: Fix infinite loop while reading some RDF files

Changed paths:
    engines/startrek/room.cpp


diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp
index 45fd2b2d84..48c75e78b7 100644
--- a/engines/startrek/room.cpp
+++ b/engines/startrek/room.cpp
@@ -290,7 +290,7 @@ void Room::loadOtherRoomMessages() {
 
 	while (offset < endOffset) {
 		uint16 nextOffset = readRdfWord(offset + 4);
-		if (nextOffset >= endOffset)
+		if (nextOffset >= endOffset || offset >= nextOffset)
 			break;
 		
 		while (offset < nextOffset) {




More information about the Scummvm-git-logs mailing list