diff options
author | Paul Gilbert | 2018-11-10 16:29:51 -0800 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 |
commit | 1aaf2fd145e30937e8cd4c6736bee448f2b05a2c (patch) | |
tree | b3fdcd966ad70c48ef3e461874e463db33fd6825 /engines/gargoyle/frotz | |
parent | c589b807e2b4ae67928cfadb0a5b2e18cef38ff3 (diff) | |
download | scummvm-rg350-1aaf2fd145e30937e8cd4c6736bee448f2b05a2c.tar.gz scummvm-rg350-1aaf2fd145e30937e8cd4c6736bee448f2b05a2c.tar.bz2 scummvm-rg350-1aaf2fd145e30937e8cd4c6736bee448f2b05a2c.zip |
GLK: FROTZ: Fleshing out detection logic and added some entries
Diffstat (limited to 'engines/gargoyle/frotz')
-rw-r--r-- | engines/gargoyle/frotz/detection.cpp | 53 | ||||
-rw-r--r-- | engines/gargoyle/frotz/detection_tables.cpp | 85 | ||||
-rw-r--r-- | engines/gargoyle/frotz/detection_tables.h | 85 |
3 files changed, 195 insertions, 28 deletions
diff --git a/engines/gargoyle/frotz/detection.cpp b/engines/gargoyle/frotz/detection.cpp index 676077778e..fff8005e5f 100644 --- a/engines/gargoyle/frotz/detection.cpp +++ b/engines/gargoyle/frotz/detection.cpp @@ -24,23 +24,12 @@ #include "common/file.h" #include "common/md5.h" +#include "gargoyle/frotz/detection_tables.h" + namespace Gargoyle { namespace Frotz { -struct FrotzGame { - const char *_md5; - const char *_gameId; - int32 _filesize; - const char *_desc; -}; - -const FrotzGame FROTZ_GAMES[] = { - { nullptr, nullptr, 0, nullptr } -}; - bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) { - Common::File gameFile; - Common::String md5; const char *const EXTENSIONS[9] = { ".z1", ".z2", ".z3", ".z4", ".z5", ".z6", ".z7", ".z8", ".zblorb" }; // Loop through the files of the folder @@ -55,25 +44,33 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g if (!hasExt) continue; - // Check for known game - if (gameFile.open(*file)) { - md5 = Common::computeStreamMD5AsString(gameFile, 5000); - - // Scan through the game list for a match - const FrotzGame *p = FROTZ_GAMES; - while (p->_md5 && p->_filesize != gameFile.size() && md5 != p->_md5) - ++p; + // Open up the file and calculate the md5 + Common::File gameFile; + if (!gameFile.open(*file)) + continue; + Common::String md5 = Common::computeStreamMD5AsString(gameFile, 5000); + size_t filesize = gameFile.size(); + gameFile.close(); - if (p->_filesize) { - // Found a match - DetectedGame gd(p->_gameId, p->_desc, Common::EN_ANY, Common::kPlatformUnknown); - gd.addExtraEntry("filename", file->getName()); + // Check for known game + const FrotzGameDescription *p = FROTZ_GAMES; + while (p->_gameId && p->_md5 && (md5 != p->_md5 || filesize != p->_filesize)) + ++p; - gameList.push_back(gd); - } + DetectedGame gd; + if (!p->_gameId) { + // Generic .dat files don't get reported as matches unless they have a known md5 + if (filename.hasSuffixIgnoreCase(".dat")) + continue; - gameFile.close(); + warning("Uknown zcode game %s - %s %d", filename.c_str(), md5.c_str(), filesize); + gd = DetectedGame("zcode", "Unrecognised zcode game", Common::UNK_LANG, Common::kPlatformUnknown); + } else { + gd = DetectedGame(p->_gameId, p->_description, p->_language, Common::kPlatformUnknown, p->_extra); } + + gd.addExtraEntry("filename", filename); + gameList.push_back(gd); } return !gameList.empty(); diff --git a/engines/gargoyle/frotz/detection_tables.cpp b/engines/gargoyle/frotz/detection_tables.cpp new file mode 100644 index 0000000000..f8d3f424e3 --- /dev/null +++ b/engines/gargoyle/frotz/detection_tables.cpp @@ -0,0 +1,85 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gargoyle/frotz/detection_tables.h" + +namespace Gargoyle { +namespace Frotz { + +const char *const AMFV = "A Mind Forever Voyaging"; +const char *const ARTHUR = "Arthur: The Quest for Excalibur"; +const char *const BALLYHOO = "Ballyhoo"; +const char *const BEYONDZORK = "Beyond Zork"; +const char *const BORDERZONE = "Border Zone"; +const char *const BUREAUCRACY = "Bureaucracy"; +const char *const CUTTHROATS = "Cutthroats"; +const char *const DEADLINE = "Deadline"; +const char *const ENCHANTER = "Enchanter"; +const char *const HHGTTG = "The Hitchhiker's Guide to the Galaxy"; +const char *const HIJINX = "Hollywood Hijinx"; +const char *const INFIDEL = "Infidel"; +const char *const JOURNEY = "Journey"; +const char *const LGOP = "Leather Goddesses of Phobos"; +const char *const LGOP2 = "Leather Goddesses of Phobos 2"; +const char *const LURKING = "The Lurking Horror"; +const char *const MINIZORK1 = "Mini Zork I: The Great Underground Empire"; +const char *const MOONMIST = "Moonmist"; +const char *const NORDBERT = "Nord and Bert Couldn't Make Head or Tail of It"; +const char *const PLANETFALL = "Planetfall"; +const char *const PLUNDERED = "Plundered Hearts"; +const char *const SAMPLER1 = "Infocom Sampler 1"; +const char *const SAMPLER2 = "Infocom Sampler 2"; +const char *const SEASTALKER = "Seastalker"; +const char *const SHERLOCKRIDDLE = "Sherlock: The Riddle of the Crown Jewels"; +const char *const SHOGUN = "James Clavell's Shogun"; +const char *const SORCERER = "Sorcerer"; +const char *const SPELLBREAKER = "Spellbreaker"; +const char *const STARCROSS = "Starcross"; +const char *const STATIONFALL = "Stationfall"; +const char *const SUSPECT = "Suspect"; +const char *const SUSPENDED = "Suspended"; +const char *const TRINITY = "Trinity"; +const char *const WISHBRINGER = "Wishbringer"; +const char *const WITNESS = "The Witness"; +const char *const ZORK0 = "Zork Zero: The Revenge of Megaboz"; +const char *const ZORK1 = "Zork I: The Great Underground Empire"; +const char *const ZORK2 = "Zork II: The Wizard of Frobozz"; +const char *const ZORK3 = "Zork III: The Dungeon Master"; +const char *const ZTUU = "Zork: The Undiscovered Underground"; + +#define NONE GUIO4(GUIO_NOSPEECH, GUIO_NOSFX, GUIO_NOMUSIC, GUIO_NOSUBTITLES) +#define ENTRY0(ID, DESC, VERSION, MD5, FILESIZE) { ID, DESC, VERSION, MD5, FILESIZE, Common::EN_ANY, NONE } +#define FROTZ_TABLE_END_MARKER { nullptr, nullptr, nullptr, nullptr, 0, Common::EN_ANY, "" } + +const FrotzGameDescription FROTZ_GAMES[] = { + ENTRY0("hhgttg", HHGTTG, "v31 Solid Gold", "379022bcd4ec74b90274c6100c33f579", 158412), + ENTRY0("hhgttg", HHGTTG, "v47", "fdda8f4239819402c62db866bb61a648", 112622), + ENTRY0("hhgttg", HHGTTG, "v56", "a214fcb42bc9f554d07d983a12f6a062", 113444), + ENTRY0("hhgttg", HHGTTG, "v58", "e867d49ad1fb9406ff4e0678a4ee2ac9", 113332), + ENTRY0("hhgttg", HHGTTG, "v59", "34f6abc1f2a42be127ef434fc475f0ee", 113334), + + FROTZ_TABLE_END_MARKER +}; + + +} // End of namespace Frotz +} // End of namespace Gargoyle diff --git a/engines/gargoyle/frotz/detection_tables.h b/engines/gargoyle/frotz/detection_tables.h new file mode 100644 index 0000000000..1a9e4eefa9 --- /dev/null +++ b/engines/gargoyle/frotz/detection_tables.h @@ -0,0 +1,85 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "engines/advancedDetector.h" +#include "common/language.h" + +namespace Gargoyle { +namespace Frotz { + +/** + * Game descriptor for ZCode games + */ +struct FrotzGameDescription { + const char *const _gameId; + const char *const _description; + const char *const _extra; + const char *const _md5; + size_t _filesize; + Common::Language _language; + const char *const _guiOptions; +}; + +extern const FrotzGameDescription FROTZ_GAMES[]; +extern const char *const AMFV; +extern const char *const ARTHUR; +extern const char *const BALLYHOO; +extern const char *const BEYONDZORK; +extern const char *const BORDERZONE; +extern const char *const BUREAUCRACY; +extern const char *const CUTTHROATS; +extern const char *const DEADLINE; +extern const char *const ENCHANTER; +extern const char *const HHGTTG; +extern const char *const HIJINX; +extern const char *const INFIDEL; +extern const char *const JOURNEY; +extern const char *const LGOP; +extern const char *const LGOP2; +extern const char *const LURKING; +extern const char *const MINIZORK1; +extern const char *const MOONMIST; +extern const char *const NORDBERT; +extern const char *const PLANETFALL; +extern const char *const PLUNDERED; +extern const char *const SAMPLER1; +extern const char *const SAMPLER2; +extern const char *const SEASTALKER; +extern const char *const SHERLOCKRIDDLE; +extern const char *const SHOGUN; +extern const char *const SORCERER; +extern const char *const SPELLBREAKER; +extern const char *const STARCROSS; +extern const char *const STATIONFALL; +extern const char *const SUSPECT; +extern const char *const SUSPENDED; +extern const char *const TRINITY; +extern const char *const WISHBRINGER; +extern const char *const WITNESS; +extern const char *const ZORK0; +extern const char *const ZORK1; +extern const char *const ZORK2; +extern const char *const ZORK3; +extern const char *const ZTUU; + +} // End of namespace Frotz +} // End of namespace Gargoyle |