[Scummvm-cvs-logs] SF.net SVN: scummvm:[55089] scummvm/trunk/base/plugins.cpp
bluddy at users.sourceforge.net
bluddy at users.sourceforge.net
Sun Jan 2 11:08:02 CET 2011
Revision: 55089
http://scummvm.svn.sourceforge.net/scummvm/?rev=55089&view=rev
Author: bluddy
Date: 2011-01-02 10:08:02 +0000 (Sun, 02 Jan 2011)
Log Message:
-----------
PLUGINS: for uncached plugins, first check the loaded plugin before looking elsewhere
There are some calls to EngineManager::findGame() from within games, such as when loading saved games. It's critical not to unload the plugin from memory or other threads may crash. Therefore, we first scan using any plugin that's already in memory.
Modified Paths:
--------------
scummvm/trunk/base/plugins.cpp
Modified: scummvm/trunk/base/plugins.cpp
===================================================================
--- scummvm/trunk/base/plugins.cpp 2011-01-01 23:57:50 UTC (rev 55088)
+++ scummvm/trunk/base/plugins.cpp 2011-01-02 10:08:02 UTC (rev 55089)
@@ -344,6 +344,7 @@
// Resize our pluginsInMem list to prevent fragmentation
_pluginsInMem[PLUGIN_TYPE_ENGINE].resize(2);
+ unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); // empty the engine plugins
for (ProviderList::iterator pp = _providers.begin();
pp != _providers.end();
@@ -543,8 +544,16 @@
**/
GameDescriptor EngineManager::findGame(const Common::String &gameName, const EnginePlugin **plugin) const {
GameDescriptor result;
+
+ // First look for the game using the plugins in memory. This is critical
+ // for calls coming from inside games
+ result = findGameInLoadedPlugins(gameName, plugin);
+ if (!result.gameid().empty()) {
+ return result;
+ }
- // first look for the game using the gameId
+ // Now look for the game using the gameId. This is much faster than scanning plugin
+ // by plugin
if (PluginMan.loadPluginFromGameId(gameName)) {
result = findGameInLoadedPlugins(gameName, plugin);
if (!result.gameid().empty()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list