[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.137,1.138 sound.cpp,1.206,1.207

Travis Howell kirben at users.sourceforge.net
Wed Aug 20 08:34:12 CEST 2003


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

Modified Files:
	resource.cpp sound.cpp 
Log Message:

Fix speedy music regression in monkeyega/vga/pass.
Add unique tag to sfx when converting AD resources, to solve sfx cutting off music issue in monkeyega/vga.


Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -r1.137 -r1.138
--- resource.cpp	17 Aug 2003 16:32:36 -0000	1.137
+++ resource.cpp	20 Aug 2003 15:19:23 -0000	1.138
@@ -1027,19 +1027,6 @@
 	total_size += 24;	// Up to 24 additional bytes are needed for the jump sysex
 
 	ptr = createResource(type, idx, total_size);
-	memcpy(ptr, "ADL ", 4); ptr += 4;
-	uint32 dw = READ_BE_UINT32(&total_size);
-	memcpy(ptr, &dw, 4); ptr += 4;
-	memcpy(ptr, "MDhd", 4); ptr += 4;
-	ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 8;
-	ptr += 4;
-	memset(ptr, 0, 8), ptr += 8;
-	memcpy(ptr, "MThd", 4); ptr += 4;
-	ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 6;
-	ptr += 4;
-	ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 1; // MIDI format 0 with 1 track
-	ptr += 4;
-	
 	// We will ignore the PPQN in the original resource, because
 	// it's invalid anyway. We use a constant PPQN of 480.
 	// For Indy it is actually 240.
@@ -1048,18 +1035,31 @@
 	} else {
 	    ppqn = 480;
 	}
-	*ptr++ = ppqn >> 8;
-	*ptr++ = ppqn & 0xFF;
-	
-	memcpy(ptr, "MTrk", 4); ptr += 4;
-	dw = READ_BE_UINT32(&total_size);
-	memcpy(ptr, &dw, 4); ptr += 4;
 
 	src_ptr += 2;
 	size -= 2;
 
 	if (*src_ptr == 0x80) {
 		// 0x80: is music; otherwise not.
+		memcpy(ptr, "ADL ", 4); ptr += 4;
+		uint32 dw = READ_BE_UINT32(&total_size);
+		memcpy(ptr, &dw, 4); ptr += 4;
+		memcpy(ptr, "MDhd", 4); ptr += 4;
+		ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 8;
+		ptr += 4;
+		memset(ptr, 0, 8), ptr += 8;
+		memcpy(ptr, "MThd", 4); ptr += 4;
+		ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 6;
+		ptr += 4;
+		ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 1; // MIDI format 0 with 1 track
+		ptr += 4;
+	
+		*ptr++ = ppqn >> 8;
+		*ptr++ = ppqn & 0xFF;
+	
+		memcpy(ptr, "MTrk", 4); ptr += 4;
+		dw = READ_BE_UINT32(&total_size);
+		memcpy(ptr, &dw, 4); ptr += 4;
 
 		// The "speed" of the song
 		ticks = *(src_ptr + 1);
@@ -1090,8 +1090,10 @@
 			// dw = 1000000 * 256 / 473 * ppqn / 2 / ticks;
 			// But this seems closer to original???
 			dw = 73000000 / ticks;
-		} else {
+		} else if (_gameId == GID_LOOM) {
 			dw = 1000000 * ppqn / 4 / 2 / ticks;
+		} else {
+			dw = (500000 * 256) / ticks;
 		}
 		debug(4, "  ticks = %d, speed = %ld", ticks, dw);
 			
@@ -1217,6 +1219,26 @@
 	/* This is a sfx resource.  First parse it quickly to find the parallel
 	 * tracks.
 	 */
+	memcpy(ptr, "ASFX", 4); ptr += 4;
+	uint32 dw = READ_BE_UINT32(&total_size);
+	memcpy(ptr, &dw, 4); ptr += 4;
+	memcpy(ptr, "MDhd", 4); ptr += 4;
+	ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 8;
+	ptr += 4;
+	memset(ptr, 0, 8), ptr += 8;
+	memcpy(ptr, "MThd", 4); ptr += 4;
+	ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 6;
+	ptr += 4;
+	ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 1; // MIDI format 0 with 1 track
+	ptr += 4;
+
+	*ptr++ = ppqn >> 8;
+	*ptr++ = ppqn & 0xFF;
+
+	memcpy(ptr, "MTrk", 4); ptr += 4;
+	dw = READ_BE_UINT32(&total_size);
+	memcpy(ptr, &dw, 4); ptr += 4;
+
 	byte current_instr[3][14];
 	int  current_note[3];
 	int track_time[3];

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -d -r1.206 -r1.207
--- sound.cpp	15 Aug 2003 15:17:25 -0000	1.206
+++ sound.cpp	20 Aug 2003 15:19:23 -0000	1.207
@@ -457,15 +457,12 @@
 		if (_scumm->_features & GF_AMIGA)
 			return;
 
-		// FIXME: This evil hack works around the fact that in some
-		// places in MonkeyVGA, the music is never explicitly stopped.
+		// Works around the fact that in some places in MonkeyEGA/VGA,
+		// the music is never explicitly stopped.
 		// Rather it seems that starting a new music is supposed to
 		// automatically stop the old song.
-		// This hack relays on the fact that we currently don't support SFX
-		// in these games, only music. Once we add SFX support, we'll have to
-		// revise it / replace it by a proper fix.
-		if (ptr) {
-			if (READ_BE_UINT16(ptr) == 'RO' || READ_UINT32(ptr) == MKID('ADL '))
+		if (_scumm->_imuse && ptr) {
+			if (READ_UINT32(ptr) != MKID('ASFX'))
 				_scumm->_imuse->stop_all_sounds();
 		}
 	}





More information about the Scummvm-git-logs mailing list