diff options
author | Johannes Schickel | 2010-10-13 03:57:44 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-10-13 03:57:44 +0000 |
commit | 75e8452b6e6a2bf4fb2f588aa00b428a60d873b5 (patch) | |
tree | f29541d55309487a94bd1d38e8b53bb3dde9aec6 /engines/advancedDetector.cpp | |
parent | 48ee83b88957dab86bc763e9ef21a70179fa8679 (diff) | |
parent | e9f50882ea5b6beeefa994040be9d3bab6a1f107 (diff) | |
download | scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.gz scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.bz2 scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.zip |
OPENGL: Merged from trunk, from rev 52105 to 53396.
This includes an rather hacky attempt to merge all the recent gp2x backend
changes into the branch. I suppose the gp2x backend and probably all new
backends, i.e. gph, dingux etc., might not compile anymore.
Since I have no way of testing those it would be nice if porters could look
into getting those up to speed in this branch.
svn-id: r53399
Diffstat (limited to 'engines/advancedDetector.cpp')
-rw-r--r-- | engines/advancedDetector.cpp | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index f4af4a8500..22212675c7 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -214,10 +214,36 @@ static void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription * desc.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::EN_ANY)); } +bool cleanupPirated(ADGameDescList &matched) { + // OKay, now let's sense presense of pirated games + if (!matched.empty()) { + for (uint j = 0; j < matched.size();) { + if (matched[j]->flags & ADGF_PIRATED) + matched.remove_at(j); + else + ++j; + } + + // We ruled out all variants and now have nothing + if (matched.empty()) { + + warning("Illegitimate copy of the game detected. We give no support in such cases %d", matched.size()); + + return true; + } + } + + return false; +} + + GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const { ADGameDescList matches = detectGame(fslist, params, Common::UNK_LANG, Common::kPlatformUnknown, ""); GameList detectedGames; + if (cleanupPirated(matches)) + return detectedGames; + // Use fallback detector if there were no matches by other means if (matches.empty()) { const ADGameDescription *fallbackDesc = fallbackDetect(fslist); @@ -282,6 +308,9 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) ADGameDescList matches = detectGame(files, params, language, platform, extra); + if (cleanupPirated(matches)) + return Common::kNoGameDataFoundError; + if (params.singleid == NULL) { for (uint i = 0; i < matches.size(); i++) { if (matches[i]->gameid == gameid) { @@ -342,14 +371,14 @@ static void reportUnknown(const Common::FSNode &path, const SizeMD5Map &filesSiz printf("of the game you tried to add and its version/language/etc.:\n"); for (SizeMD5Map::const_iterator file = filesSizeMD5.begin(); file != filesSizeMD5.end(); ++file) - printf(" \"%s\", \"%s\", %d\n", file->_key.c_str(), file->_value.md5, file->_value.size); + printf(" {\"%s\", 0, \"%s\", %d},\n", file->_key.c_str(), file->_value.md5, file->_value.size); printf("\n"); } static ADGameDescList detectGameFilebased(const FileMap &allFiles, const ADParams ¶ms); -static void composeFileHashMap(const Common::FSList &fslist, FileMap &allFiles, int depth, const char **directoryGlobs) { +static void composeFileHashMap(const Common::FSList &fslist, FileMap &allFiles, int depth, const char * const *directoryGlobs) { if (depth <= 0) return; @@ -366,12 +395,12 @@ static void composeFileHashMap(const Common::FSList &fslist, FileMap &allFiles, continue; bool matched = false; - for (const char *glob = *directoryGlobs; *glob; glob++) - if (file->getName().matchString(glob, true)) { + for (const char * const *glob = directoryGlobs; *glob; glob++) + if (file->getName().matchString(*glob, true)) { matched = true; break; } - + if (!matched) continue; @@ -419,7 +448,7 @@ static ADGameDescList detectGame(const Common::FSList &fslist, const ADParams &p if (g->flags & ADGF_MACRESFORK) { Common::MacResManager *macResMan = new Common::MacResManager(); - + if (macResMan->open(parent, fname)) { if (!macResMan->getResForkMD5(tmp.md5, params.md5Bytes)) tmp.md5[0] = 0; @@ -443,7 +472,7 @@ static ADGameDescList detectGame(const Common::FSList &fslist, const ADParams &p tmp.size = -1; tmp.md5[0] = 0; } - + debug(3, "> '%s': '%s'", fname.c_str(), tmp.md5); filesSizeMD5[fname] = tmp; } |