[Scummvm-cvs-logs] CVS: scummvm resource.cpp,1.93,1.94 sound.cpp,1.96,1.97
Max Horn
fingolfin at users.sourceforge.net
Tue Jul 2 14:29:55 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv30814
Modified Files:
resource.cpp sound.cpp
Log Message:
added some hackish support for the DIGI SFX format used in Putt-Putt demo
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- resource.cpp 29 Jun 2002 10:32:56 -0000 1.93
+++ resource.cpp 2 Jul 2002 21:28:57 -0000 1.94
@@ -689,6 +689,15 @@
total_size = fileReadDwordBE();
fileRead(_fileHandle, createResource(type, idx, total_size), total_size - 8);
return 1;
+ } else if (basetag == MKID('DIGI')) {
+ // Use in Putt-Putt Demo
+ debug(1, "Found base tag DIGI in sound %d, size %d", idx, total_size);
+ debug(1, "It was at position %d", filePos(_fileHandle));
+
+ fileSeek(_fileHandle, -12, SEEK_CUR);
+ total_size = fileReadDwordBE();
+ fileRead(_fileHandle, createResource(type, idx, total_size), total_size - 8);
+ return 1;
} else {
fprintf(stderr, "WARNING: Unrecognized base tag 0x%08lx in sound %d\n",
basetag, idx);
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- sound.cpp 2 Jun 2002 20:28:09 -0000 1.96
+++ sound.cpp 2 Jul 2002 21:28:57 -0000 1.97
@@ -203,6 +203,23 @@
_mixer->play_raw(NULL, sound, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
return;
}
+ // Support for Putt-Putt sounds - very hackish, too 8-)
+ else if (ptr != NULL && READ_UINT32_UNALIGNED(ptr) == MKID('DIGI')) {
+ // TODO - discover what data the first chunk, HSHD, contains
+ // it might be useful here.
+ ptr += 8 + READ_UINT32_UNALIGNED(ptr+12);
+ if (READ_UINT32_UNALIGNED(ptr) != MKID('SDAT'))
+ return; // abort
+
+ int size = READ_UINT32_UNALIGNED(ptr+4);
+ int rate = 8000; // FIXME - what value here ?!? this is just a guess for now
+
+ // Allocate a sound buffer, copy the data into it, and play
+ char *sound = (char*)malloc(size);
+ memcpy(sound, ptr+8, size);
+ _mixer->play_raw(NULL, sound, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+ return;
+ }
if ((_features & GF_OLD256) || (_gameId == GID_MONKEY_VGA))
return; /* FIXME */
More information about the Scummvm-git-logs
mailing list