diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/glk/blorb.cpp | 34 | ||||
-rw-r--r-- | engines/glk/blorb.h | 6 | ||||
-rw-r--r-- | engines/glk/glk.cpp | 19 |
3 files changed, 48 insertions, 11 deletions
diff --git a/engines/glk/blorb.cpp b/engines/glk/blorb.cpp index 03c3dd3051..3c60fd36fc 100644 --- a/engines/glk/blorb.cpp +++ b/engines/glk/blorb.cpp @@ -215,7 +215,39 @@ bool Blorb::isBlorb(const Common::String &filename, uint32 type) { bool Blorb::hasBlorbExt(const Common::String &filename) { return filename.hasSuffixIgnoreCase(".blorb") || filename.hasSuffixIgnoreCase(".zblorb") - || filename.hasSuffixIgnoreCase(".gblorb") || filename.hasSuffixIgnoreCase(".blb"); + || filename.hasSuffixIgnoreCase(".gblorb") || filename.hasSuffixIgnoreCase(".blb") + || filename.hasSuffixIgnoreCase(".a3r"); +} + +void Blorb::getBlorbFilenames(const Common::String &srcFilename, Common::StringArray &filenames, + InterpreterType interpType) { + // Strip off the source filename extension + Common::String filename = srcFilename; + if (!filename.contains('.')) { + filename += '.'; + } else { + while (filename[filename.size() - 1] != '.') + filename.deleteLastChar(); + } + + // Add in the different possible filenames + filenames.clear(); + filenames.push_back(filename + "blorb"); + filenames.push_back(filename + "blb"); + + switch (interpType) { + case INTERPRETER_ALAN3: + filenames.push_back(filename + "a3r"); + break; + case INTERPRETER_FROTZ: + filenames.push_back(filename + "zblorb"); + break; + case INTERPRETER_GLULXE: + filenames.push_back(filename + "gblorb"); + break; + default: + break; + } } } // End of namespace Glk diff --git a/engines/glk/blorb.h b/engines/glk/blorb.h index 92a5f3f190..887690c251 100644 --- a/engines/glk/blorb.h +++ b/engines/glk/blorb.h @@ -146,6 +146,12 @@ public: * Returns true if a given filename has a Blorb file extension */ static bool hasBlorbExt(const Common::String &filename); + + /** + * Return a list of possible filenames for blorb files + */ + static void getBlorbFilenames(const Common::String &srcFilename, Common::StringArray &filenames, + InterpreterType interpType); }; } // End of namespace Glk diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp index ffb5015633..b17304d957 100644 --- a/engines/glk/glk.cpp +++ b/engines/glk/glk.cpp @@ -126,16 +126,15 @@ Common::Error GlkEngine::run() { return Common::kNoGameDataFoundError; } else { // Check for a secondary blorb file with the same filename - Common::String baseName = filename; - while (baseName.contains('.')) - baseName.deleteLastChar(); - - if (Common::File::exists(baseName + ".blorb")) { - _blorb = new Blorb(baseName + ".blorb", getInterpreterType()); - SearchMan.add("blorb", _blorb, 99, false); - } else if (Common::File::exists(baseName + ".blb")) { - _blorb = new Blorb(baseName + ".blb", getInterpreterType()); - SearchMan.add("blorb", _blorb, 99, false); + Common::StringArray blorbFilenames; + Blorb::getBlorbFilenames(filename, blorbFilenames, getInterpreterType()); + + for (uint idx = 0; idx < blorbFilenames.size(); ++idx) { + if (Common::File::exists(blorbFilenames[idx])) { + _blorb = new Blorb(blorbFilenames[idx], getInterpreterType()); + SearchMan.add("blorb", _blorb, 99, false); + break; + } } // Open up the game file |