Patch #1825276: "DETECTION: advanced detector engine simplification"

svn-id: r29386
This commit is contained in:
Eugene Sandulenko 2007-11-03 21:06:58 +00:00
parent c069051492
commit c640d1c604
34 changed files with 101 additions and 281 deletions

View file

@ -70,7 +70,7 @@ GameList gameIDList(const Common::ADParams &params) {
return GameList(params.list);
}
static void upgradeTargetIfNecessary(const Common::ADParams &params) {
void upgradeTargetIfNecessary(const Common::ADParams &params) {
if (params.obsoleteList == 0)
return;
@ -264,43 +264,6 @@ EncapsulatedADGameDesc detectBestMatchingGame(
return result;
}
PluginError detectGameForEngineCreation(
const Common::ADParams &params
) {
upgradeTargetIfNecessary(params);
Common::String gameid = ConfMan.get("gameid");
FSList fslist;
FilesystemNode dir(ConfMan.get("path"));
if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly)) {
return kInvalidPathError;
}
ADGameDescList matches = detectGame(&fslist, params, Common::UNK_LANG, Common::kPlatformUnknown);
// We have single ID set, so we have a game if there are hits
if (params.singleid != NULL && matches.size())
return kNoError;
for (uint i = 0; i < matches.size(); i++) {
if (matches[i]->gameid == gameid) {
return kNoError;
}
}
// Use fallback detector if there were no matches by other means
if (params.fallbackDetectFunc != NULL) {
EncapsulatedADGameDesc fallbackDesc = (*params.fallbackDetectFunc)(&fslist);
if (fallbackDesc.realDesc != 0 && (params.singleid != NULL || fallbackDesc.getGameID() == gameid)) {
return kNoError;
}
}
return kNoGameDataFoundError;
}
void reportUnknown(StringMap &filesMD5, HashMap<String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> &filesSize) {
// TODO: This message should be cleaned up / made more specific.
// For example, we should specify at least which engine triggered this.