[Scummvm-cvs-logs] SF.net SVN: scummvm: [24877] scummvm/trunk/engines/agi

darkfiber at users.sourceforge.net darkfiber at users.sourceforge.net
Tue Dec 19 02:11:42 CET 2006


Revision: 24877
          http://scummvm.svn.sourceforge.net/scummvm/?rev=24877&view=rev
Author:   darkfiber
Date:     2006-12-18 17:11:41 -0800 (Mon, 18 Dec 2006)

Log Message:
-----------
Added AdvancedDetection to AGI engine. Only added KQ1 for testing

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.cpp
    scummvm/trunk/engines/agi/agi.h
    scummvm/trunk/engines/agi/console.cpp
    scummvm/trunk/engines/agi/id.cpp
    scummvm/trunk/engines/agi/module.mk

Added Paths:
-----------
    scummvm/trunk/engines/agi/detection.cpp

Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp	2006-12-19 01:06:45 UTC (rev 24876)
+++ scummvm/trunk/engines/agi/agi.cpp	2006-12-19 01:11:41 UTC (rev 24877)
@@ -23,6 +23,7 @@
  */
 
 #include "common/stdafx.h"
+
 #include "common/file.h"
 #include "common/fs.h"
 #include "common/savefile.h"
@@ -45,6 +46,8 @@
 #include "agi/savegame.h"
 #include "agi/sound.h"
 
