GUI: Ensure add-ons cannot be added as an independent game

Through single add or mass add
This commit is contained in:
Simon Delamarre
2025-07-07 21:16:11 +02:00
committed by Eugene Sandulenko
parent a80f5eb574
commit 2e10337804
4 changed files with 33 additions and 1 deletions
+17
View File
@@ -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) {
+10
View File
@@ -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.
*
+5
View File
@@ -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
+1 -1
View File
@@ -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);