diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index 91e408101eb..a6f0ef6b936 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -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); diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index 54ae73e3e43..ecb7467c60a 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -67,11 +67,12 @@ struct ADGameFileDescription { enum ADGameFlags { ADGF_NO_FLAGS = 0, - ADGF_REMASTERED = (1 << 19), ///< add "-remastered' to gameid - ADGF_AUTOGENTARGET = (1 << 20), ///< automatically generate gameid from extra - ADGF_UNSTABLE = (1 << 21), ///< flag to designate not yet officially-supported games that are not fit for public testing - ADGF_TESTING = (1 << 22), ///< flag to designate not yet officially-supported games that are fit for public testing - ADGF_PIRATED = (1 << 23), ///< flag to designate well known pirated versions with cracks + ADGF_REMASTERED = (1 << 18), ///< add "-remastered' to gameid + ADGF_AUTOGENTARGET = (1 << 19), ///< automatically generate gameid from extra + ADGF_UNSTABLE = (1 << 20), ///< flag to designate not yet officially-supported games that are not fit for public testing + ADGF_TESTING = (1 << 21), ///< flag to designate not yet officially-supported games that are fit for public testing + ADGF_PIRATED = (1 << 22), ///< flag to designate well known pirated versions with cracks + ADGF_UNSUPPORTED = (1 << 23), ///< flag to mark certain versions (like fan translations) not to be run for various reasons. A custom message can be provided in the ADGameDescription::extra field. ADGF_ADDENGLISH = (1 << 24), ///< always add English as language option ADGF_MACRESFORK = (1 << 25), ///< the md5 for this entry will be calculated from the resource fork ADGF_USEEXTRAASTITLE = (1 << 26), ///< Extra field value will be used as main game title, not gameid diff --git a/engines/engine.cpp b/engines/engine.cpp index 34438756d29..197eb64c58a 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -654,6 +654,13 @@ bool Engine::warnUserAboutUnsupportedGame() { return true; } +void Engine::errorUnsupportedGame(Common::String &extraMsg) { + Common::String message = extraMsg.empty() ? _("This game is not supported.") : _("This game is not supported for the following reason:\n\n"); + message += _(extraMsg); + message += "\n\n"; + GUI::MessageDialog(message).runModal(); +} + uint32 Engine::getTotalPlayTime() const { if (!_pauseLevel) return _system->getMillis() - _engineStartTime; diff --git a/engines/engine.h b/engines/engine.h index 97444c1a2e8..8d82b592d94 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -428,6 +428,14 @@ public: */ static bool warnUserAboutUnsupportedGame(); + /** + * Display an error message to the user that the game is not supported. + * + * @param extraMsg This will be appended to the default message. + * + */ + static void errorUnsupportedGame(Common::String &extraMsg); + /** * Get the total play time. * diff --git a/engines/game.cpp b/engines/game.cpp index 96802acfec7..6e3db9cf6ef 100644 --- a/engines/game.cpp +++ b/engines/game.cpp @@ -76,7 +76,7 @@ DetectedGame::DetectedGame(const Common::String &engine, const PlainGameDescript description = pgd.description; } -DetectedGame::DetectedGame(const Common::String &engine, const Common::String &id, const Common::String &d, Common::Language l, Common::Platform p, const Common::String &ex) : +DetectedGame::DetectedGame(const Common::String &engine, const Common::String &id, const Common::String &d, Common::Language l, Common::Platform p, const Common::String &ex, bool unsupported) : engineId(engine), hasUnknownFiles(false), canBeAdded(true), @@ -90,7 +90,7 @@ DetectedGame::DetectedGame(const Common::String &engine, const Common::String &i extra = ex; // Append additional information, if set, to the description. - description += updateDesc(); + description += updateDesc(unsupported); } void DetectedGame::setGUIOptions(const Common::String &guioptions) { @@ -104,10 +104,10 @@ void DetectedGame::appendGUIOptions(const Common::String &str) { _guiOptions += str; } -Common::String DetectedGame::updateDesc() const { +Common::String DetectedGame::updateDesc(bool skipExtraField) const { const bool hasCustomLanguage = (language != Common::UNK_LANG); const bool hasCustomPlatform = (platform != Common::kPlatformUnknown); - const bool hasExtraDesc = !extra.empty(); + const bool hasExtraDesc = (!extra.empty() && !skipExtraField); // Adapt the description string if custom platform/language is set. Common::String descr; diff --git a/engines/game.h b/engines/game.h index 8d0b013e12a..17ff2cc76c9 100644 --- a/engines/game.h +++ b/engines/game.h @@ -83,8 +83,9 @@ typedef Common::Array QualifiedGameList; */ enum GameSupportLevel { kStableGame = 0, // the game is fully supported - kTestingGame, // the game is not supposed to end up in releases yet but is ready for public testing - kUnstableGame // the game is not even ready for public testing yet + kTestingGame, // the game is not supposed to end up in releases yet but is ready for public testing + kUnstableGame, // the game is not even ready for public testing yet + kUnupportedGame // we don't want to support the game }; @@ -118,7 +119,8 @@ struct DetectedGame { const Common::String &description, Common::Language language = Common::UNK_LANG, Common::Platform platform = Common::kPlatformUnknown, - const Common::String &extra = Common::String()); + const Common::String &extra = Common::String(), + bool unsupported = false); void setGUIOptions(const Common::String &options); void appendGUIOptions(const Common::String &str); @@ -183,7 +185,7 @@ private: * Values that are missing are omitted, so e.g. (EXTRA/LANG) would be * added if no platform has been specified but a language and an extra string. */ - Common::String updateDesc() const; + Common::String updateDesc(bool skipExtraField) const; Common::String _guiOptions; };