[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.241,1.242

Max Horn fingolfin at users.sourceforge.net
Sun Sep 7 13:54:02 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv19462

Modified Files:
	sound.cpp 
Log Message:
properly decode SBL resources by scanning the VOC header in them; added a guess at how SEGA SBLs work (untested, might be completely wrong)

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -d -r1.241 -r1.242
--- sound.cpp	7 Sep 2003 20:30:02 -0000	1.241
+++ sound.cpp	7 Sep 2003 20:53:05 -0000	1.242
@@ -297,6 +297,25 @@
 		// 80 80 80 80 80 80 80 80  |........|
 		// 80 80 80 80 80 80 80 80  |........|
 
+#if 1
+		// Fingolfin says: after eyeballing a single SEGA
+		// SBL resource, it would seem as if the content of the
+		// data subchunk (AUdt) is XORed with 0x16. At least
+		// then a semi-sane VOC header is revealed, with
+		// a sampling rate of ~25000 Hz (does that make sense?).
+		// I'll add some code to test that theory for now.
+		if (_scumm->_gameId == GID_MONKEY_SEGA)	{
+			size = READ_BE_UINT32(ptr + 4) - 27;
+			for (int i = 0; i < size; i++)
+				ptr[27 + i] ^= 0x16;
+		}
+
+		VocBlockHeader &voc_block_hdr = *(VocBlockHeader *)(ptr + 27);
+		assert(voc_block_hdr.blocktype == 1);
+		size = voc_block_hdr.size[0] + (voc_block_hdr.size[1] << 8) + (voc_block_hdr.size[2] << 16) - 2;
+		rate = getSampleRateFromVOCRate(voc_block_hdr.sr);
+		assert(voc_block_hdr.pack == 0);
+#else
 		// FIXME: SBL resources are apparently horribly
 		// distorted on segacd even though it shares the same
 		// header etc. So don't try to play them for now.
@@ -310,6 +329,7 @@
 			rate = 8000;
 
 		size = READ_BE_UINT32(ptr + 4) - 27;
+#endif
 
 		// Allocate a sound buffer, copy the data into it, and play
 		sound = (char *)malloc(size);





More information about the Scummvm-git-logs mailing list