From 3457d3155e61a43ee8f2e8b1479b123439953d53 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 27 Jul 2019 19:12:39 -0700 Subject: GLK: FROTZ: Add detection for Infocom game Blorb files available at if-archive --- engines/glk/blorb.cpp | 20 +++++++++++++++++++- engines/glk/blorb.h | 7 ++++++- engines/glk/glk.cpp | 2 +- engines/glk/glk.h | 5 +++++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/engines/glk/blorb.cpp b/engines/glk/blorb.cpp index 88d6552ffe..849e6866e0 100644 --- a/engines/glk/blorb.cpp +++ b/engines/glk/blorb.cpp @@ -236,7 +236,7 @@ bool Blorb::hasBlorbExt(const Common::String &filename) { } void Blorb::getBlorbFilenames(const Common::String &srcFilename, Common::StringArray &filenames, - InterpreterType interpType) { + InterpreterType interpType, const Common::String &gameId) { // Strip off the source filename extension Common::String filename = srcFilename; if (!filename.contains('.')) { @@ -257,6 +257,7 @@ void Blorb::getBlorbFilenames(const Common::String &srcFilename, Common::StringA break; case INTERPRETER_FROTZ: filenames.push_back(filename + "zblorb"); + getInfocomBlorbFilenames(filenames, gameId); break; case INTERPRETER_GLULXE: filenames.push_back(filename + "gblorb"); @@ -266,4 +267,21 @@ void Blorb::getBlorbFilenames(const Common::String &srcFilename, Common::StringA } } +void Blorb::getInfocomBlorbFilenames(Common::StringArray &filenames, const Common::String &gameId) { + if (gameId == "beyondzork") + filenames.push_back("beyondzork.blb"); + else if (gameId == "journey") + filenames.push_back("journey.blb"); + else if (gameId == "lurkinghorror") + filenames.push_back("lurking.blb"); + else if (gameId == "questforexcalibur") + filenames.push_back("arthur.blb"); + else if (gameId == "sherlockriddle") + filenames.push_back("sherlock.blb"); + else if (gameId == "shogun") + filenames.push_back("shogun.blb"); + else if (gameId == "zork0") + filenames.push_back("zorkzero.blb"); +} + } // End of namespace Glk diff --git a/engines/glk/blorb.h b/engines/glk/blorb.h index 887690c251..5d72e2cf06 100644 --- a/engines/glk/blorb.h +++ b/engines/glk/blorb.h @@ -89,6 +89,11 @@ private: * Parses the Blorb file index to load in a list of the chunks */ Common::ErrorCode load(); + + /** + * Add possible Blorb filenames for Infocom games + */ + static void getInfocomBlorbFilenames(Common::StringArray &filenames, const Common::String &gameId); public: /** * Constructor @@ -151,7 +156,7 @@ public: * Return a list of possible filenames for blorb files */ static void getBlorbFilenames(const Common::String &srcFilename, Common::StringArray &filenames, - InterpreterType interpType); + InterpreterType interpType, const Common::String &gameId); }; } // End of namespace Glk diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp index 06ab742e74..455c42b46c 100644 --- a/engines/glk/glk.cpp +++ b/engines/glk/glk.cpp @@ -130,7 +130,7 @@ Common::Error GlkEngine::run() { } else { // Check for a secondary blorb file with the same filename Common::StringArray blorbFilenames; - Blorb::getBlorbFilenames(filename, blorbFilenames, getInterpreterType()); + Blorb::getBlorbFilenames(filename, blorbFilenames, getInterpreterType(), getGameID()); for (uint idx = 0; idx < blorbFilenames.size(); ++idx) { if (Common::File::exists(blorbFilenames[idx])) { diff --git a/engines/glk/glk.h b/engines/glk/glk.h index bd3594ae39..9c65fca3e6 100644 --- a/engines/glk/glk.h +++ b/engines/glk/glk.h @@ -148,6 +148,11 @@ public: */ virtual InterpreterType getInterpreterType() const = 0; + /** + * Returns the game's Id + */ + const Common::String &getGameID() const { return _gameDescription._gameId; } + /** * Returns the game's md5 */ -- cgit v1.2.3