mirror of
https://github.com/scummvm/scummvm.git
synced 2026-05-21 05:40:43 +00:00
GUI: Ensure add-ons cannot be added as an independent game
Through single add or mass add
This commit is contained in:
committed by
Eugene Sandulenko
parent
a80f5eb574
commit
2e10337804
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user