aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-07-02 21:28:57 +0000
committerMax Horn2002-07-02 21:28:57 +0000
commit01dfd26a3756864dd668bd3cf0bc5c9cb9f3c29a (patch)
treed035766567885f18a01e8d1ef1e308ac6f57c7d2
parentb827dadf6e8217dbd2baad7bd21e7f8c32db818d (diff)
downloadscummvm-rg350-01dfd26a3756864dd668bd3cf0bc5c9cb9f3c29a.tar.gz
scummvm-rg350-01dfd26a3756864dd668bd3cf0bc5c9cb9f3c29a.tar.bz2
scummvm-rg350-01dfd26a3756864dd668bd3cf0bc5c9cb9f3c29a.zip
added some hackish support for the DIGI SFX format used in Putt-Putt demo
svn-id: r4451
-rw-r--r--resource.cpp9
-rw-r--r--sound.cpp17
2 files changed, 26 insertions, 0 deletions
diff --git a/resource.cpp b/resource.cpp
index 5d4c856836..298a7f0a7b 100644
--- a/resource.cpp
+++ b/resource.cpp
@@ -689,6 +689,15 @@ int Scumm::readSoundResource(int type, int idx)
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);
diff --git a/sound.cpp b/sound.cpp
index d29e1b602e..251b61a02e 100644
--- a/sound.cpp
+++ b/sound.cpp
@@ -203,6 +203,23 @@ void Scumm::playSound(int sound)
_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 */