[Scummvm-git-logs] scummvm master -> 8a67d8913efbb03016f93039d9103a320c199ef1

lephilousophe lephilousophe at users.noreply.github.com
Sat May 8 22:22:03 UTC 2021


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

Summary:
1ac759abdc BASE: Load all plugins linked inside detection plugin
8a67d8913e BASE: Fix segmentation fault when detection plugin cannot be found


Commit: 1ac759abdc1ddb4a9d94a048b990c284880f7e7b
    https://github.com/scummvm/scummvm/commit/1ac759abdc1ddb4a9d94a048b990c284880f7e7b
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2021-05-08T23:45:39+02:00

Commit Message:
BASE: Load all plugins linked inside detection plugin

This was done in UncachedPluginManager but not in PluginManager

Changed paths:
    base/plugins.cpp


diff --git a/base/plugins.cpp b/base/plugins.cpp
index 589caac45c..3e47a53717 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -544,6 +544,22 @@ void PluginManager::loadAllPlugins() {
 		PluginList pl((*pp)->getPlugins());
 		Common::for_each(pl.begin(), pl.end(), Common::bind1st(Common::mem_fun(&PluginManager::tryLoadPlugin), this));
 	}
+
+#ifndef DETECTION_STATIC
+	/*
+	 * When detection is dynamic, loading above only gets us a PLUGIN_TYPE_DETECTION plugin
+	 * We must register all plugins linked in it in order to use them
+	 */
+	PluginList dpl = getPlugins(PLUGIN_TYPE_DETECTION);
+	_pluginsInMem[PLUGIN_TYPE_ENGINE_DETECTION].clear();
+	for (PluginList::iterator it = dpl.begin();
+	                            it != dpl.end();
+	                            ++it) {
+		const Detection &detectionConnect = (*it)->get<Detection>();
+		const PluginList &pl = detectionConnect.getPlugins();
+		Common::for_each(pl.begin(), pl.end(), Common::bind1st(Common::mem_fun(&PluginManager::tryLoadPlugin), this));
+	}
+#endif
 }
 
 void PluginManager::loadAllPluginsOfType(PluginType type) {


Commit: 8a67d8913efbb03016f93039d9103a320c199ef1
    https://github.com/scummvm/scummvm/commit/8a67d8913efbb03016f93039d9103a320c199ef1
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2021-05-08T23:45:57+02:00

Commit Message:
BASE: Fix segmentation fault when detection plugin cannot be found

This could happen if some engine plugin is placed in a build where
detection was not compiled in

Changed paths:
    base/commandLine.cpp


diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index b19e87fa29..f71b75859b 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -845,7 +845,7 @@ unknownOption:
 	return command;
 }
 
-/** List all supported game IDs, i.e. all games which any loaded plugin supports. */
+/** List all available game IDs, i.e. all games which any loaded plugin supports. */
 static void listGames() {
 	printf("Game ID                        Full Title                                                 \n"
 	       "------------------------------ -----------------------------------------------------------\n");
@@ -853,6 +853,10 @@ static void listGames() {
 	const PluginList &plugins = EngineMan.getPlugins(PLUGIN_TYPE_ENGINE);
 	for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
 		const Plugin *p = EngineMan.findPlugin((*iter)->getName());
+		/* If for some reason, we can't find the MetaEngine for this Engine, just ignore it */
+		if (!p) {
+			continue;
+		}
 
 		PlainGameList list = p->get<MetaEngineDetection>().getSupportedGames();
 		for (PlainGameList::const_iterator v = list.begin(); v != list.end(); ++v) {
@@ -861,7 +865,7 @@ static void listGames() {
 	}
 }
 
-/** List all detected game IDs, i.e. all games which any loaded plugin supports. */
+/** List all known game IDs, i.e. all games which can be detected. */
 static void listAllGames() {
 	printf("Game ID                        Full Title                                                 \n"
 	       "------------------------------ -----------------------------------------------------------\n");
@@ -877,7 +881,7 @@ static void listAllGames() {
 	}
 }
 
-/** List all supported engines, i.e. all loaded plugins. */
+/** List all supported engines, i.e. all loaded engine plugins. */
 static void listEngines() {
 	printf("Engine ID       Engine Name                                           \n"
 	       "--------------- ------------------------------------------------------\n");
@@ -885,12 +889,16 @@ static void listEngines() {
 	const PluginList &plugins = EngineMan.getPlugins(PLUGIN_TYPE_ENGINE);
 	for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
 		const Plugin *p = EngineMan.findPlugin((*iter)->getName());
+		/* If for some reason, we can't find the MetaEngine for this Engine, just ignore it */
+		if (!p) {
+			continue;
+		}
 
 		printf("%-15s %s\n", p->get<MetaEngineDetection>().getEngineId(), p->get<MetaEngineDetection>().getName());
 	}
 }
 
-/** List all detection engines, i.e. all loaded plugins. */
+/** List all detection engines, i.e. all loaded detection plugins. */
 static void listAllEngines() {
 	printf("Engine ID       Engine Name                                           \n"
 	       "--------------- ------------------------------------------------------\n");




More information about the Scummvm-git-logs mailing list