From 08db684864f0734a2d93641dc7a23ce117073eb4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Dec 2018 12:18:10 -0800 Subject: GLK: Add support for secondary Blorb files separate from the gamefile It also hads further support for playing AIFF files. However, the Blorb files for Lurking Horror & Sherlock on the if-archive website don't seem to be valid AIFF files, so sound doesn't play using them --- engines/glk/blorb.cpp | 2 +- engines/glk/glk.cpp | 14 ++++++++++++++ engines/glk/sound.cpp | 6 ++++++ 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/glk/blorb.cpp b/engines/glk/blorb.cpp index 5ffd0b03b0..4a4cf8c531 100644 --- a/engines/glk/blorb.cpp +++ b/engines/glk/blorb.cpp @@ -153,7 +153,7 @@ Common::ErrorCode Blorb::load() { ce._filename += ".mp3"; else if (ce._id == ID_WAVE) ce._filename += ".wav"; - else if (ce._id == ID_AIFF) + else if (ce._id == ID_AIFF || ce._id == ID_FORM) ce._filename += ".aiff"; else if (ce._id == ID_OGG) ce._filename += ".ogg"; diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp index c8a63c5bd3..849de8d8f3 100644 --- a/engines/glk/glk.cpp +++ b/engines/glk/glk.cpp @@ -122,6 +122,20 @@ Common::Error GlkEngine::run() { if (!f.open("game", *_blorb)) return Common::kNoGameDataFoundError; } else { + // Check for a secondary blorb file with the same filename + Common::String baseName = filename; + while (baseName.contains('.')) + baseName.deleteLastChar(); + + if (f.exists(baseName + ".blorb")) { + _blorb = new Blorb(baseName + ".blorb", getInterpreterType()); + SearchMan.add("blorb", _blorb, 99, false); + } else if (f.exists(baseName + ".blb")) { + _blorb = new Blorb(baseName + ".blb", getInterpreterType()); + SearchMan.add("blorb", _blorb, 99, false); + } + + // Open up the game file if (!f.open(filename)) return Common::kNoGameDataFoundError; } diff --git a/engines/glk/sound.cpp b/engines/glk/sound.cpp index 85f7e01702..02fb7f9253 100644 --- a/engines/glk/sound.cpp +++ b/engines/glk/sound.cpp @@ -25,6 +25,7 @@ #include "glk/events.h" #include "common/file.h" #include "audio/audiostream.h" +#include "audio/decoders/aiff.h" #include "audio/decoders/raw.h" #include "audio/decoders/mp3.h" #include "audio/decoders/wave.h" @@ -92,6 +93,7 @@ glui32 SoundChannel::play(glui32 soundNum, glui32 repeats, glui32 notify) { Common::String nameSnd = Common::String::format("sound%u.snd", soundNum); Common::String nameMp3 = Common::String::format("sound%u.mp3", soundNum); Common::String nameWav = Common::String::format("sound%u.wav", soundNum); + Common::String nameAiff = Common::String::format("sound%u.aiff", soundNum); if (f.exists(nameSnd) && f.open(nameSnd)) { if (f.readUint16BE() != (f.size() - 2)) @@ -113,6 +115,10 @@ glui32 SoundChannel::play(glui32 soundNum, glui32 repeats, glui32 notify) { Common::SeekableReadStream *s = f.readStream(f.size()); stream = Audio::makeWAVStream(s, DisposeAfterUse::YES); + } else if (f.exists(nameAiff) && f.open(nameAiff)) { + Common::SeekableReadStream *s = f.readStream(f.size()); + stream = Audio::makeAIFFStream(s, DisposeAfterUse::YES); + } else { warning("Could not find sound %u", soundNum); return 1; -- cgit v1.2.3