+
+
 namespace Agi {
 
 static uint32 g_tick_timer;
@@ -99,7 +102,7 @@
 
 			if (event.kbd.flags & OSystem::KBD_CTRL)
 				_key_control = 1;
-			
+
 			if (event.kbd.flags & OSystem::KBD_ALT)
 				_key_alt = 1;
 
@@ -364,8 +367,8 @@
 	switch (loader->getIntVersion() >> 12) {
 	case 2:
 		report("Emulating Sierra AGI v%x.%03x\n",
-				(int)(loader->version() >> 12) & 0xF,
-				(int)(loader->version()) & 0xFFF);
+				(int)(agiGetRelease() >> 12) & 0xF,
+				(int)(agiGetRelease()) & 0xFFF);
 		break;
 	case 3:
 		report("Emulating Sierra AGI v%x.002.%03x\n",
@@ -438,10 +441,25 @@
 int AgiEngine::agiDetectGame() {
 	int ec = err_OK;
 
-	loader = new AgiLoader_v2(this);
-	ec = loader->detect_game();
+	assert(this->_gameDescription != NULL);
 
-	if (ec != err_OK) {
+	if( (this->_gameDescription->features & AGI_AMIGA) == AGI_AMIGA)
+		opt.amiga = true;
+
+	if( (this->_gameDescription->features & AGI_AGDS) == AGI_AGDS)
+		opt.agds = true;
+
+	if( (this->_gameDescription->features & AGI_MOUSE) == AGI_MOUSE)
+		opt.agimouse = true;
+
+
+	if(this->_gameDescription->version <= 0x2999)
+	{
+		loader = new AgiLoader_v2(this);
+		ec = loader->detect_game();
+	}
+	else
+	{
 		loader = new AgiLoader_v3(this);
 		ec = loader->detect_game();
 	}
@@ -601,6 +619,8 @@
 	game.ver = -1;		/* Don't display the conf file warning */
 
 	debugC(2, kDebugLevelMain, "Detect game");
+
+
 	if (agiDetectGame() == err_OK) {
 		game.state = STATE_LOADED;
 		debugC(2, kDebugLevelMain, "game loaded");
@@ -625,6 +645,14 @@
 }
 
 int AgiEngine::init() {
+
+	// Detect game
+	if (!initGame()) {
+		GUIErrorMessage("No valid games were found in the specified directory.");
+		return -1;
+	}
+
+
 	// Initialize backend
 	_system->beginGFXTransaction();
 	initCommonGFX(false);
@@ -657,72 +685,4 @@
 
 }                             // End of namespace Agi
 
-GameList Engine_AGI_gameIDList() {
-	GameList games;
-	const Agi::GameSettings *g = Agi::agi_settings;
 
-	while (g->gameid) {
-		games.push_back(*g);
-		g++;
-	}
-
-	return games;
-}
-
-GameDescriptor Engine_AGI_findGameID(const char *gameid) {
-	const Agi::GameSettings *g = Agi::agi_settings;
-	while (g->gameid) {
-		if (0 == scumm_stricmp(gameid, g->gameid))
-			break;
-		g++;
-	}
-	return *g;
-}
-
-DetectedGameList Engine_AGI_detectGames(const FSList &fslist) {
-	DetectedGameList detectedGames;
-	const Agi::GameSettings * g;
-
-	for (g = Agi::agi_settings; g->gameid; ++g) {
-		// Iterate over all files in the given directory
-		for (FSList::const_iterator file = fslist.begin();
-		    file != fslist.end(); ++file) {
-			const char *fileName = file->name().c_str();
-
-			if (0 == scumm_stricmp(g->detectname, fileName)) {
-				// Match found, add to list of candidates, then abort inner loop.
-				detectedGames.push_back(*g);
-				break;
-			}
-		}
-	}
-	return detectedGames;
-}
-
-PluginError Engine_AGI_create(OSystem *syst, Engine **engine) {
-	assert(syst);
-	assert(engine);
-
-	FSList fslist;
-	FilesystemNode dir(ConfMan.get("path"));
-	if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) {
-		warning("AgiEngine: invalid game path '%s'", dir.path().c_str());
-		return kInvalidPathError;
-	}
-
-	// Invoke the detector
-	Common::String gameid = ConfMan.get("gameid");
-	DetectedGameList detectedGames = Engine_AGI_detectGames(fslist);
-
-	for (uint i = 0; i < detectedGames.size(); i++) {
-		if (detectedGames[i].gameid == gameid) {
-			*engine = new Agi::AgiEngine(syst);
-			return kNoError;
-		}
-	}
-
-	warning("AgiEngine: Unable to locate game data at path '%s'", dir.path().c_str());
-	return kNoGameDataFoundError;
-}
-
-REGISTER_PLUGIN(AGI, "AGI Engine", "TODO (C) TODO");

Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h	2006-12-19 01:06:45 UTC (rev 24876)
+++ scummvm/trunk/engines/agi/agi.h	2006-12-19 01:11:41 UTC (rev 24877)
@@ -29,6 +29,7 @@
 #include "common/scummsys.h"
 #include "common/endian.h"
 #include "common/util.h"
+#include "common/advancedDetector.h"
 #include "common/file.h"
 #include "common/savefile.h"
 #include "common/system.h"
@@ -96,6 +97,30 @@
 
 namespace Agi {
 
+
+enum AgiGameType {
+	GType_V2 = 1,
+	GType_V3
+};
+
+enum AgiGameFeatures {
+	AGI_AMIGA = 1 << 0,
+	AGI_MOUSE = 1 << 1,
+	AGI_AGDS = 1 << 2
+
+};
+
+struct AGIGameDescription {
+	Common::ADGameDescription desc;
+
+	int gameType;
+	uint32 features;
+	uint16 version;
+};
+
+
+
+
 enum {
 	NO_GAMEDIR = 0,
 	GAMEDIR
@@ -500,6 +525,8 @@
 	void shutdown();
 	void initialize();
 
+	bool initGame();
+
 public:
 	AgiEngine(OSystem *syst);
 	virtual ~AgiEngine();
@@ -507,6 +534,8 @@
 		return _gameId;
 	}
 
+	const AGIGameDescription *_gameDescription;
+
 private:
 
 	int _key_queue[KEY_QUEUE_SIZE];

Modified: scummvm/trunk/engines/agi/console.cpp
===================================================================
--- scummvm/trunk/engines/agi/console.cpp	2006-12-19 01:06:45 UTC (rev 24876)
+++ scummvm/trunk/engines/agi/console.cpp	2006-12-19 01:11:41 UTC (rev 24877)
@@ -125,12 +125,7 @@
 }
 
 bool Console::Cmd_Crc(int argc, const char **argv) {
-	char name[80];
-	DebugPrintf("0x%05x\n", _vm->game.crc);
-	if (_vm->match_crc(_vm->game.crc, name, 80))
-		DebugPrintf("%s\n", name);
-	else
-		DebugPrintf("Unknown game\n");
+	DebugPrintf("command removed from scummvm\n");
 
 	return true;
 }
@@ -216,7 +211,7 @@
 		DebugPrintf("Usage: trigger on|off\n");
 		return false;
 	}
-	_vm->_debug.ignoretriggers = strcmp (argv[1], "on"); 
+	_vm->_debug.ignoretriggers = strcmp (argv[1], "on");
 
 	return true;
 }

Added: scummvm/trunk/engines/agi/detection.cpp
===================================================================
--- scummvm/trunk/engines/agi/detection.cpp	                        (rev 0)
+++ scummvm/trunk/engines/agi/detection.cpp	2006-12-19 01:11:41 UTC (rev 24877)
@@ -0,0 +1,146 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * cinE Engine is (C) 2004-2005 by CinE Team
+ *
+ * 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.
+ *
+ * $URL:$
+ * $Id:$
+ *
+ */
+
+#include "common/stdafx.h"
+
+#include "base/plugins.h"
+
+#include "common/advancedDetector.h"
+#include "common/file.h"
+
+#include "agi/agi.h"
+
+
+namespace Agi {
+static DetectedGameList GAME_detectGames(const FSList &fslist);
+}
+
+using Common::File;
+
+static const PlainGameDescriptor agiGames[] = {
+	{"kq1", "Kings Quest I" },
+
+	{0, 0}
+};
+
+ADVANCED_DETECTOR_DEFINE_PLUGIN(AGI, Agi::AgiEngine, Agi::GAME_detectGames, agiGames, 0);
+
+REGISTER_PLUGIN(AGI, "AGI v2 + v3 Engine", "Sierra AGI Engine (C) Sierra On-Line Software");
+
+
+namespace Agi {
+
+#define FILE_MD5_BYTES 5000
+
+using Common::ADGameFileDescription;
+using Common::ADGameDescription;
+
+using Common::File;
+
+static const ADGameFileDescription AGI_KQ1_PC_20F_GameFiles[] = {
+	{ "logdir",		0,	"10ad66e2ecbd66951534a50aedcd0128"},
+};
+static const ADGameFileDescription AGI_KQ1_2GS_10S_GameFiles[] = {
+	{ "logdir",		0,	"f4277aa34b43d37382bc424c81627617"},
+};
+static const ADGameFileDescription AGI_KQ1_MAC_20C_GameFiles[] = {
+	{ "logdir",		0,	"d4c4739d4ac63f7dbd29255425077d48"},
+};
+
+
+static const AGIGameDescription gameDescriptions[] = {
+	{
+		// kings quest 1 : pc : 2.0F
+		{
+			"kq1",
+			"",
+			ARRAYSIZE(AGI_KQ1_PC_20F_GameFiles),
+			AGI_KQ1_PC_20F_GameFiles,
+			Common::EN_ANY,
+			Common::kPlatformPC,
+		},
+		GType_V2,
+		0,
+		0x2917,
+	},
+
+	{
+		// kings quest 1 : 2gs : 1.0S
+		{
+			"kq1",
+			"",
+			ARRAYSIZE(AGI_KQ1_2GS_10S_GameFiles),
+			AGI_KQ1_2GS_10S_GameFiles,
+			Common::EN_ANY,
+			Common::kPlatformApple2GS,
+		},
+		GType_V2,
+		0,
+		0x2272,
+	},
+
+
+	{
+		// kings quest 1 : Mac : 2.0C
+		{
+			"kq1",
+			"",
+			ARRAYSIZE(AGI_KQ1_MAC_20C_GameFiles),
+			AGI_KQ1_MAC_20C_GameFiles,
+			Common::EN_ANY,
+			Common::kPlatformMacintosh,
+		},
+		GType_V2,
+		0,
+		0x2440,
+	},
+
+
+};
+
+bool AgiEngine::initGame() {
+	int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME(
+		(const byte *)gameDescriptions,
+		sizeof(AGIGameDescription),
+		ARRAYSIZE(gameDescriptions),
+		FILE_MD5_BYTES,
+		agiGames
+		);
+	_gameDescription = &gameDescriptions[i];
+	return true;
+}
+
+DetectedGameList GAME_detectGames(const FSList &fslist) {
+	return real_ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(
+		fslist,
+		(const byte *)gameDescriptions,
+		sizeof(AGIGameDescription),
+		ARRAYSIZE(gameDescriptions),
+		FILE_MD5_BYTES,
+		agiGames
+	);
+}
+
+} // End of namespace Agi
+


Property changes on: scummvm/trunk/engines/agi/detection.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:mine-type
   + text/plain
Name: svn:eol-style
   + native

Modified: scummvm/trunk/engines/agi/id.cpp
===================================================================
--- scummvm/trunk/engines/agi/id.cpp	2006-12-19 01:06:45 UTC (rev 24876)
+++ scummvm/trunk/engines/agi/id.cpp	2006-12-19 01:11:41 UTC (rev 24877)
@@ -29,308 +29,15 @@
 
 namespace Agi {
 
-/*
- * Determine what AGI v2 system to emulate, these are the major version
- * to emulate, thus 2.915 comes under 2.917, 2.4xxx is 2.440, etc.
- *
- * 0x2089
- * 0x2272
- * 0x2440
- * 0x2917
- * 0x2936
- */
-
-const char *ids_database = 
-"# CRC	 Int Ver  [options] Game name			# Comment						\n"
-"																				\n"
-"#----------------------------------------------------------------------------	\n"
-"# PC-DOS versions																\n"
-"#----------------------------------------------------------------------------	\n"
-"																				\n"
-"0x484AA  0x2440  AGI Demo 1 (PC) 05/87 [AGI 2.425]	# A.K.A. Demo 5				\n"
-"0x8CC43  0x2917  AGI Demo 2 (PC 5.25) 11/87 [v1] [AGI 2.915]	# Demo 1		\n"
-"0x8856C  0x2917  AGI Demo 2 (PC 3.5) 11/87 [AGI 2.915]							\n"
-"0x843AC  0x2917  AGI Demo 2 (PC 5.25) 01/88 [v2] [AGI 2.917]	# Demo 3		\n"
-"0x89592  0x3149  AGI Demo 3 (PC) 09/88 [AGI 3.002.102]		# Demo 4			\n"
-"0x24A18  0x2440  Black Cauldron (PC) 2.00 6/14/87 [AGI 2.439]					\n"
-"0x22B50  0x3149  Black Cauldron (PC 5.25) 2.10 11/10/88 [AGI 3.002.098]		\n"
-"0x23E0E  0x3149  Black Cauldron (PC 3.5) 2.10 11/10/88 [AGI 3.002.098]			\n"
-"0xB5A25  0x3149  Gold Rush! (PC 5.25) 2.01 12/22/88 [AGI 3.002.149]			\n"
-"0xB1C9E  0x3149  Gold Rush! (PC 3.5) 2.01 12/22/88 [AGI 3.002.149]				\n"
-"0x49EDA  0x2917  King's Quest 1 (PC 5.25/3.5) 2.0F [AGI 2.917] # also 2.425	\n"
-"0x633CB  0x2440  King's Quest 2 (PC 5.25/3.5) 2.1 [AGI 2.411]					\n"
-"0x63338  0x2917  King's Quest 2 (PC 5.25/3.5) 2.2 [AGI 2.426]	 # also 2.917	\n"
-"0x88673  0x2272  King's Quest 3 (PC) 1.01 11/08/86 [AGI 2.272]					\n"
-"0x840D3  0x2440  King's Quest 3 (PC 5.25) 2.00 5/25/87 [AGI 2.435]				\n"
-"0x83191  0x2440  King's Quest 3 (PC 3.5) 2.00 5/25/87 [AGI 2.435]				\n"
-"0x83695  0x2936  King's Quest 3 (PC 3.5) 2.14 3/15/88 [AGI 2.936]				\n"
-"0x8410B  0x2936  King's Quest 3 (PC 5.25) 2.14 3/15/88 [AGI 2.936]				\n"
-"0xB124B  0x3086  King's Quest 4 (PC 3.5) 2.0 7/27/88 [AGI 3.002.086]			\n"
-"0xB291F  0x3086  King's Quest 4 (PC 3.5) 2.2 9/27/88 [AGI 3.002.086]			\n"
-"0xB3722  0x3086  King's Quest 4 (PC 5.25) 2.3 9/27/88 [AGI 3.002.086]			\n"
-"0x9CB15  0x3149  King's Quest 4 demo (PC) [AGI 3.002.102]						\n"
-"0x6F5E1  0x2440  Leisure Suit Larry 1 (PC 5.25/3.5) 1.00 6/1/87 [AGI 2.440]	\n"
-"0x4C16D  0x3149  Manhunter NY (PC 5.25) 1.22 8/31/88 [AGI 3.002.107] # also 3.003.102	\n"
-"0x49687  0x3149  Manhunter NY (PC 3.5) 1.22 8/31/88 [AGI 3.002.102]			\n"
-"0x53971  0x3149  Manhunter SF (PC 3.5) 3.02 7/26/89 [AGI 3.002.149]			\n"
-"0x584F9  0x3149  Manhunter SF (PC 5.25) 3.03 8/17/89 [AGI 3.002.149]			\n"
-"0x5D77C  0x2917  Mixed-Up Mother Goose (PC) [AGI 2.915]						\n"
-"0x5D7C6  0x2917  Mixed Up Mother Goose (PC) [AGI 2.915] (Broken)				\n"
-"0x7F18B  0x2917  Police Quest 1 (PC) 2.0A 10/23/87 [AGI 2.903/2.911]			\n"
-"0x7EF35  0x2917  Police Quest 1 (PC) 2.0E 11/17/87 [AGI 2.915]					\n"
-"0x7EF06  0x2917  Police Quest 1 (PC 5.25/ST) 2.0G 12/03/87 [AGI 2.917]			\n"
-"0x7E0BC  0x2917  Police Quest 1 (PC 3.5) 2.0G 12/03/87 [AGI 2.917]				\n"
-"0x67FCC  0x2089  Space Quest 1 (PC) 1.0 [AGI 2.089]							\n"
-"0x68036  0x2089  Space Quest 1 (PC) 1.0X [AGI 2.089]							\n"
-"0x67F6E  0x2272  Space Quest 1 (PC) 1.1A [AGI 2.272]							\n"
-"0x68244  0x2440  Space Quest 1 (PC 5.25/3.5) 2.2 [AGI 2.426/2.917]				\n"
-"0x8DB32  0x2917  Space Quest 2 (PC 5.25) 2.0A [AGI 2.912]						\n"
-"0x8D825  0x2917  Space Quest 2 (PC 3.5) 2.0A [AGI 2.912]						\n"
-"0x8DA3E  0x2917  Space Quest 2 (PC 5.25/ST) 2.0C/A [AGI 2.915]					\n"
-"0x8E6A7  0x2917  Space Quest 2 (PC 3.5) 2.0C/B [AGI 2.917]						\n"
-"0x8E29B  0x2936  Space Quest 2 (PC 3.5) 2.0F [AGI 2.936]						\n"
-"0x8DF84  0x2936  Space Quest 2 (PC 5.25) 2.0D [AGI 2.936]						\n"
-"0x8DE46  0x2936  Space Quest 2 (PC 3.5) 2.0D [AGI 2.936]						\n"
-"0x8E310  0x2936  Space Quest 2 (PC 5.25) 2.0F [AGI 2.936]						\n"
-"0x31677  0x2272  Xmas Card 1986 (PC) [AGI 2.272]								\n"
-"																				\n"
-"#----------------------------------------------------------------------------	\n"
-"# Apple //gs versions															\n"
-"# all guessed interpreter versions												\n"
-"#																				\n"
-"# Notes:																		\n"
-"# - (CE) in Apple IIgs versions stands for Carlos Escobar --PDD				\n"
-"#----------------------------------------------------------------------------	\n"
-"																				\n"
-"0x93260  0x2917  AGI Demo 2 (IIgs) 1.0C (Censored)								\n"
-"0x285FB  0x3149  Black Cauldron (Apple IIgs) 1.0O 2/24/89 (CE)	# 2.24.89 (CE)	\n"
-"0xB6F67  0x3149  Gold Rush! (Apple IIgs) 1.0M 2/28/89 (CE) aka 2.01 12/22/88	\n"
-"0x4A9E8  0x2272  King's Quest 1 (IIgs) 1.0S-88223								\n"
-"0x79D1B  0x2917  King's Quest 2 (IIgs) 2.0A 6/16/88 (CE)						\n"
-"0x85CD4  0x2917  King's Quest 3 (IIgs) 2.0A 8/28/88 (CE)						\n"
-"0xAF778  0x3086  King's Quest 4 (IIgs) 1.0K 11/22/88 (CE)						\n"
-"0x6E41E  0x2440  Leisure Suit Larry 1 (IIgs) 1.0E								\n"
-"0x4C705  0x3149  Manhunter NY (IIgs) 2.0E 10/05/88 (CE)						\n"
-"0x5F4E8  0x2917  Mixed Up Mother Goose (IIgs)									\n"
-"0x7DB3F  0x2917  Police Quest 1 (IIgs) 2.0A-88318								\n"
-"0x7DBE5  0x2917  Police Quest 1 (IIgs) 2.0B-88421								\n"
-"0x69EC0  0x2917  Space Quest 1 (IIgs) 2.2										\n"
-"0x8E983  0x2936  Space Quest 2 (IIgs) 2.0A 7/25/88 (CE)						\n"
-"																				\n"
-"#----------------------------------------------------------------------------	\n"
-"# Macintosh versions															\n"
-"# all guessed interpreter versions												\n"
-"#----------------------------------------------------------------------------	\n"
-"																				\n"
-"0x4C02C  0x2440  King's Quest 1 (Mac) 2.0C										\n"
-"0x6382E  0x2440  King's Quest 2 (Mac) 2.0R										\n"
-"0x8410B  0x2440  King's Quest 3 (Mac) 2.14 3/15/88								\n"
-"0x78202  0x2440  Leisure Suit Larry 1 (Mac) 1.05 6/26/87						\n"
-"0x7EF06  0x2440  Police Quest 1 (Mac) 2.0G 12/3/87								\n"
-"0x6A277  0x2440  Space Quest 1 (Mac) 1.5D										\n"
-"0x8DF84  0x2936  Space Quest 2 (Mac) 2.0D										\n"
-"																				\n"
-"#----------------------------------------------------------------------------	\n"
-"# Atari ST versions															\n"
-"# all guessed interpreter versions												\n"
-"#																				\n"
-"# Notes:																		\n"
-"# - Chris Iden wrote the Atari ST port of AGI --PDD							\n"
-"#----------------------------------------------------------------------------	\n"
-"																				\n"
-"0x1A7AF  0x2272  Donald Duck's Playground (ST) 1.0A 8/8/86						\n"
-"0x4A079  0x2272  King's Quest 1 (ST) 1.0V										\n"
-"0x882B7  0x2272  King's Quest 3 (ST) 1.02 11/18/86								\n"
-"0xB68AB  0x3149  Gold Rush! (ST) 1.01 1/13/89 aka 2.01 12/22/88				\n"
-"0x6F7E1  0x2440  Leisure Suit Larry 1 (ST) 1.04 6/18/87						\n"
-"0x4CE19  0x3149  Manhunter NY (ST) 1.03 10/20/88								\n"
-"0x5360B  0x3149  Manhunter SF (ST) 1.0 7/29/89									\n"
-"0x69597  0x2440  Space Quest 1 (ST) 1.1A										\n"
-"																				\n"
-"#----------------------------------------------------------------------------	\n"
-"# Amiga versions																\n"
-"# Use option -A- to enable padding												\n"
-"#																				\n"
-"# Notes:																		\n"
-"# - Amiga KQ3 (2.333) seems to need interpreter version 3.002.086				\n"
-"#----------------------------------------------------------------------------	\n"
-"																				\n"
-"0x25640  0x2440  [A] Black Cauldron (Amiga) 2.00 6/14/87	# guessed int		\n"
-"0x1AFBA  0x2272  [A] Donald Duck's Playground (Amiga) 1.0C	# guessed int		\n"
-"0xB3E1A  0x3149  [A] Gold Rush! (Amiga) 1.01 1/13/89 aka 2.05 3/9/89	# 2.316	\n"
-"0x49C6B  0x2440  [A] King's Quest 1 (Amiga) 1.0U		# 2.082					\n"
-"0x5D395  0x2440  [A] King's Quest 2 (Amiga) 2.0J		# guessed int			\n"
-"0x5BCE6  0x2440  [A] King's Quest 2 (Amiga) 2.0J (Broken)						\n"
-"0x5F4B9  0x2440  [A] King's Quest 2 (Amiga) 2.0J (Broken)	# 2.176				\n"
-"0x888C1  0x2440  [A] King's Quest 3 (Amiga) 1.01 11/8/86						\n"
-"0x84793  0x3086  [A] King's Quest 3 (Amiga) 2.15 11/15/89	# 2.333				\n"
-"0x6FDDB  0x2440  [A] Leisure Suit Larry 1 (Amiga) 1.05 6/26/87	# x.yyy			\n"
-"0x4BA94  0x3149  [A] Manhunter NY (Amiga) 1.06 3/18/89		# x.yyy				\n"
-"0x53D51  0x3086  [A] Manhunter SF (Amiga) 3.06 8/17/89		# 2.333				\n"
-"0x5CFB1  0x3086  [A] Mixed-Up Mother Goose (Amiga) 1.1		# guessed int		\n"
-"0x7F752  0x3149  [A] Police Quest 1 (Amiga) 2.0B 2/22/89	# 2.310				\n"
-"0x696DD  0x2440  [A] Space Quest 1 (Amiga) 1.2			# 2.082					\n"
-"0x8FEA6  0x2936  [A] Space Quest 2 (Amiga) 2.0F			# 2.202				\n"
-"																				\n"
-"#----------------------------------------------------------------------------	\n"
-"# CoCo versions																\n"
-"# what version of DOS AGI does CoCo 2.023 correspond with?						\n"
-"# guessing 2.272 because the PC version 1.0 is 2.272; doesn't fit date though	\n"
-"#																				\n"
-"# Notes:																		\n"
-"# - Chris Iden wrote the CoCo port of AGI --PDD								\n"
-"#----------------------------------------------------------------------------	\n"
-"																				\n"
-"0x7CBE8  0x2272  King's Quest 3 (CoCo3) 1.0C 6/27/88		# 2.023				\n"
-"0x70D35  0x2440  Leisure Suit Larry 1 (CoCo3)									\n"
-"																				\n"
-"#----------------------------------------------------------------------------	\n"
-"# AGDS games																	\n"
-"# Use option -a- for AGDS games												\n"
-"#----------------------------------------------------------------------------	\n"
-"																				\n"
-"0x5501A	    0x2440	[a] Groza			# AGDS sample game					\n"
-"																				\n"
-"#----------------------------------------------------------------------------	\n"
-"# Fan-made AGI games															\n"
-"#----------------------------------------------------------------------------	\n"
-"																				\n"
-"0x3F2F7     0x2917	[m] AGI Mouse 0.7 Demo										\n"
-"0x3F744	 0x2917	[m] AGI Mouse 1.0 Demo		# 2.917  6/24/00				\n"
-"0x3F74F	 0x2917	[m] AGI Mouse 1.1 Demo		# 2.917  1/01/01				\n"
-"0x17599     0x2917	[m] Sliding Tile Game v1.00	# 2.917  6/02/01				\n"
-"0x785c4     0x2936	[m] Jolimie v0.6		# 2.936  2000						\n"
-"#Jolimie uses AGIPal only and not AGIMouse; no way to separate these currently	\n"
-"0x40D80     0x2440	AGI Trek			# 2.440  9/21/98						\n"
-"0x64CB7     0x2440	Space Trek 1.0			# 2.440  12/13/98					\n"
-"0x6596A     0x2917	Space Trek (remake)		# 2.917  6/09/99					\n"
-"0x96909     0x2917	Operation: RECON teaser 1.1	#								\n"
-"0x185A6     0x2917	AGI Piano v1.0			#   ?    1998						\n"
-"0x91ACF     0x2917	Dave's Quest .07		#   ?								\n"
-"0x620F6     0x2917	Time Quest demo D0.2		#   ?    1998					\n"
-"0x7466F     0x2917	Tex McPhilip I			#   ?    2000						\n"
-"0x9E400     0x2917	Tex McPhilip II			#   ?    2000						\n"
-"0xAB9A8     0x2917	Justin Quest 1.0		# 2.917								\n"
-"0x7D473     0x2917	The Ruby Cast demo 0.2		# 2.917  1998					\n"
-"0xB4D7A     0x2917	Residence 44 Quest 1.0a		# 2.917  1999					\n"
-"0x5D077     0x2917	Escape Quest demo		#   ?    1998						\n"
-"0x5A434     0x2917	Acidopolis (1.0) demo		#   ?							\n"
-"0x45CDF     0x2917	Go West, Young Hippie demo	# 2.917							\n"
-"0x4C9DC     0x2917	Speeder Bike Challenge v1.0	#   ?							\n"
-"0x112BF9    0x2917	Space Quest 0: Replicated 1.04	#        6/27/2003			\n"
-"0x6E70F     0x2917	Space Quest: The Lost Chapter v10.0							\n"
-"0x5859E     0x2917	Phantasmagoria												\n"
-"0x7B5DF     0x2917	Dashiki demo												\n"
-"0x9405B     0x2917	Dashiki 256-color demo (Unsupported)						\n"
-"0x6ADCD     0x2917	Jen's Quest 0.1 demo										\n"
-"0x4EE64     0x2917	Monkey Man													\n"
-"";
-
-uint32 AgiEngine::match_crc(uint32 crc, char *name, int len) {
-	char *c, *t, buf[256];
-	uint32 id, ver;
-
-	Common::MemoryReadStream f((const byte *)ids_database, strlen(ids_database));
-
-	while (!f.eos()) {
-		f.readLine(buf, 256);
-		c = strchr(buf, '#');
-		if (c)
-			*c = 0;
-
-		/* Remove spaces/tabs at end of line */
-		if (strlen(buf)) {
-			int i;
-			for (i = strlen(buf) - 1;
-				 i >= 0 && (buf[i] == ' ' || buf[i] == '\t');
-				 buf[i--] = 0) { }
-		}
-
-		t = strtok(buf, " \t\r\n");
-		if (t == NULL)
-			continue;
-		id = strtoul(t, NULL, 0);
-
-		t = strtok(NULL, " \t\r\n");
-		if (t == NULL)
-			continue;
-		ver = strtoul(t, NULL, 0);
-
-		t = strtok(NULL, "\n\r");
-		for (; *t == ' ' || *t == '\t'; t++);
-
-		if (id == crc) {
-			/* Now we must check options enclosed in brackets
-			 * like [A] for Amiga
-			 */
-
-			if (*t == '[') {
-				while (*t != ']') {
-					switch (*t++) {
-					case 'A':
-						opt.amiga = true;
-						break;
-					case 'a':
-						opt.agds = true;
-						break;
-					case 'm':
-						opt.agimouse = true;
-						break;
-					}
-				}
-				t++;
-
-				for (; (*t == ' ' || *t == '\t') && *t; t++) {
-				}
-			}
-
-			strncpy(name, t, len);
-			return ver;
-		}
-	}
-
-	return 0;
-}
-
-uint32 AgiEngine::match_version(uint32 crc) {
+int AgiEngine::v2id_game() {
 	int ver;
-	char name[80];
 
-	if ((ver = match_crc(crc, name, 80)) > 0)
-		report("AGI game detected: %s\n\n", name);
-
-	return ver;
-}
-
-int AgiEngine::v2id_game() {
-	int y, ver;
-	uint32 len, c, crc;
-	uint8 *buff;
-	Common::File fp;
-	const char *fn[] = { "viewdir", "logdir", "picdir", "snddir", "words.tok", "object", "" };
-
-	buff = (uint8 *)malloc(8192);
-
-	for (crc = y = 0; fn[y][0]; y++) {
-		if (fp.open(fn[y])) {
-			for (len = 1; len > 0;) {
-				memset(buff, 0, 8192);
-				len = fp.read(buff, 8000);
-				for (c = 0; c < len; c++)
-					crc += *(buff + c);
-			}
-			fp.close();
-		}
-	}
-	free(buff);
-
-	report("Computed CRC: 0x%05x\n", crc);
-	ver = match_version(crc);
-	game.crc = crc;
+	ver = this->_gameDescription->version;
 	game.ver = ver;
 	debugC(2, kDebugLevelMain, "game.ver = 0x%x", game.ver);
 	agiSetRelease(ver);
-	return setup_v2_game(ver, crc);
+
+	return setup_v2_game(ver, 0);
 }
 
 /*
@@ -342,53 +49,14 @@
  */
 
 int AgiEngine::v3id_game() {
-	int ec = err_OK, y, ver;
-	uint32 len, c, crc;
-	uint8 *buff;
-	Common::File fp;
-	const char *fn[] = { "words.tok", "object", "" };
-	Common::String path;
+	int ver;
 
-	buff = (uint8 *)malloc(8192);
-
-	for (crc = 0, y = 0; fn[y][0] != 0x0; y++) {
-		if (fp.open(fn[y])) {
-			len = 1;
-			while (len > 0) {
-				memset(buff, 0, 8192);
-				len = fp.read(buff, 8000);
-				for (c = 0; c < len; c++)
-					crc += *(buff + c);
-			}
-			fp.close();
-		}
-	}
-
-	/* now do the directory file */
-
-	path = Common::String(game.name) + DIR_;
-
-	if (fp.open(path)) {
-		for (len = 1; len > 0;) {
-			memset(buff, 0, 8192);
-			len = fp.read(buff, 8000);
-			for (c = 0; c < len; c++)
-				crc += *(buff + c);
-		}
-		fp.close();
-	}
-
-	free(buff);
-
-	report("Computed CRC: 0x%05x\n", crc);
-	ver = match_version(crc);
-	game.crc = crc;
+	ver = this->_gameDescription->version;
 	game.ver = ver;
+	debugC(2, kDebugLevelMain, "game.ver = 0x%x", game.ver);
 	agiSetRelease(ver);
 
-	ec = setup_v3_game(ver, crc);
-
-	return ec;
+	return setup_v3_game(ver, 0);
 }
 
 /**

Modified: scummvm/trunk/engines/agi/module.mk
===================================================================
--- scummvm/trunk/engines/agi/module.mk	2006-12-19 01:06:45 UTC (rev 24876)
+++ scummvm/trunk/engines/agi/module.mk	2006-12-19 01:11:41 UTC (rev 24877)
@@ -1,6 +1,7 @@
 MODULE := engines/agi
 
 MODULE_OBJS = \
+	detection.o \
 	agi.o \
 	agi_v2.o \
 	agi_v3.o \
@@ -31,10 +32,11 @@
 	view.o \
 	words.o
 
+
 # This module can be built as a plugin
 ifdef BUILD_PLUGINS
 PLUGIN := 1
 endif
 
-# Include common rules 
+# Include common rules
 include $(srcdir)/rules.mk


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list