COMMON: add new flag ADGF_UNSUPPORTED to advanced detector

This will give an error dialog and not actually start the game. The dialog can be customized with a message from the ADGameDescription::extra field.

Some changes have been made to DetectedGame to prevent the string from the extras field to be appended to the game description.
This commit is contained in:
athrxx 2020-11-08 20:05:35 +01:00
parent b25d81ca1d
commit 3437beffab
6 changed files with 39 additions and 14 deletions

View file

@ -171,7 +171,7 @@ DetectedGame AdvancedMetaEngineDetection::toDetectedGame(const ADDetectedGame &a
extra = desc->extra;
}
DetectedGame game(getEngineId(), desc->gameId, title, desc->language, desc->platform, extra);
DetectedGame game(getEngineId(), desc->gameId, title, desc->language, desc->platform, extra, desc->flags & ADGF_UNSUPPORTED);
game.hasUnknownFiles = adGame.hasUnknownFiles;
game.matchedFiles = adGame.matchedFiles;
game.preferredTarget = generatePreferredTarget(desc, _maxAutogenLength);
@ -181,6 +181,8 @@ DetectedGame AdvancedMetaEngineDetection::toDetectedGame(const ADDetectedGame &a
game.gameSupportLevel = kUnstableGame;
else if (desc->flags & ADGF_TESTING)
game.gameSupportLevel = kTestingGame;
else if (desc->flags & ADGF_UNSUPPORTED)
game.gameSupportLevel = kUnupportedGame;
game.setGUIOptions(desc->guiOptions + _guiOptions);
game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(desc->language));
@ -379,6 +381,11 @@ Common::Error AdvancedMetaEngineDetection::createInstance(OSystem *syst, Engine
&& !Engine::warnUserAboutUnsupportedGame())
return Common::kUserCanceled;
if (gameDescriptor.gameSupportLevel == kUnupportedGame) {
Engine::errorUnsupportedGame(gameDescriptor.extra);
return Common::kUserCanceled;
}
debug(2, "Running %s", gameDescriptor.description.c_str());
initSubSystems(agdDesc.desc);