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
This commit is contained in:
Paul Gilbert 2018-12-08 12:18:10 -08:00 committed by Paul Gilbert
parent 43283ff561
commit 08db684864
4 changed files with 22 additions and 1 deletions

View File

@ -28,6 +28,7 @@
* - cge
* - cge2
* - fullpipe
* - glk
* - gob
* - hopkins
* - mohawk

View File

@ -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";

View File

@ -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;
}

View File

@ -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;