From 1f26cb89652a5804ccace15587426ca2b9e1387d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 12 Nov 2006 03:23:29 +0000 Subject: Reworked code in the advanced game detector (getting rid of much of the evil #define hell it consisted of previously) svn-id: r24685 --- engines/saga/game.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'engines/saga') 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 -- cgit v1.2.3