[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.396,1.397

Max Horn fingolfin at users.sourceforge.net
Mon Sep 27 16:43:24 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10226

Modified Files:
	sound.cpp 
Log Message:
Fix endian problems with some HE sound code; also: better code to determine the size of the SDAT chunk

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.396
retrieving revision 1.397
diff -u -d -r1.396 -r1.397
--- sound.cpp	21 Sep 2004 12:29:02 -0000	1.396
+++ sound.cpp	27 Sep 2004 23:38:19 -0000	1.397
@@ -191,7 +191,7 @@
 			skip = 0;
 
 		musicFile.seek(+28, SEEK_CUR);
-		if (musicFile.readUint32LE() == MKID('SGEN')) {
+		if (musicFile.readUint32LE() == TO_LE_32(MKID('SGEN'))) {
 			// Skip to correct music header
 			skip *= 21;
 
@@ -646,22 +646,22 @@
 		}
 
 		if (_vm->_features & GF_HUMONGOUS) {
-			int extra = 0;;
+			int extra = 0;
 			_sfxMode |= mode;
 
-			// SKIP TALK (8) HSHD (24)
+			// Skip the TALK (8) and HSHD (24) chunks
 			_sfxFile->seek(offset + 32, SEEK_SET);
 
-			if (_sfxFile->readUint32LE() == MKID('SBNG')) {
-				// SKIP SBNG
+			if (_sfxFile->readUint32LE() == TO_LE_32(MKID('SBNG'))) {
+				// Skip the SBNG, so we end up at the SDAT chunk
 				extra = _sfxFile->readUint32BE();
-				_sfxFile->seek(+extra + 8, SEEK_CUR);
-				extra += 8;
+				_sfxFile->seek(extra - 4, SEEK_CUR);
+				size = _sfxFile->readUint32BE() - 8;
 			} else {
 				_sfxFile->seek(+4, SEEK_CUR);
+				size = b - 40;
 			}
 
-			size = b - 40 - extra ;
 			sound = (byte *)malloc(size);
 			_sfxFile->read(sound, size);
 			_vm->_mixer->playRaw(handle, sound, size, 11000, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);





More information about the Scummvm-git-logs mailing list