[Scummvm-git-logs] scummvm master -> 3ebdf3a2dfe8562a44d3e397221f560e651dd626

dreammaster paulfgilbert at gmail.com
Thu Feb 20 03:23:19 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3ebdf3a2df ULTIMA8: Remove original game detector


Commit: 3ebdf3a2dfe8562a44d3e397221f560e651dd626
    https://github.com/scummvm/scummvm/commit/3ebdf3a2dfe8562a44d3e397221f560e651dd626
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-19T19:22:36-08:00

Commit Message:
ULTIMA8: Remove original game detector

Changed paths:
  R engines/ultima/ultima8/games/game_detector.cpp
  R engines/ultima/ultima8/games/game_detector.h
  R engines/ultima/ultima8/games/game_md5.h
    engines/ultima/module.mk
    engines/ultima/ultima8/kernel/core_app.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index bc1679a..37e0cac 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -352,7 +352,6 @@ MODULE_OBJS := \
 	ultima8/filesys/u8_save_file.o \
 	ultima8/games/game.o \
 	ultima8/games/game_data.o \
-	ultima8/games/game_detector.o \
 	ultima8/games/game_info.o \
 	ultima8/games/remorse_game.o \
 	ultima8/games/start_u8_process.o \
diff --git a/engines/ultima/ultima8/games/game_detector.cpp b/engines/ultima/ultima8/games/game_detector.cpp
deleted file mode 100644
index f05f539..0000000
--- a/engines/ultima/ultima8/games/game_detector.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/* 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 "ultima/ultima8/misc/pent_include.h"
-
-#include "ultima/ultima8/games/game_detector.h"
-#include "ultima/ultima8/filesys/file_system.h"
-#include "ultima/ultima8/games/game_info.h"
-#include "ultima/ultima8/filesys/raw_archive.h"
-#include "ultima/ultima8/games/game_md5.h"
-#include "ultima/ultima8/misc/md5.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-bool GameDetector::detect(Std::string path, GameInfo *info) {
-	FileSystem *fs = FileSystem::get_instance();
-	if (!fs->AddVirtualPath("@detect", path))
-		return false;
-
-	IDataSource *ids;
-
-
-	// Strategy: find eusecode.flx, fusecode.flx or gusecode.flx,
-	// compute its MD5, and check it against our MD5 table.
-	// Should that fail, try a manual check to at least identify the
-	// game type and its language.
-
-	ids = fs->ReadFile("@detect/usecode/eusecode.flx");
-	if (!ids)
-		ids = fs->ReadFile("@detect/usecode/fusecode.flx");
-	if (!ids)
-		ids = fs->ReadFile("@detect/usecode/gusecode.flx");
-	if (!ids)
-		ids = fs->ReadFile("@detect/usecode/jusecode.flx");
-	if (!ids)
-		return false; // all games have usecode
-
-	md5_file(ids, info->_md5, 0);
-	delete ids;
-
-	Std::string md5s = info->getPrintableMD5();
-
-	int i = 0;
-	while (md5table[i].md5) {
-		if (md5s == md5table[i].md5) {
-			info->_type = md5table[i].type;
-			info->_language = md5table[i].language;
-			info->version = md5table[i].version;
-			return true;
-		}
-		i++;
-	}
-
-	perr << "MD5-based game autodetection failed (" << md5s << "). "
-	     << Std::endl << "Trying manual detection." << Std::endl;
-
-
-
-	// game type
-	if (info->_type == GameInfo::GAME_UNKNOWN) {
-
-		ids = fs->ReadFile("@detect/static/u8gumps.flx"); // random U8 file
-		if (ids) {
-			info->_type = GameInfo::GAME_U8;
-			delete ids;
-			ids = 0;
-		}
-
-	}
-
-	if (info->_type == GameInfo::GAME_UNKNOWN) {
-
-		ids = fs->ReadFile("@detect/static/help1.dat"); // random remorse file
-		if (ids) {
-			info->_type = GameInfo::GAME_REMORSE;
-			delete ids;
-			ids = 0;
-		}
-
-	}
-
-	if (info->_type == GameInfo::GAME_UNKNOWN) {
-
-		ids = fs->ReadFile("@detect/static/help1.bmp"); // random regret file
-		if (ids) {
-			info->_type = GameInfo::GAME_REGRET;
-			delete ids;
-			ids = 0;
-		}
-
-	}
-
-	//TODO: game version
-	info->version = 999;
-
-
-	// game language
-
-	// detect using eusecode/fusecode/gusecode
-	if (info->_language == GameInfo::GAMELANG_UNKNOWN) {
-		ids = fs->ReadFile("@detect/usecode/eusecode.flx");
-		if (ids) {
-			if (info->_type == GameInfo::GAME_U8) {
-				// distinguish between english and spanish
-				RawArchive *f = new RawArchive(ids);
-				const char *buf = reinterpret_cast<const char *>((f->get_object_nodel(183)));
-				int size = f->get_size(183);
-				if (buf) {
-					for (i = 0; i + 9 < size; ++i) {
-						if (strncmp(buf + i, "tableware", 9) == 0) {
-							info->_language = GameInfo::GAMELANG_ENGLISH;
-							break;
-						}
-						if (strncmp(buf + i, "vajilla", 7) == 0) {
-							info->_language = GameInfo::GAMELANG_SPANISH;
-							break;
-						}
-					}
-				}
-				delete f;
-				ids = 0; // ids is deleted when f is deleted
-			}
-
-			// if still unsure, English
-			if (info->_language == GameInfo::GAMELANG_UNKNOWN)
-				info->_language = GameInfo::GAMELANG_ENGLISH;
-
-			delete ids;
-			ids = 0;
-		}
-	}
-	if (info->_language == GameInfo::GAMELANG_UNKNOWN) {
-		ids = fs->ReadFile("@detect/usecode/fusecode.flx");
-		if (ids) {
-			info->_language = GameInfo::GAMELANG_FRENCH;
-			delete ids;
-			ids = 0;
-		}
-	}
-	if (info->_language == GameInfo::GAMELANG_UNKNOWN) {
-		ids = fs->ReadFile("@detect/usecode/gusecode.flx");
-		if (ids) {
-			info->_language = GameInfo::GAMELANG_GERMAN;
-			delete ids;
-			ids = 0;
-		}
-	}
-	if (info->_language == GameInfo::GAMELANG_UNKNOWN) {
-		ids = fs->ReadFile("@detect/usecode/jusecode.flx");
-		if (ids) {
-			info->_language = GameInfo::GAMELANG_JAPANESE;
-			delete ids;
-			ids = 0;
-		}
-	}
-
-	fs->RemoveVirtualPath("@detect");
-
-	return (info->_type != GameInfo::GAME_UNKNOWN &&
-	        /* info->version != 0 && */
-	        info->_language != GameInfo::GAMELANG_UNKNOWN);
-}
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
diff --git a/engines/ultima/ultima8/games/game_detector.h b/engines/ultima/ultima8/games/game_detector.h
deleted file mode 100644
index ff2d777..0000000
--- a/engines/ultima/ultima8/games/game_detector.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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.
- *
- */
-
-#ifndef ULTIMA8_GAMES_GAMEDETECTOR_H
-#define ULTIMA8_GAMES_GAMEDETECTOR_H
-
-namespace Ultima {
-namespace Ultima8 {
-
-struct GameInfo;
-
-class GameDetector {
-public:
-	//! try to detect type, version and language of game
-	//! \param path Path where game is located
-	//! \param gameinfo GameInfo struct to store data in
-	//! \return true if detected succesfully
-	static bool detect(Std::string path, GameInfo *gameinfo);
-};
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima8/games/game_md5.h b/engines/ultima/ultima8/games/game_md5.h
deleted file mode 100644
index 46ebc91..0000000
--- a/engines/ultima/ultima8/games/game_md5.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* 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.
- *
- */
-
-// md5's of the [efg]usecode.flx file of various versions of
-// Ultima 8, Crusader: No Remorse and Crusader: No Regret
-
-#include "ultima/ultima8/games/game_info.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-struct GameMD5Entry {
-	GameInfo::GameType type;
-	GameInfo::GameLanguage language;
-	int version;
-	const char *md5;
-};
-
-
-static GameMD5Entry md5table[] = {
-	// U8, 2.10
-	{
-		GameInfo::GAME_U8, GameInfo::GAMELANG_ENGLISH, 210,
-		"da13af19e2b7f4e6a5efbaffff371030"
-	},
-	{
-		GameInfo::GAME_U8, GameInfo::GAMELANG_FRENCH, 210,
-		"05f867efd6eebd2deac05d50464ac1e5"
-	},
-	{
-		GameInfo::GAME_U8, GameInfo::GAMELANG_GERMAN, 210,
-		"cf6815f9b65b7530b6c43d7f23a11afc"
-	},
-	{
-		GameInfo::GAME_U8, GameInfo::GAMELANG_SPANISH, 210,
-		"d075ac78cd75529142325ab0b80ed813"
-	},
-
-	// U8, 2.12
-	{
-		GameInfo::GAME_U8, GameInfo::GAMELANG_ENGLISH, 212,
-		"34cd320c4b780e59ae7fab40ab4338f1"
-	},
-	{
-		GameInfo::GAME_U8, GameInfo::GAMELANG_FRENCH, 212,
-		"9675900bd1a9c9f72b331e84a6cdbc23"
-	},
-	{
-		GameInfo::GAME_U8, GameInfo::GAMELANG_GERMAN, 212,
-		"473991399cfb176b0df6f088d30301c5"
-	},
-	{
-		GameInfo::GAME_U8, GameInfo::GAMELANG_JAPANESE, 212,
-		"304a315f7a436d18397c4ec544585f7e"
-	},
-
-	// U8, 2.13
-	{
-		GameInfo::GAME_U8, GameInfo::GAMELANG_ENGLISH, 213,
-		"09e6916fdd404ce910eb19b6acf96383"
-	},
-	{
-		GameInfo::GAME_U8, GameInfo::GAMELANG_FRENCH, 213,
-		"2dd7355009021ebc85803b7227fcea4c"
-	},
-	{
-		GameInfo::GAME_U8, GameInfo::GAMELANG_GERMAN, 213,
-		"7aeab4a5f84dd6264d2ff80c5bdcebd4"
-	},
-
-
-	// Remorse, 1.01
-	{
-		GameInfo::GAME_REMORSE, GameInfo::GAMELANG_ENGLISH, 101,
-		"e3b09cbe08b18b45767739a37ee5c239"
-	},
-
-	// Remorse, 1.07
-	{
-		GameInfo::GAME_REMORSE, GameInfo::GAMELANG_GERMAN, 107,
-		"a82ecab20a8f0f79a1fb2e803ac67b0d"
-	},
-
-	// Remorse, 1.10
-	{
-		GameInfo::GAME_REMORSE, GameInfo::GAMELANG_ENGLISH, 110,
-		"d41c4bd1401aaf3a1a47522fdebfd7c7"
-	},
-
-	// Remorse, 1.21
-	{
-		GameInfo::GAME_REMORSE, GameInfo::GAMELANG_ENGLISH, 121,
-		"a3c0950f44693eb5983227b4e834a3b6"
-	},
-
-
-	// Regret, 1.01
-	{
-		GameInfo::GAME_REGRET, GameInfo::GAMELANG_ENGLISH, 101,
-		"ddd81cd425cd77632c3878ca97d46e75"
-	},
-
-	// Regret, 1.06
-	{
-		GameInfo::GAME_REGRET, GameInfo::GAMELANG_ENGLISH, 106,
-		"ce7b4ed2081e8bfb34bf74920a1ec254"
-	},
-	{
-		GameInfo::GAME_REGRET, GameInfo::GAMELANG_GERMAN, 106,
-		"0579a250c486a022f7336c6d02dff93d"
-	},
-
-	{ GameInfo::GAME_UNKNOWN, GameInfo::GAMELANG_UNKNOWN, 0, 0 }
-};
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
-
diff --git a/engines/ultima/ultima8/kernel/core_app.cpp b/engines/ultima/ultima8/kernel/core_app.cpp
index 7bd12ac..9a46cc7 100644
--- a/engines/ultima/ultima8/kernel/core_app.cpp
+++ b/engines/ultima/ultima8/kernel/core_app.cpp
@@ -28,7 +28,6 @@
 #include "ultima/ultima8/filesys/idata_source.h"
 #include "ultima/ultima8/misc/args.h"
 #include "ultima/ultima8/games/game_info.h"
-#include "ultima/ultima8/games/game_detector.h"
 #include "ultima/shared/std/misc.h"
 
 namespace Ultima {




More information about the Scummvm-git-logs mailing list