GLK: FROTZ: Fleshing out detection logic and added some entries

This commit is contained in:
Paul Gilbert 2018-11-10 16:29:51 -08:00 committed by Paul Gilbert
parent c589b807e2
commit 1aaf2fd145
5 changed files with 241 additions and 28 deletions

View file

@ -68,10 +68,55 @@ const Common::String &GargoyleEngine::getGameMD5() const {
} // End of namespace Gargoyle
#include "gargoyle/frotz/detection_tables.h"
#define ZCODE(ID, NAME) { ID, Gargoyle::Frotz::NAME }
static const PlainGameDescriptor gargoyleGames[] = {
{"zcode", "Zcode Games" },
{"scottadams", "Scott Adams Games"},
// Infocom/Z-code games
ZCODE("amfv", AMFV),
ZCODE("arthur", ARTHUR),
ZCODE("ballyhoo", BALLYHOO),
ZCODE("beyondzork", BEYONDZORK),
ZCODE("borderzone", BORDERZONE),
ZCODE("bureaucracy", BUREAUCRACY),
ZCODE("cutthroats", CUTTHROATS),
ZCODE("deadline", DEADLINE),
ZCODE("enchanter", ENCHANTER),
ZCODE("hhgttg", HHGTTG),
ZCODE("hijinx", HIJINX),
ZCODE("infidel", INFIDEL),
ZCODE("journey", JOURNEY),
ZCODE("lgop", LGOP),
ZCODE("lgop2", LGOP2),
ZCODE("lurking", LURKING),
ZCODE("minizork1", MINIZORK1),
ZCODE("moonmist", MOONMIST),
ZCODE("nordbert", NORDBERT),
ZCODE("planetfall", PLANETFALL),
ZCODE("plundered", PLUNDERED),
ZCODE("sampler1", SAMPLER1),
ZCODE("sampler2", SAMPLER2),
ZCODE("seastalker", SEASTALKER),
ZCODE("sherlockriddle", SHERLOCKRIDDLE),
ZCODE("shogun", SHOGUN),
ZCODE("sorcerer", SORCERER),
ZCODE("spellbreaker", SPELLBREAKER),
ZCODE("starcross", STARCROSS),
ZCODE("stationfall", STATIONFALL),
ZCODE("suspect", SUSPECT),
ZCODE("suspended", SUSPENDED),
ZCODE("trinity", TRINITY),
ZCODE("wishbringer", WISHBRINGER),
ZCODE("witness", WITNESS),
ZCODE("zork0", ZORK0),
ZCODE("zork1", ZORK1),
ZCODE("zork2", ZORK2),
ZCODE("zork3", ZORK3),
ZCODE("ztuu", ZTUU),
// Scott Adams games
{ "adventureland", "Adventureland" },
{ "pirateadventure", "Pirate Adventure" },

View file

@ -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;
// 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();
// Check for known game
if (gameFile.open(*file)) {
md5 = Common::computeStreamMD5AsString(gameFile, 5000);
const FrotzGameDescription *p = FROTZ_GAMES;
while (p->_gameId && p->_md5 && (md5 != p->_md5 || filesize != p->_filesize))
++p;
// Scan through the game list for a match
const FrotzGame *p = FROTZ_GAMES;
while (p->_md5 && p->_filesize != gameFile.size() && md5 != p->_md5)
++p;
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;
if (p->_filesize) {
// Found a match
DetectedGame gd(p->_gameId, p->_desc, Common::EN_ANY, Common::kPlatformUnknown);
gd.addExtraEntry("filename", file->getName());
gameList.push_back(gd);
}
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();

View file

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

View file

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

View file

@ -21,6 +21,7 @@ MODULE_OBJS := \
window_text_buffer.o \
window_text_grid.o \
frotz/detection.o \
frotz/detection_tables.o \
frotz/frotz.o \
scott/detection.o \
scott/scott.o