[Scummvm-git-logs] scummvm master -> 6d11f46b15f9f69fd6c36c26b672b3f5b91f2142

bluegr bluegr at gmail.com
Sun Mar 10 02:49:33 CET 2019


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

Summary:
6d11f46b15 BASE: Only reload engine plugins after return to launcher


Commit: 6d11f46b15f9f69fd6c36c26b672b3f5b91f2142
    https://github.com/scummvm/scummvm/commit/6d11f46b15f9f69fd6c36c26b672b3f5b91f2142
Author: Eric Culp (eculperic at gmail.com)
Date: 2019-03-10T03:49:29+02:00

Commit Message:
BASE: Only reload engine plugins after return to launcher

The other plugins do not need to be reloaded. Reloading
the scaler plugins breaks the graphics.

Changed paths:
    base/main.cpp
    base/plugins.cpp
    base/plugins.h


diff --git a/base/main.cpp b/base/main.cpp
index e9c0b96..352dbf9 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -605,7 +605,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
 				ConfMan.setActiveDomain("");
 			}
 
-			PluginManager::instance().loadAllPlugins(); // only for cached manager
+			PluginManager::instance().loadAllPluginsOfType(PLUGIN_TYPE_ENGINE); // only for cached manager
 		} else {
 			GUI::displayErrorDialog(_("Could not find any engine capable of running the selected game"));
 
diff --git a/base/plugins.cpp b/base/plugins.cpp
index f4d18ef..55c99b1 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -379,6 +379,30 @@ void PluginManager::loadAllPlugins() {
 	}
 }
 
+void PluginManager::loadAllPluginsOfType(PluginType type) {
+	for (ProviderList::iterator pp = _providers.begin();
+	                            pp != _providers.end();
+	                            ++pp) {
+		PluginList pl((*pp)->getPlugins());
+		for (PluginList::iterator p = pl.begin();
+				                  p != pl.end();
+								  ++p) {
+			if ((*p)->loadPlugin()) {
+				if ((*p)->getType() == type) {
+					addToPluginsInMemList((*p));
+				} else {
+					// Plugin is wrong type
+					(*p)->unloadPlugin();
+					delete (*p);
+				}
+			} else {
+				// Plugin did not load
+				delete (*p);
+			}
+		}
+	}
+}
+
 void PluginManager::unloadAllPlugins() {
 	for (int i = 0; i < PLUGIN_TYPE_MAX; i++)
 		unloadPluginsExcept((PluginType)i, NULL);
diff --git a/base/plugins.h b/base/plugins.h
index bfeb68a..1daa426 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -320,6 +320,7 @@ public:
 
 	// Functions used only by the cached PluginManager
 	virtual void loadAllPlugins();
+	virtual void loadAllPluginsOfType(PluginType type);
 	void unloadAllPlugins();
 
 	void unloadPluginsExcept(PluginType type, const Plugin *plugin, bool deletePlugin = true);
@@ -347,7 +348,8 @@ public:
 	virtual bool loadPluginFromGameId(const Common::String &gameId);
 	virtual void updateConfigWithFileName(const Common::String &gameId);
 
-	virtual void loadAllPlugins() {} 	// we don't allow this
+	virtual void loadAllPlugins() {} 	// we don't allow these
+	virtual void loadAllPluginsOfType(PluginType type) {}
 };
 
 #endif





More information about the Scummvm-git-logs mailing list