[Scummvm-git-logs] scummvm master -> aa1f22fc930865df5a047459364c5c08853d287f

criezy noreply at scummvm.org
Thu Jan 2 16:43:16 UTC 2025


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2811013ada Revert "GUI: Disable load button in Grid Launcher when no savegame can be loaded"
f0bc6fc438 Revert "GUI: Move code to detect if load from launcher is available to separate function"
aa1f22fc93 Revert "GUI: Disable load button in list launcher if no savegame exists"


Commit: 2811013ada056e2527cbcc5f49324be1659d61c3
    https://github.com/scummvm/scummvm/commit/2811013ada056e2527cbcc5f49324be1659d61c3
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2025-01-02T17:43:06+01:00

Commit Message:
Revert "GUI: Disable load button in Grid Launcher when no savegame can be loaded"

This reverts commit a86405389a405616e261fee21ba2b5e29b1a5851.

Changed paths:
    gui/launcher.cpp
    gui/widgets/grid.cpp
    gui/widgets/grid.h


diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 2b389e7ccb0..4a2867cb2c7 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -1679,7 +1679,7 @@ void LauncherGrid::build() {
 	_gridItemSizeLabel->setValue(ConfMan.getInt("grid_items_per_row"));
 
 	// Add list with game titles
-	_grid = new GridWidget(this, "LauncherGrid.IconArea", this);
+	_grid = new GridWidget(this, "LauncherGrid.IconArea");
 	// Populate the list
 	updateListing();
 
diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index 124d2be7869..91ea47edabb 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -28,7 +28,6 @@
 
 #include "gui/gui-manager.h"
 #include "gui/widgets/grid.h"
-#include "gui/launcher.h"
 
 #include "gui/ThemeEval.h"
 
@@ -265,7 +264,7 @@ void GridItemWidget::handleMouseDown(int x, int y, int button, int clickCount) {
 
 #pragma mark -
 
-GridItemTray::GridItemTray(GuiObject *boss, int x, int y, int w, int h, int entryID, GridWidget *grid, LauncherDialog *launcher)
+GridItemTray::GridItemTray(GuiObject *boss, int x, int y, int w, int h, int entryID, GridWidget *grid)
 	: Dialog(x, y, w, h), CommandSender(boss) {
 
 	_entryID = entryID;
@@ -287,8 +286,6 @@ GridItemTray::GridItemTray(GuiObject *boss, int x, int y, int w, int h, int entr
 	_loadButton = new PicButtonWidget(this, trayPaddingX, trayPaddingY + buttonHeight + buttonSpacingY,
 									  buttonWidth, buttonHeight,
 									  _("Saves"), kLoadButtonCmd);
-	if (launcher)
-		_loadButton->setEnabled(launcher->canLoadSavegames(entryID));
 	_editButton = new PicButtonWidget(this, trayPaddingX + buttonWidth + buttonSpacingX, trayPaddingY + buttonHeight + buttonSpacingY,
 									  buttonWidth, buttonHeight,
 									  _("Edit"), kEditButtonCmd);
@@ -403,10 +400,9 @@ Graphics::ManagedSurface *loadSurfaceFromFile(const Common::String &name, int re
 
 #pragma mark -
 
-GridWidget::GridWidget(GuiObject *boss, const Common::String &name, LauncherDialog *launcher)
+GridWidget::GridWidget(GuiObject *boss, const Common::String &name)
 	: ContainerWidget(boss, name), CommandSender(boss) {
 
-	_launcher = launcher;
 	_thumbnailHeight = 0;
 	_thumbnailWidth = 0;
 	_flagIconHeight = 0;
@@ -1119,7 +1115,7 @@ void GridWidget::reflowLayout() {
 void GridWidget::openTrayAtSelected() {
 	if (_selectedEntry) {
 		GridItemTray *tray = new GridItemTray(this, _x + _selectedEntry->x - _gridXSpacing / 3, _y + _selectedEntry->y + _selectedEntry->h - _scrollPos,
-											  _gridItemWidth + 2 * (_gridXSpacing / 3), _trayHeight, _selectedEntry->entryID, this, _launcher);
+								_gridItemWidth + 2 * (_gridXSpacing / 3), _trayHeight, _selectedEntry->entryID, this);
 		tray->runModal();
 		delete tray;
 	}
diff --git a/gui/widgets/grid.h b/gui/widgets/grid.h
index f890c3fbc99..97f4808d593 100644
--- a/gui/widgets/grid.h
+++ b/gui/widgets/grid.h
@@ -35,7 +35,6 @@ namespace GUI {
 class ScrollBarWidget;
 class GridItemWidget;
 class GridWidget;
-class LauncherDialog;
 
 enum {
 	kPlayButtonCmd = 'PLAY',
@@ -85,7 +84,7 @@ class GridItemTray: public Dialog, public CommandSender {
 	PicButtonWidget	*_loadButton;
 	PicButtonWidget	*_editButton;
 public:
-	GridItemTray(GuiObject *boss, int x, int y, int w, int h, int entryID, GridWidget *grid, LauncherDialog *launcher);
+	GridItemTray(GuiObject *boss, int x, int y, int w, int h, int entryID, GridWidget *grid);
 
 	void reflowLayout() override;
 
@@ -127,7 +126,6 @@ protected:
 	Common::Array<GridItemWidget *>		_gridItems;
 
 	ScrollBarWidget *_scrollBar;
-	LauncherDialog *_launcher;
 
 	int				_scrollBarWidth;
 	int				_scrollWindowHeight;
@@ -171,7 +169,7 @@ public:
 
 	Common::U32String	_filter;
 
-	GridWidget(GuiObject *boss, const Common::String &name, LauncherDialog *launcher);
+	GridWidget(GuiObject *boss, const Common::String &name);
 	~GridWidget();
 
 	template<typename T>


Commit: f0bc6fc438472cd7d2dfd7d40baadf8c9a98604d
    https://github.com/scummvm/scummvm/commit/f0bc6fc438472cd7d2dfd7d40baadf8c9a98604d
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2025-01-02T17:43:06+01:00

Commit Message:
Revert "GUI: Move code to detect if load from launcher is available to separate function"

This reverts commit d0b31d819d565603ed694ed732ee99ebb7614955.

Changed paths:
    gui/launcher.cpp
    gui/launcher.h


diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 4a2867cb2c7..7181cdb15f1 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -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);
 }
diff --git a/gui/launcher.h b/gui/launcher.h
index 3a414cf6d51..c0431d7167d 100644
--- a/gui/launcher.h
+++ b/gui/launcher.h
@@ -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


Commit: aa1f22fc930865df5a047459364c5c08853d287f
    https://github.com/scummvm/scummvm/commit/aa1f22fc930865df5a047459364c5c08853d287f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2025-01-02T17:43:06+01:00

Commit Message:
Revert "GUI: Disable load button in list launcher if no savegame exists"

This reverts commit 979a17edc420ec945be284398271a292deda6624.

Changed paths:
    gui/launcher.cpp


diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 7181cdb15f1..5182c8c42cf 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -1369,29 +1369,8 @@ void LauncherSimple::updateButtons() {
 	int item = _list->getSelected();
 	bool en = enable;
 
-	if (item >= 0) {
-		// Check load from launcher is supported
+	if (item >= 0)
 		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);
 }




More information about the Scummvm-git-logs mailing list