diff options
author | Eugene Sandulenko | 2007-01-25 00:37:12 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2007-01-25 00:37:12 +0000 |
commit | 6eb9f41e68a2eda945f7361cd05baa84a973d4d0 (patch) | |
tree | c4f435773465efa516bf27837735032b894fe0c3 | |
parent | 30d517613ade7b36b326d3e801a350dd50a69e54 (diff) | |
download | scummvm-rg350-6eb9f41e68a2eda945f7361cd05baa84a973d4d0.tar.gz scummvm-rg350-6eb9f41e68a2eda945f7361cd05baa84a973d4d0.tar.bz2 scummvm-rg350-6eb9f41e68a2eda945f7361cd05baa84a973d4d0.zip |
Use file sizes in detection too.
svn-id: r25172
-rw-r--r-- | common/advancedDetector.cpp | 38 | ||||
-rw-r--r-- | engines/saga/sagagame.cpp | 51 | ||||
-rw-r--r-- | engines/saga/sagagame.h | 1 |
3 files changed, 72 insertions, 18 deletions
diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp index dbee275d2a..8157bb20a3 100644 --- a/common/advancedDetector.cpp +++ b/common/advancedDetector.cpp @@ -197,7 +197,9 @@ ADList AdvancedDetector::detectGame(const FSList *fslist, const Common::ADParams StringSet filesList; typedef StringMap StringMap; + typedef HashMap<String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> IntMap; StringMap filesMD5; + IntMap filesSize; String tstr, tstr2; @@ -224,6 +226,8 @@ ADList AdvancedDetector::detectGame(const FSList *fslist, const Common::ADParams if (fslist != 0) { for (FSList::const_iterator file = fslist->begin(); file != fslist->end(); ++file) { + Common::File f; + if (file->isDirectory()) continue; tstr = file->name(); tstr.toLowercase(); @@ -237,6 +241,11 @@ ADList AdvancedDetector::detectGame(const FSList *fslist, const Common::ADParams } filesMD5[tstr] = String(md5str); filesMD5[tstr2] = String(md5str); + + if (f.open(file->path())) { + filesSize[tstr] = filesSize[tstr2] = (int32)f.size(); + f.close(); + } } } else { File testFile; @@ -248,6 +257,7 @@ ADList AdvancedDetector::detectGame(const FSList *fslist, const Common::ADParams debug(3, "+ %s", tstr.c_str()); if (!filesMD5.contains(tstr)) { if (testFile.open(file->_key)) { + filesSize[tstr] = filesSize[tstr2] = (int32)testFile.size(); testFile.close(); if (md5_file(file->_key.c_str(), md5sum, params.md5Bytes)) { @@ -271,8 +281,8 @@ ADList AdvancedDetector::detectGame(const FSList *fslist, const Common::ADParams // Do not even bother to look at entries which do not have matching // language and platform (if specified). - if ((g->language != language && language != UNK_LANG) || - (g->platform != platform && platform != kPlatformUnknown)) { + if ((language != UNK_LANG && g->language != language) || + (platform != kPlatformUnknown && g->platform != platform)) { continue; } @@ -283,13 +293,25 @@ ADList AdvancedDetector::detectGame(const FSList *fslist, const Common::ADParams tstr.toLowercase(); tstr2 = tstr + "."; - if (!filesMD5.contains(tstr) && !filesMD5.contains(tstr2)) { - fileMissing = true; - break; + if (fileDesc->md5 != NULL) { + if (!filesMD5.contains(tstr) && !filesMD5.contains(tstr2)) { + fileMissing = true; + break; + } + if (strcmp(fileDesc->md5, filesMD5[tstr].c_str()) && strcmp(fileDesc->md5, filesMD5[tstr2].c_str())) { + fileMissing = true; + break; + } } - if (strcmp(fileDesc->md5, filesMD5[tstr].c_str()) && strcmp(fileDesc->md5, filesMD5[tstr2].c_str())) { - fileMissing = true; - break; + if (fileDesc->fileSize != -1) { + if (!filesMD5.contains(tstr) && !filesMD5.contains(tstr2)) { + fileMissing = true; + break; + } + if (fileDesc->fileSize != filesSize[tstr] && fileDesc->fileSize != filesSize[tstr2]) { + fileMissing = true; + break; + } } debug(3, "Matched file: %s", tstr.c_str()); } diff --git a/engines/saga/sagagame.cpp b/engines/saga/sagagame.cpp index f549d65b3a..0a790a521a 100644 --- a/engines/saga/sagagame.cpp +++ b/engines/saga/sagagame.cpp @@ -592,11 +592,11 @@ static const SAGAGameDescription gameDescriptions[] = { NULL, }, - // Inherit the earth - MAC Demo version + // Inherit the earth - MAC Demo version 2 { { "ite", - "Demo", + "Demo 2", { {"ited.rsc", GAME_RESOURCEFILE, "addfc9d82bc2fa1f4cab23743c652c08", -1}, {"scriptsd.rsc", GAME_SCRIPTFILE, "fded5c59b8b7c5976229f960d21e6b0b", -1}, @@ -623,11 +623,11 @@ static const SAGAGameDescription gameDescriptions[] = { ITEMacPatch_Files, }, - // Inherit the earth - early MAC Demo version + // Inherit the earth - MAC Demo version 1 { { "ite", - "early Demo", + "Demo 1", { {"ited.rsc", GAME_RESOURCEFILE, "addfc9d82bc2fa1f4cab23743c652c08", -1}, {"scriptsd.rsc", GAME_SCRIPTFILE, "fded5c59b8b7c5976229f960d21e6b0b", -1}, @@ -725,7 +725,7 @@ static const SAGAGameDescription gameDescriptions[] = { { {"ited.rsc", GAME_RESOURCEFILE, "3a450852cbf3c80773984d565647e6ac", -1}, {"scriptsd.rsc", GAME_SCRIPTFILE, "3f12b67fa93e56e1a6be39d2921d80bb", -1}, - {"soundsd.rsc", GAME_SOUNDFILE, "95a6c148e22e99a8c243f2978223583c", -1}, + {"soundsd.rsc", GAME_SOUNDFILE, "95a6c148e22e99a8c243f2978223583c", 2026769}, {"voicesd.rsc", GAME_VOICEFILE, "e139d86bab2ee8ba3157337f894a92d4", -1}, {"musicd.rsc", GAME_MUSICFILE, "d6454756517f042f01210458abe8edd4", -1}, { NULL, 0, NULL, 0} @@ -748,15 +748,46 @@ static const SAGAGameDescription gameDescriptions[] = { ITELinPatch_Files, }, - // Inherit the earth - Win32 Demo version + // Inherit the earth - Win32 Demo version 3 { { "ite", - "Demo", + "Demo 3", + { + {"ited.rsc", GAME_RESOURCEFILE, "3a450852cbf3c80773984d565647e6ac", -1}, + {"scriptsd.rsc", GAME_SCRIPTFILE, "3f12b67fa93e56e1a6be39d2921d80bb", -1}, + {"soundsd.rsc", GAME_SOUNDFILE, "95a6c148e22e99a8c243f2978223583c", 2005074}, + {"voicesd.rsc", GAME_VOICEFILE, "e139d86bab2ee8ba3157337f894a92d4", -1}, + {"musicd.rsc", GAME_MUSICFILE, "d6454756517f042f01210458abe8edd4", -1}, + { NULL, 0, NULL, 0} + }, + Common::EN_ANY, + Common::kPlatformWindows, + }, + GType_ITE, + GID_ITE_WINDEMO3, + GF_WYRMKEEP | GF_CD_FX | GF_SCENE_SUBSTITUTES, + &ITE_DisplayInfo, + ITE_DEFAULT_SCENE, + &ITE_Resources, + ARRAYSIZE(ITEWINDEMO_GameFonts), + ITEWINDEMO_GameFonts, + &ITEWINDEMO2_GameVoice, + &ITEWINDEMO2_GameSound, + &ITELINDEMO_GameMusic, + ARRAYSIZE(ITEWinPatch2_Files), + ITEWinPatch2_Files, + }, + + // Inherit the earth - Win32 Demo version 2 + { + { + "ite", + "Demo 2", { {"ited.rsc", GAME_RESOURCEFILE, "3a450852cbf3c80773984d565647e6ac", -1}, {"scriptsd.rsc", GAME_SCRIPTFILE, "3f12b67fa93e56e1a6be39d2921d80bb", -1}, - {"soundsd.rsc", GAME_SOUNDFILE, "95a6c148e22e99a8c243f2978223583c", -1}, + {"soundsd.rsc", GAME_SOUNDFILE, "95a6c148e22e99a8c243f2978223583c", 2005074}, {"voicesd.rsc", GAME_VOICEFILE, "e139d86bab2ee8ba3157337f894a92d4", -1}, { NULL, 0, NULL, 0} }, @@ -778,11 +809,11 @@ static const SAGAGameDescription gameDescriptions[] = { ITEWinPatch2_Files, }, - // Inherit the earth - early Win32 Demo version + // Inherit the earth - Win32 Demo version 1 { { "ite", - "early Demo", + "Demo 1", { {"ited.rsc", GAME_RESOURCEFILE, "3a450852cbf3c80773984d565647e6ac", -1}, {"scriptsd.rsc", GAME_SCRIPTFILE, "3f12b67fa93e56e1a6be39d2921d80bb", -1}, diff --git a/engines/saga/sagagame.h b/engines/saga/sagagame.h index 593ad30ecb..cd4aa48faf 100644 --- a/engines/saga/sagagame.h +++ b/engines/saga/sagagame.h @@ -22,6 +22,7 @@ enum GameIds { GID_ITE_MACDEMO1, // older Wyrmkeep mac demo GID_ITE_LINDEMO, GID_ITE_WINDEMO2, + GID_ITE_WINDEMO3, GID_ITE_MACDEMO2, // German |