diff --git a/engines/engine.cpp b/engines/engine.cpp index f4dbbfeed6b..10fca8cfa88 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -814,6 +814,23 @@ bool Engine::warnUserAboutUnsupportedGame(Common::String msg) { return true; } +void Engine::errorAddingAddOnWithoutBaseGame(Common::String addOnName, Common::String gameId) { + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); + if (ttsMan != nullptr) { + ttsMan->pushState(); + g_gui.initTextToSpeech(); + } + + Common::U32String messageFormat = _("The game \"%s\" you are trying to add is an add-on for \"%s\" that cannot be run independently." + " Please copy the add-on contents into a subdirectory of the base game, and start the base game itself."); + Common::U32String message = Common::U32String::format(messageFormat, addOnName.c_str(), gameId.c_str()); + + GUI::MessageDialog(message).runModal(); + + if (ttsMan != nullptr) + ttsMan->popState(); +} + void Engine::errorUnsupportedGame(Common::String extraMsg) { Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); if (ttsMan != nullptr) { diff --git a/engines/engine.h b/engines/engine.h index 90da7dcecb9..d60c11d434d 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -591,6 +591,16 @@ public: */ static bool warnUserAboutUnsupportedGame(Common::String msg = Common::String()); + /** + /** + * Display an error message to the user that the game is an add-on than cannot be + * run independently. + * + * @param addOnName The name of the add-on. + * @param gameId The ID of the base game that this add-on requires. + */ + static void errorAddingAddOnWithoutBaseGame(Common::String addOnName, Common::String gameId); + /** * Display an error message to the user that the game is not supported. * diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 6cbf4a91f15..de514473761 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -730,6 +730,11 @@ bool LauncherDialog::doGameDetection(const Common::Path &path) { if (0 <= idx && idx < (int)candidates.size()) { const DetectedGame &result = candidates[idx]; + if (result.isAddOn) { + Engine::errorAddingAddOnWithoutBaseGame(result.description, result.gameId); + return true; + } + Common::String domain = EngineMan.createTargetForGame(result); // Display edit dialog for the new entry diff --git a/gui/massadd.cpp b/gui/massadd.cpp index 1eddf6d9879..9aca458f1f5 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -199,7 +199,7 @@ void MassAddDialog::handleTickle() { } // Run the detector on the dir - DetectionResults detectionResults = EngineMan.detectGames(files, (ADGF_WARNING | ADGF_UNSUPPORTED), true); + DetectionResults detectionResults = EngineMan.detectGames(files, (ADGF_WARNING | ADGF_UNSUPPORTED | ADGF_ADDON), true); if (detectionResults.foundUnknownGames()) { Common::U32String report = detectionResults.generateUnknownGameReport(false, 80);