[Scummvm-cvs-logs] SF.net SVN: scummvm:[52195] scummvm/trunk/engines/sci/sound

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Aug 18 22:00:19 CEST 2010


Revision: 52195
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52195&view=rev
Author:   thebluegr
Date:     2010-08-18 20:00:18 +0000 (Wed, 18 Aug 2010)

Log Message:
-----------
SCI: Only perform queuing of song signals for SCI0, where we handle the updating of song queues ourselves. Newer games handle signaling on their own, thus we shouldn't interfere with this. Fixes bug #3045913 - "PHARKAS CD: Crash at the start menu" (a regression from rev #52043)

Revision Links:
--------------
    http://scummvm.svn.sourceforge.net/scummvm/?rev=52043&view=rev

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
    scummvm/trunk/engines/sci/sound/music.cpp
    scummvm/trunk/engines/sci/sound/music.h

Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-08-18 17:56:14 UTC (rev 52194)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-08-18 20:00:18 UTC (rev 52195)
@@ -445,12 +445,8 @@
 	}
 	if (_signalSet) {
 		_signalSet = false;
-		if (!_pSnd->signal) {
-			_pSnd->signal = _signalToSet;
-		} else {
-			// signal already set and waiting for getting to scripts, queue new one
-			_pSnd->signalQueue.push_back(_signalToSet);
-		}
+		_pSnd->setSignal(_signalToSet);
+
 		debugC(4, kDebugLevelSound, "signal %04x", _signalToSet);
 	}
 
@@ -613,12 +609,7 @@
 					jumpToTick(_loopTick);
 				} else {
 					_pSnd->status = kSoundStopped;
-					if (!_pSnd->signal) {
-						_pSnd->signal = SIGNAL_OFFSET;
-					} else {
-						// signal already set and waiting for getting to scripts, queue new one
-						_pSnd->signalQueue.push_back(SIGNAL_OFFSET);
-					}
+					_pSnd->setSignal(SIGNAL_OFFSET);
 
 					debugC(4, kDebugLevelSound, "signal EOT");
 				}

Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp	2010-08-18 17:56:14 UTC (rev 52194)
+++ scummvm/trunk/engines/sci/sound/music.cpp	2010-08-18 20:00:18 UTC (rev 52195)
@@ -30,6 +30,7 @@
 #include "sci/sci.h"
 #include "sci/console.h"
 #include "sci/resource.h"
+#include "sci/engine/features.h"
 #include "sci/engine/kernel.h"
 #include "sci/engine/state.h"
 #include "sci/sound/midiparser_sci.h"
@@ -681,4 +682,23 @@
 	}
 }
 
+void MusicEntry::setSignal(int newSignal) {
+	// For SCI0, we cache the signals to set, as some songs might
+	// update their signal faster than kGetEvent is called (which is where
+	// we manually invoke kDoSoundUpdateCues for SCI0 games). SCI01 and
+	// newer handle signalling inside kDoSoundUpdateCues. Refer to bug #3042981
+	if (g_sci->_features->detectDoSoundType() <= SCI_VERSION_0_LATE) {
+		if (!signal) {
+			signal = newSignal;
+		} else {
+			// signal already set and waiting for getting to scripts, queue new one
+			signalQueue.push_back(newSignal);
+		}
+	} else {
+		// Set the signal directly for newer games, otherwise the sound
+		// object might be deleted already later on (refer to bug #3045913)
+		signal = newSignal;
+	}
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/sound/music.h
===================================================================
--- scummvm/trunk/engines/sci/sound/music.h	2010-08-18 17:56:14 UTC (rev 52194)
+++ scummvm/trunk/engines/sci/sound/music.h	2010-08-18 20:00:18 UTC (rev 52195)
@@ -109,6 +109,7 @@
 
 	void doFade();
 	void onTimer();
+	void setSignal(int signal);
 
 	virtual void saveLoadWithSerializer(Common::Serializer &ser);
 };


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list