mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
Revert "GUI: Move code to detect if load from launcher is available to separate function"
This reverts commit d0b31d819d.
This commit is contained in:
1 parent
2811013ada
commit
f0bc6fc438
2 files changed
+23
-27
No files matched your search
+23
-26
@@ -446,30 +446,6 @@ Common::String LauncherDialog::getGameConfig(int item, Common::String key) {
|
||||
return "";
|
||||
}
|
||||
|
||||
bool LauncherDialog::canLoadSavegames(int item) const {
|
||||
// Check load from launcher is supported
|
||||
if (Common::checkGameGUIOption(GUIO_NOLAUNCHLOAD, ConfMan.get("guioptions", _domains[item])))
|
||||
return false;
|
||||
|
||||
// Check savegames are available
|
||||
Common::String target = _domains[item];
|
||||
target.toLowercase();
|
||||
EngineMan.upgradeTargetIfNecessary(target);
|
||||
QualifiedGameDescriptor game = EngineMan.findTarget(target);
|
||||
#if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES) && !defined(DETECTION_STATIC)
|
||||
// Unload all MetaEnginesDetection if we're using uncached plugins to save extra memory.
|
||||
PluginMan.unloadDetectionPlugin();
|
||||
#endif
|
||||
const Plugin *enginePlugin = PluginMan.findEnginePlugin(game.engineId);
|
||||
if (!enginePlugin)
|
||||
return false;
|
||||
const MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
|
||||
if (!metaEngine.hasFeature(MetaEngine::kSupportsListSaves))
|
||||
return false;
|
||||
SaveStateList saveList = metaEngine.listSaves(target.c_str());
|
||||
return !saveList.empty();
|
||||
}
|
||||
|
||||
void LauncherDialog::removeGame(int item) {
|
||||
MessageDialog alert(_("Do you really want to remove this game configuration?"), _("Yes"), _("No"));
|
||||
|
||||
@@ -1393,8 +1369,29 @@ void LauncherSimple::updateButtons() {
|
||||
int item = _list->getSelected();
|
||||
bool en = enable;
|
||||
|
||||
if (item >= 0)
|
||||
en = canLoadSavegames(item);
|
||||
if (item >= 0) {
|
||||
// Check load from launcher is supported
|
||||
en = !(Common::checkGameGUIOption(GUIO_NOLAUNCHLOAD, ConfMan.get("guioptions", _domains[item])));
|
||||
// Check savegames are available
|
||||
if (en) {
|
||||
Common::String target = _domains[item];
|
||||
target.toLowercase();
|
||||
EngineMan.upgradeTargetIfNecessary(target);
|
||||
QualifiedGameDescriptor game = EngineMan.findTarget(target);
|
||||
#if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES) && !defined(DETECTION_STATIC)
|
||||
// Unload all MetaEnginesDetection if we're using uncached plugins to save extra memory.
|
||||
PluginMan.unloadDetectionPlugin();
|
||||
#endif
|
||||
const Plugin *enginePlugin = PluginMan.findEnginePlugin(game.engineId);
|
||||
if (enginePlugin) {
|
||||
const MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
|
||||
if (metaEngine.hasFeature(MetaEngine::kSupportsListSaves)) {
|
||||
SaveStateList saveList = metaEngine.listSaves(target.c_str());
|
||||
en = !saveList.empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_loadButton->setEnabled(en);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@ public:
|
||||
void handleOtherEvent(const Common::Event &evt) override;
|
||||
bool doGameDetection(const Common::Path &path);
|
||||
Common::String getGameConfig(int item, Common::String key);
|
||||
bool canLoadSavegames(int item) const;
|
||||
protected:
|
||||
EditTextWidget *_searchWidget;
|
||||
#ifndef DISABLE_FANCY_THEMES
|
||||
|
||||
Reference in new issue
Block a user