aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2006-11-12 03:23:29 +0000
committerMax Horn2006-11-12 03:23:29 +0000
commit1f26cb89652a5804ccace15587426ca2b9e1387d (patch)
tree105cfba6c96569f58e79a1cf9b1fedc72c76bf8a /engines
parentc7b2f4d3325942330188f04d23d4a60797c7d2c2 (diff)
downloadscummvm-rg350-1f26cb89652a5804ccace15587426ca2b9e1387d.tar.gz
scummvm-rg350-1f26cb89652a5804ccace15587426ca2b9e1387d.tar.bz2
scummvm-rg350-1f26cb89652a5804ccace15587426ca2b9e1387d.zip
Reworked code in the advanced game detector (getting rid of much of the evil #define hell it consisted of previously)
svn-id: r24685
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/game.cpp37
-rw-r--r--engines/cine/detection.cpp36
-rw-r--r--engines/kyra/plugin.cpp10
-rw-r--r--engines/saga/game.cpp33
4 files changed, 75 insertions, 41 deletions
diff --git a/engines/agos/game.cpp b/engines/agos/game.cpp
index 04860c41b4..d297dff825 100644
--- a/engines/agos/game.cpp
+++ b/engines/agos/game.cpp
@@ -54,7 +54,7 @@ static const Common::ADObsoleteGameID obsoleteGameIDsTable[] = {
{"simon2talkie", "simon2", Common::kPlatformPC},
{"simon2mac", "simon2", Common::kPlatformMacintosh},
{"simon2win", "simon2", Common::kPlatformWindows},
- {NULL, NULL, Common::kPlatformUnknown}
+ {0, 0, Common::kPlatformUnknown}
};
static const PlainGameDescriptor simonGames[] = {
@@ -68,16 +68,10 @@ static const PlainGameDescriptor simonGames[] = {
{"jumble", "Jumble"},
{"puzzle", "NoPatience"},
{"swampy", "Swampy Adventures"},
- {NULL, NULL}
+ {0, 0}
};
-ADVANCED_DETECTOR_GAMEID_LIST(AGOS, simonGames);
-
-ADVANCED_DETECTOR_FIND_GAMEID(AGOS, simonGames, obsoleteGameIDsTable);
-
-ADVANCED_DETECTOR_DETECT_GAMES(AGOS, AGOS::GAME_detectGames);
-
-ADVANCED_DETECTOR_ENGINE_CREATE(AGOS, AGOS::AGOSEngine, "AGOSEngine", obsoleteGameIDsTable);
+ADVANCED_DETECTOR_DEFINE_PLUGIN(AGOS, AGOS::AGOSEngine, AGOS::GAME_detectGames, simonGames, obsoleteGameIDsTable);
REGISTER_PLUGIN(AGOS, "AGOS", "AGOS (C) Adventure Soft");
@@ -88,10 +82,27 @@ using Common::ADGameDescription;
#include "agosgame.cpp"
-ADVANCED_DETECTOR_TO_DETECTED_GAME(simonGames);
-
-ADVANCED_DETECTOR_DETECT_INIT_GAME(AGOSEngine::initGame, gameDescriptions, _gameDescription, Common::ADTrue);
+bool AGOSEngine::initGame() {
+ int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME(
+ (const byte *)gameDescriptions,
+ sizeof(AGOSGameDescription),
+ ARRAYSIZE(gameDescriptions),
+ FILE_MD5_BYTES,
+ simonGames
+ );
+ _gameDescription = &gameDescriptions[i];
+ return true;
+}
-ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(GAME_detectGames, gameDescriptions);
+DetectedGameList GAME_detectGames(const FSList &fslist) {
+ return real_ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(
+ fslist,
+ (const byte *)gameDescriptions,
+ sizeof(AGOSGameDescription),
+ ARRAYSIZE(gameDescriptions),
+ FILE_MD5_BYTES,
+ simonGames
+ );
+}
} // End of namespace AGOS
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index 4b8ce8d804..451100ebca 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -41,17 +41,10 @@ using Common::File;
static const PlainGameDescriptor cineGames[] = {
{"fw", "Future Wars"},
{"os", "Operation Stealth"},
- {NULL, NULL}
+ {0, 0}
};
-ADVANCED_DETECTOR_GAMEID_LIST(CINE, cineGames);
-
-ADVANCED_DETECTOR_FIND_GAMEID(CINE, cineGames, NULL);
-
-ADVANCED_DETECTOR_DETECT_GAMES(CINE, Cine::GAME_detectGames);
-
-ADVANCED_DETECTOR_ENGINE_CREATE(CINE, Cine::CineEngine, "CineEngine", NULL);
-
+ADVANCED_DETECTOR_DEFINE_PLUGIN(CINE, Cine::CineEngine, Cine::GAME_detectGames, cineGames, 0);
REGISTER_PLUGIN(CINE, "Cinematique evo 1 engine", "Future Wars & Operation Stealth (C) Delphine Software");
@@ -579,10 +572,27 @@ static const CINEGameDescription gameDescriptions[] = {
};
-ADVANCED_DETECTOR_TO_DETECTED_GAME(cineGames);
-
-ADVANCED_DETECTOR_DETECT_INIT_GAME(CineEngine::initGame, gameDescriptions, _gameDescription, Common::ADTrue);
+bool CineEngine::initGame() {
+ int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME(
+ (const byte *)gameDescriptions,
+ sizeof(CINEGameDescription),
+ ARRAYSIZE(gameDescriptions),
+ FILE_MD5_BYTES,
+ cineGames
+ );
+ _gameDescription = &gameDescriptions[i];
+ return true;
+}
-ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(GAME_detectGames, gameDescriptions);
+DetectedGameList GAME_detectGames(const FSList &fslist) {
+ return real_ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(
+ fslist,
+ (const byte *)gameDescriptions,
+ sizeof(CINEGameDescription),
+ ARRAYSIZE(gameDescriptions),
+ FILE_MD5_BYTES,
+ cineGames
+ );
+}
} // End of namespace Cine
diff --git a/engines/kyra/plugin.cpp b/engines/kyra/plugin.cpp
index e63db7ee05..786c07dbfd 100644
--- a/engines/kyra/plugin.cpp
+++ b/engines/kyra/plugin.cpp
@@ -203,9 +203,13 @@ const PlainGameDescriptor gameList[] = {
} // End of anonymous namespace
-ADVANCED_DETECTOR_GAMEID_LIST(KYRA, gameList);
+GameList Engine_KYRA_gameIDList() {
+ return Common::real_ADVANCED_DETECTOR_GAMEID_LIST(gameList);
+}
-ADVANCED_DETECTOR_FIND_GAMEID(KYRA, gameList, NULL);
+GameDescriptor Engine_KYRA_findGameID(const char *gameid) {
+ return Common::real_ADVANCED_DETECTOR_FIND_GAMEID(gameid, gameList, 0);
+}
DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
DetectedGameList detectedGames;
@@ -227,14 +231,12 @@ PluginError Engine_KYRA_create(OSystem *syst, Engine **engine) {
FSList fslist;
FilesystemNode dir(ConfMan.get("path"));
if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) {
- warning("KyraEngine: invalid game path '%s'", dir.path().c_str());
return kInvalidPathError;
}
GameFlags flags;
ADList games = detectKyraGames(fslist);
if (!setupGameFlags(games, flags)) {
- warning("KyraEngine: unable to locate game data at path '%s'", dir.path().c_str());
return kNoGameDataFoundError;
}
diff --git a/engines/saga/game.cpp b/engines/saga/game.cpp
index ed5d708c1f..cda47d956c 100644
--- a/engines/saga/game.cpp
+++ b/engines/saga/game.cpp
@@ -48,13 +48,7 @@ static const PlainGameDescriptor saga_games[] = {
{0, 0}
};
-ADVANCED_DETECTOR_GAMEID_LIST(SAGA, saga_games);
-
-ADVANCED_DETECTOR_FIND_GAMEID(SAGA, saga_games, NULL);
-
-ADVANCED_DETECTOR_DETECT_GAMES(SAGA, Saga::GAME_detectGames);
-
-ADVANCED_DETECTOR_ENGINE_CREATE(SAGA, Saga::SagaEngine, "SagaEngine", NULL);
+ADVANCED_DETECTOR_DEFINE_PLUGIN(SAGA, Saga::SagaEngine, Saga::GAME_detectGames, saga_games, 0);
REGISTER_PLUGIN(SAGA, "SAGA Engine", "Inherit the Earth (C) Wyrmkeep Entertainment");
@@ -66,8 +60,6 @@ using Common::ADGameDescription;
#include "sagagame.cpp"
-ADVANCED_DETECTOR_TO_DETECTED_GAME(saga_games);
-
bool SagaEngine::postInitGame() {
_gameDisplayInfo = *_gameDescription->gameDisplayInfo;
_displayClip.right = _gameDisplayInfo.logicalWidth;
@@ -79,8 +71,27 @@ bool SagaEngine::postInitGame() {
return true;
}
-ADVANCED_DETECTOR_DETECT_INIT_GAME(SagaEngine::initGame, gameDescriptions, _gameDescription, postInitGame);
+bool SagaEngine::initGame() {
+ int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME(
+ (const byte *)gameDescriptions,
+ sizeof(SAGAGameDescription),
+ ARRAYSIZE(gameDescriptions),
+ FILE_MD5_BYTES,
+ saga_games
+ );
+ _gameDescription = &gameDescriptions[i];
+ return postInitGame();
+}
-ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(GAME_detectGames, gameDescriptions);
+DetectedGameList GAME_detectGames(const FSList &fslist) {
+ return real_ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION(
+ fslist,
+ (const byte *)gameDescriptions,
+ sizeof(SAGAGameDescription),
+ ARRAYSIZE(gameDescriptions),
+ FILE_MD5_BYTES,
+ saga_games
+ );
+}
} // End of namespace Saga