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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Jun 19 22:00:32 CEST 2010


Revision: 50060
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50060&view=rev
Author:   m_kiewitz
Date:     2010-06-19 20:00:32 +0000 (Sat, 19 Jun 2010)

Log Message:
-----------
SCI: stopping scripts from sending to unused channels manually (fixes sq1vga)

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

Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-06-19 19:47:22 UTC (rev 50059)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-06-19 20:00:32 UTC (rev 50060)
@@ -144,6 +144,20 @@
 	}
 }
 
+// this is used for scripts sending direct midi commands to us. we verify in that case that the channel is actually
+//  used
+void MidiParser_SCI::sendManuallyToDriver(uint32 b) {
+	byte midiChannel = b & 0xf;
+
+	if (!_channelUsed[midiChannel]) {
+		// scripts trying to send to unused channel
+		//  this happens at least in sq1vga right at the start, it's a script issue
+		return;
+	}
+
+	sendToDriver(b);
+}
+
 void MidiParser_SCI::sendToDriver(uint32 b) {
 	byte midiChannel = b & 0xf;
 
@@ -161,11 +175,7 @@
 		return;
 	// Channel remapping
 	int16 realChannel = _channelRemap[midiChannel];
-	if (realChannel == -1) {
-		// FIXME: Happens in SQ1VGA when the game starts
-		warning("Attempt to send to uninitialized channel %d", midiChannel);
-		return;
-	}
+	assert(realChannel != -1);
 
 	b = (b & 0xFFFFFFF0) | realChannel;
 	_driver->send(b);

Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.h
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.h	2010-06-19 19:47:22 UTC (rev 50059)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.h	2010-06-19 20:00:32 UTC (rev 50060)
@@ -80,6 +80,7 @@
 	void sendToDriver(byte status, byte firstOp, byte secondOp) {
 		sendToDriver(status | ((uint32)firstOp << 8) | ((uint32)secondOp << 16));
 	}
+	void sendManuallyToDriver(uint32 b);
 
 protected:
 	void parseNextEvent(EventInfo &info);

Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp	2010-06-19 19:47:22 UTC (rev 50059)
+++ scummvm/trunk/engines/sci/sound/music.cpp	2010-06-19 20:00:32 UTC (rev 50060)
@@ -463,7 +463,7 @@
 
 void SciMusic::sendMidiCommand(MusicEntry *pSnd, uint32 cmd) {
 	if (pSnd->pMidiParser)
-		pSnd->pMidiParser->sendToDriver(cmd);
+		pSnd->pMidiParser->sendManuallyToDriver(cmd);
 	else
 		error("tried to cmdSendMidi on non midi slot (%04x:%04x)", PRINT_REG(pSnd->soundObj));
 }


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