aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/launcher.cpp39
-rw-r--r--gui/launcher.h2
2 files changed, 24 insertions, 17 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 2953988ed3..29e1365d70 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -919,33 +919,40 @@ void LauncherDialog::editGame(int item) {
}
void LauncherDialog::loadGame(int item) {
- int idx;
- _loadDialog->setList(generateSavegameList(item));
- idx = _loadDialog->runModal();
- if (idx >= 0) {
- ConfMan.setInt("save_slot", idx);
- ConfMan.setActiveDomain(_domains[item]);
- close();
- }
+ String gameId = ConfMan.get("gameid", _domains[item]);
+ if (gameId.empty())
+ gameId = _domains[item];
+
+ const EnginePlugin *plugin = 0;
+ GameDescriptor game = EngineMan.findGame(gameId, &plugin);
+
+ if (plugin) {
+ _loadDialog->setList(generateSavegameList(item, plugin));
+ int idx = _loadDialog->runModal();
+ if (idx >= 0) {
+ ConfMan.setInt("save_slot", idx);
+ ConfMan.setActiveDomain(_domains[item]);
+ close();
+ }
+ } else {
+ MessageDialog dialog("ScummVM could not find any engine capable of running the selected game!", "OK");
+ dialog.runModal();
+ }
}
-Common::StringList LauncherDialog::generateSavegameList(int item) {
+Common::StringList LauncherDialog::generateSavegameList(int item, const EnginePlugin *plugin) {
String gameId = ConfMan.get("gameid", _domains[item]);
if (gameId.empty())
gameId = _domains[item];
-
+
String description = _domains[item];
description.toLowercase();
- const EnginePlugin *plugin = 0;
- GameDescriptor game = EngineMan.findGame(gameId, &plugin);
-
- SaveStateList saveList = (*plugin)->listSaves(description.c_str());
StringList saveNames;
+ SaveStateList saveList = (*plugin)->listSaves(description.c_str());
- for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) {
+ for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x)
saveNames.push_back(x->description().c_str());
- }
return saveNames;
}
diff --git a/gui/launcher.h b/gui/launcher.h
index cff6f2a8ba..a26651eef5 100644
--- a/gui/launcher.h
+++ b/gui/launcher.h
@@ -75,7 +75,7 @@ protected:
void editGame(int item);
void loadGame(int item);
- StringList generateSavegameList(int item);
+ StringList generateSavegameList(int item, const EnginePlugin *plugin);
void selectGame(const String &name);
};