diff options
-rw-r--r-- | common/advancedDetector.cpp | 22 | ||||
-rw-r--r-- | common/advancedDetector.h | 2 | ||||
-rw-r--r-- | engines/agi/detection.cpp | 4 | ||||
-rw-r--r-- | engines/agos/agosgame.cpp | 1 | ||||
-rw-r--r-- | engines/agos/game.cpp | 2 | ||||
-rw-r--r-- | engines/cine/detection.cpp | 3 | ||||
-rw-r--r-- | engines/kyra/plugin.cpp | 5 | ||||
-rw-r--r-- | engines/saga/game.cpp | 2 | ||||
-rw-r--r-- | engines/saga/sagagame.cpp | 1 |
9 files changed, 20 insertions, 22 deletions
diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp index 9ddae9368c..24c3c13d5c 100644 --- a/common/advancedDetector.cpp +++ b/common/advancedDetector.cpp @@ -128,7 +128,6 @@ DetectedGameList real_ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION( const FSList &fslist, const byte *descs, const int descItemSize, - const int descItemCount, const int md5Bytes, const PlainGameDescriptor *list ) { @@ -136,13 +135,16 @@ DetectedGameList real_ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION( Common::AdvancedDetector AdvDetector; Common::ADList matches; Common::ADGameDescList descList; + const byte *descPtr; - for (int i = 0; i < descItemCount; i++) - descList.push_back((const ADGameDescription *)(descs + i * descItemSize)); + for (descPtr = descs; *descPtr != NULL; descPtr += descItemSize) + descList.push_back((const ADGameDescription *)descPtr); AdvDetector.registerGameDescriptions(descList); AdvDetector.setFileMD5Bytes(md5Bytes); + debug(3, "%s: cnt: %d", ((const ADGameDescription *)descs)->name, descList.size()); + matches = AdvDetector.detectGame(&fslist, Common::UNK_LANG, Common::kPlatformUnknown); for (uint i = 0; i < matches.size(); i++) @@ -154,7 +156,6 @@ DetectedGameList real_ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION( int real_ADVANCED_DETECTOR_DETECT_INIT_GAME( const byte *descs, const int descItemSize, - const int descItemCount, const int md5Bytes, const PlainGameDescriptor *list ) { @@ -164,6 +165,7 @@ int real_ADVANCED_DETECTOR_DETECT_INIT_GAME( Common::AdvancedDetector AdvDetector; Common::ADList matches; Common::ADGameDescList descList; + const byte *descPtr; Common::Language language = Common::UNK_LANG; Common::Platform platform = Common::kPlatformUnknown; @@ -175,8 +177,8 @@ int real_ADVANCED_DETECTOR_DETECT_INIT_GAME( Common::String gameid = ConfMan.get("gameid"); - for (int i = 0; i < descItemCount; i++) - descList.push_back((const ADGameDescription *)(descs + i * descItemSize)); + for (descPtr = descs; *descPtr != NULL; descPtr += descItemSize) + descList.push_back((const ADGameDescription *)descPtr); AdvDetector.registerGameDescriptions(descList); AdvDetector.setFileMD5Bytes(md5Bytes); @@ -190,8 +192,8 @@ int real_ADVANCED_DETECTOR_DETECT_INIT_GAME( } } - if (gameNumber >= descItemCount || gameNumber == -1) { - error("TODO invalid gameNumber %d (max. expected value: %d)", gameNumber, descItemCount ); + if (gameNumber >= (int)descList.size() || gameNumber == -1) { + error("TODO invalid gameNumber %d (max. expected value: %d)", gameNumber, descList.size()); } debug(2, "Running %s", toDetectedGame(*(const ADGameDescription *)(descs + gameNumber * descItemSize), list).description.c_str()); @@ -312,8 +314,10 @@ ADList AdvancedDetector::detectGame(const FSList *fslist, Language language, Pla debug(3, "Matched file: %s", tstr.c_str()); } if (!fileMissing) { - debug(2, "Found game: %s", getDescription(i).c_str()); + debug(2, "Found game: %s (%d)", getDescription(i).c_str(), i); matched[matchedCount++] = i; + } else { + debug(5, "Skipping game: %s (%d)", getDescription(i).c_str(), i); } } diff --git a/common/advancedDetector.h b/common/advancedDetector.h index 4ad26dc186..f910450a25 100644 --- a/common/advancedDetector.h +++ b/common/advancedDetector.h @@ -78,7 +78,6 @@ DetectedGameList real_ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION( const FSList &fslist, const byte *descs, const int descItemSize, - const int descItemCount, const int md5Bytes, const PlainGameDescriptor *list ); @@ -92,7 +91,6 @@ DetectedGameList real_ADVANCED_DETECTOR_DETECT_GAMES_FUNCTION( int real_ADVANCED_DETECTOR_DETECT_INIT_GAME( const byte *descs, const int descItemSize, - const int descItemCount, const int md5Bytes, const PlainGameDescriptor *list ); diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index 537158a2be..f4be487aec 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -174,14 +174,13 @@ static const AGIGameDescription gameDescriptions[] = { 0x2440, }, - + { { NULL, NULL, 0, NULL, Common::UNK_LANG, Common::kPlatformUnknown }, 0, 0, 0 } }; bool AgiEngine::initGame() { int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME( (const byte *)gameDescriptions, sizeof(AGIGameDescription), - ARRAYSIZE(gameDescriptions), FILE_MD5_BYTES, agiGames ); @@ -194,7 +193,6 @@ DetectedGameList GAME_detectGames(const FSList &fslist) { fslist, (const byte *)gameDescriptions, sizeof(AGIGameDescription), - ARRAYSIZE(gameDescriptions), FILE_MD5_BYTES, agiGames ); diff --git a/engines/agos/agosgame.cpp b/engines/agos/agosgame.cpp index fe8fbbf594..37c2ee4de9 100644 --- a/engines/agos/agosgame.cpp +++ b/engines/agos/agosgame.cpp @@ -1850,4 +1850,5 @@ static const AGOSGameDescription gameDescriptions[] = { GID_SWAMPY, GF_OLD_BUNDLE | GF_TALKIE, }, + { { NULL, NULL, 0, NULL, Common::UNK_LANG, Common::kPlatformUnknown }, 0, 0, 0 } }; diff --git a/engines/agos/game.cpp b/engines/agos/game.cpp index d297dff825..e3ddabc227 100644 --- a/engines/agos/game.cpp +++ b/engines/agos/game.cpp @@ -86,7 +86,6 @@ bool AGOSEngine::initGame() { int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME( (const byte *)gameDescriptions, sizeof(AGOSGameDescription), - ARRAYSIZE(gameDescriptions), FILE_MD5_BYTES, simonGames ); @@ -99,7 +98,6 @@ DetectedGameList GAME_detectGames(const FSList &fslist) { fslist, (const byte *)gameDescriptions, sizeof(AGOSGameDescription), - ARRAYSIZE(gameDescriptions), FILE_MD5_BYTES, simonGames ); diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp index 828c7d3462..4cedd4841b 100644 --- a/engines/cine/detection.cpp +++ b/engines/cine/detection.cpp @@ -569,13 +569,13 @@ static const CINEGameDescription gameDescriptions[] = { 0, }, + { { NULL, NULL, 0, NULL, Common::UNK_LANG, Common::kPlatformUnknown }, 0, 0 } }; bool CineEngine::initGame() { int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME( (const byte *)gameDescriptions, sizeof(CINEGameDescription), - ARRAYSIZE(gameDescriptions), FILE_MD5_BYTES, cineGames ); @@ -588,7 +588,6 @@ DetectedGameList GAME_detectGames(const FSList &fslist) { fslist, (const byte *)gameDescriptions, sizeof(CINEGameDescription), - ARRAYSIZE(gameDescriptions), FILE_MD5_BYTES, cineGames ); diff --git a/engines/kyra/plugin.cpp b/engines/kyra/plugin.cpp index 786c07dbfd..16c4f066ad 100644 --- a/engines/kyra/plugin.cpp +++ b/engines/kyra/plugin.cpp @@ -133,13 +133,14 @@ const KYRAGameDescription adGameDescs[] = { { { "The Legend of Kyrandia: The Hand of Fate", 0, ARRAYSIZE(kyra2UnknownUnknown1), kyra2UnknownUnknown1, UNK_LANG, kPlatformPC }, "kyra2", KYRA2_UNK_FLAGS }, // check this! (cd version?) - { { "The Legend of Kyrandia: Malcolm's Revenge", 0, ARRAYSIZE(kyra3CD1), kyra3CD1, UNK_LANG, kPlatformPC }, "kyra3", KYRA3_CD_FLAGS } + { { "The Legend of Kyrandia: Malcolm's Revenge", 0, ARRAYSIZE(kyra3CD1), kyra3CD1, UNK_LANG, kPlatformPC }, "kyra3", KYRA3_CD_FLAGS }, + { { NULL, NULL, 0, NULL, UNK_LANG, kPlatformUnknown }, NULL, KYRA2_UNK_FLAGS } }; ADGameDescList getADDescList() { ADGameDescList gameDesc; - for (int i = 0; i < ARRAYSIZE(adGameDescs); ++i) { + for (int i = 0; i < ARRAYSIZE(adGameDescs) - 1; ++i) { gameDesc.push_back(&adGameDescs[i].desc); } diff --git a/engines/saga/game.cpp b/engines/saga/game.cpp index cda47d956c..5e180d595f 100644 --- a/engines/saga/game.cpp +++ b/engines/saga/game.cpp @@ -75,7 +75,6 @@ bool SagaEngine::initGame() { int i = Common::real_ADVANCED_DETECTOR_DETECT_INIT_GAME( (const byte *)gameDescriptions, sizeof(SAGAGameDescription), - ARRAYSIZE(gameDescriptions), FILE_MD5_BYTES, saga_games ); @@ -88,7 +87,6 @@ DetectedGameList GAME_detectGames(const FSList &fslist) { fslist, (const byte *)gameDescriptions, sizeof(SAGAGameDescription), - ARRAYSIZE(gameDescriptions), FILE_MD5_BYTES, saga_games ); diff --git a/engines/saga/sagagame.cpp b/engines/saga/sagagame.cpp index f0b92fe552..56ad6425e4 100644 --- a/engines/saga/sagagame.cpp +++ b/engines/saga/sagagame.cpp @@ -1464,4 +1464,5 @@ static const SAGAGameDescription gameDescriptions[] = { 0, NULL, }, + { { NULL, NULL, 0, NULL, Common::UNK_LANG, Common::kPlatformUnknown }, 0, 0, 0, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL } }; |