[Scummvm-git-logs] scummvm master -> fce453dc43bf1029c14923ee927cfaba1b23a34c

athrxx athrxx at scummvm.org
Wed Jul 24 15:47:59 CEST 2019


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

Summary:
fce453dc43 SCI: (CMS sound driver) - handle invalid program changes


Commit: fce453dc43bf1029c14923ee927cfaba1b23a34c
    https://github.com/scummvm/scummvm/commit/fce453dc43bf1029c14923ee927cfaba1b23a34c
Author: athrxx (athrxx at scummvm.org)
Date: 2019-07-24T15:47:06+02:00

Commit Message:
SCI: (CMS sound driver) - handle invalid program changes

(This triggered an assert in PQ2 at the airport. I've added a warning instead, since the original driver has no handling for that sort of thing. Invalid programs will simply point into invalid memory blocks)

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


diff --git a/engines/sci/sound/drivers/cms.cpp b/engines/sci/sound/drivers/cms.cpp
index 750de85..0f79251 100644
--- a/engines/sci/sound/drivers/cms.cpp
+++ b/engines/sci/sound/drivers/cms.cpp
@@ -334,8 +334,14 @@ void CMSVoice_V0::stop() {
 }
 
 void CMSVoice_V0::programChange(int program) {
-	assert(program < 128);
-	if (program == 127) {
+	if (program > 127) {
+		// I encountered this with PQ2 at the airport (program 204 sent on part 13). The original driver does not really handle that.
+		// In fact, it even interprets this value as signed so it will not point into the instrument data buffer, but into a random
+		// invalid memory location (in the case of 204 it will read a value of 8 from the device init data array). Since there seems
+		// to be no effect on the sound I don't emulate this (mis)behaviour. 
+		warning("CMSVoice_V0::programChange:: Invalid program '%d' requested on midi channel '%d'", program, _assign);
+		program = 0;
+	} else if (program == 127) {
 		// This seems to replace the start of track offset with the current position so that 0xFC (kEndOfTrack)
 		// midi events would not reset the track to the start, but to the current position instead. This cannot
 		// be handled here. All versions of the SCI0 driver that I have seen so far do this. Still, I somehow





More information about the Scummvm-git-logs mailing list