[Scummvm-cvs-logs] SF.net SVN: scummvm:[46561] scummvm/trunk/engines/sci/resource.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Dec 25 19:25:15 CET 2009


Revision: 46561
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46561&view=rev
Author:   m_kiewitz
Date:     2009-12-25 18:25:15 +0000 (Fri, 25 Dec 2009)

Log Message:
-----------
SCI/newmusic: support for early sound resource format, early kq4 version now gets music, is not filtered yet

Modified Paths:
--------------
    scummvm/trunk/engines/sci/resource.cpp

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2009-12-25 18:15:16 UTC (rev 46560)
+++ scummvm/trunk/engines/sci/resource.cpp	2009-12-25 18:25:15 UTC (rev 46561)
@@ -1822,6 +1822,7 @@
 	switch (_soundVersion) {
 	case SCI_VERSION_0_EARLY:
 	case SCI_VERSION_0_LATE:
+		// SCI0 only has a header of 0x11/0x21 byte length and the actual miditrack follows afterwards
 		_trackCount = 1;
 		_tracks = new Track[_trackCount];
 		_tracks->nDigital = 0xFF;
@@ -1829,8 +1830,16 @@
 		_tracks->channelCount = 1;
 		_tracks->channels = new Channel[_tracks->channelCount];
 		channel = _tracks->channels;
-		channel->data = resource->data + 0x21;
-		channel->size = resource->size - 0x21;
+		switch (_soundVersion) {
+		case SCI_VERSION_0_EARLY:
+			channel->data = resource->data + 0x11;
+			channel->size = resource->size - 0x11;
+			break;
+		case SCI_VERSION_0_LATE:
+			channel->data = resource->data + 0x21;
+			channel->size = resource->size - 0x21;
+			break;
+		}
 		channel->number = 0;
 		channel->poly = 0;
 		channel->time = channel->prev = 0;
@@ -1850,7 +1859,6 @@
 		_tracks = new Track[_trackCount];
 		data = resource->data;
 		for (trackNr = 0; trackNr < _trackCount; trackNr++) {
-			// SCI01/SCI1/SCI11
 			// Track info starts with track-type:BYTE
 			// Then channel-information gets appeneded Unknown:WORD, ChannelOffset:WORD, ChannelSize:WORD
 			// 0xFF:BYTE as terminator to end that track and begin with another track-type
@@ -1932,7 +1940,12 @@
 	byte *data = _innerResource->data;
 	int channelMask = 0;
 
-	if (_soundVersion <= SCI_VERSION_0_LATE) {
+	switch (_soundVersion) {
+	case SCI_VERSION_0_EARLY:
+		channelMask = 0xFFFF;
+		break;
+
+	case SCI_VERSION_0_LATE:
 		data++; // Skip over digital sample flag
 		for (int channelNr = 0; channelNr < 16; channelNr++) {
 			data++;
@@ -1945,6 +1958,7 @@
 		}
 		// Play channel 15 anytime (control channel)
 		channelMask |= 0x8000;
+		break;
 	}
 	return channelMask;
 }


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