[Scummvm-cvs-logs] SF.net SVN: scummvm:[47528] scummvm/trunk/engines/mohawk

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Mon Jan 25 00:39:27 CET 2010


Revision: 47528
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47528&view=rev
Author:   mthreepwood
Date:     2010-01-24 23:39:27 +0000 (Sun, 24 Jan 2010)

Log Message:
-----------
Fill in the unknown values of the ADPC chunk in Mohawk sounds and update comments.

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/sound.cpp
    scummvm/trunk/engines/mohawk/sound.h

Modified: scummvm/trunk/engines/mohawk/sound.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/sound.cpp	2010-01-24 21:46:30 UTC (rev 47527)
+++ scummvm/trunk/engines/mohawk/sound.cpp	2010-01-24 23:39:27 UTC (rev 47528)
@@ -170,7 +170,7 @@
 	// Read the MThd Data
 	midi->read(midiData, 14);
 	
-	// Skip the unknown Prg# section
+	// TODO: Load patches from the Prg# section... skip it for now.
 	idTag = midi->readUint32BE();
 	assert(idTag == ID_PRG);
 	midi->skip(midi->readUint32BE());
@@ -363,20 +363,25 @@
 		case ID_ADPC:
 			debug(2, "Found Tag ADPC");
 			// Riven ADPCM Sound Only
-			// NOTE: This is completely useless for us. All of this
-			// is already in the ADPCM decoder in /sound.
+			// NOTE: We completely ignore the contents of this chunk on purpose. In the original
+			// engine this held the status for the ADPCM decoder, while in ScummVM we store this data
+			// in the ADPCM decoder itself. The code is here for reference only.
+
 			adpc.size = stream->readUint32BE();
-			adpc.u0 = stream->readUint16BE();
+			adpc.itemCount = stream->readUint16BE();
 			adpc.channels = stream->readUint16BE();
-			adpc.u1 = stream->readUint32BE();
+			adpc.statusItems = new ADPC_Chunk::StatusItem[adpc.itemCount];
+			
+			assert(adpc.channels <= 2);
 
-			for (uint16 i = 0; i < adpc.channels; i++)
-				adpc.u2[i] = stream->readUint32BE();
-			if (adpc.u0 == 2) {
-				adpc.u3 = stream->readUint32BE();
-				for (uint16 i = 0; i < adpc.channels; i++)
-					adpc.u4[i] = stream->readUint32BE();
+			for (uint16 i = 0; i < adpc.itemCount; i++) {
+				adpc.statusItems[i].sampleFrame = stream->readUint32BE();
+
+				for (uint16 j = 0; j < adpc.channels; j++)
+					adpc.statusItems[i].channelStatus[j] = stream->readUint32BE();
 			}
+			
+			delete[] adpc.statusItems;
 			break;
 		case ID_CUE:
 			debug(2, "Found Tag Cue#");

Modified: scummvm/trunk/engines/mohawk/sound.h
===================================================================
--- scummvm/trunk/engines/mohawk/sound.h	2010-01-24 21:46:30 UTC (rev 47527)
+++ scummvm/trunk/engines/mohawk/sound.h	2010-01-24 23:39:27 UTC (rev 47528)
@@ -72,16 +72,15 @@
 	uint16 id;
 };
 
-struct ADPC_Chunk {            // Appears to only exist if there isn't MPEG-2 Audio
+struct ADPC_Chunk {            // Holds ADPCM status data, but is irrelevant for us.
 	uint32 size;
-	uint16 u0;                 // Unknown (2 when there's a Cue# Chunk, 1 when there's not)
+	uint16 itemCount;
 	uint16 channels;
-	uint32 u1;                 // Unknown (always 0)
-	uint32 u2[MAX_CHANNELS];   // Unknown (0x00400000 for both channels)
-
-	// If there is a Cue# chunk, there can be two more variables:
-	uint32 u3;
-	uint32 u4[MAX_CHANNELS];
+	
+	struct StatusItem {
+		uint32 sampleFrame;
+		uint32 channelStatus[MAX_CHANNELS];
+	} *statusItems;
 };
 
 struct Cue_Chunk {


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