AD: Implement AGDF_PIRATED flag.

svn-id: r52384
This commit is contained in:
Eugene Sandulenko 2010-08-25 11:51:06 +00:00
parent 1d7566f371
commit 78278db7ed
2 changed files with 28 additions and 0 deletions

View file

@ -214,10 +214,34 @@ 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);
}
// 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 +306,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) {