From 01dfd26a3756864dd668bd3cf0bc5c9cb9f3c29a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 2 Jul 2002 21:28:57 +0000 Subject: added some hackish support for the DIGI SFX format used in Putt-Putt demo svn-id: r4451 --- resource.cpp | 9 +++++++++ sound.cpp | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/resource.cpp b/resource.cpp index 5d4c856836..298a7f0a7b 100644 --- a/resource.cpp +++ b/resource.cpp @@ -685,6 +685,15 @@ int Scumm::readSoundResource(int type, int idx) debug(1, "Found base tag Mac1 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 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); 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 */ -- cgit v1.2.3