diff options
-rw-r--r-- | backends/platform/gp2xwiz/gp2xwiz-main.cpp | 10 | ||||
-rw-r--r-- | backends/plugins/gp2xwiz/gp2xwiz-provider.cpp | 108 | ||||
-rw-r--r-- | backends/plugins/gp2xwiz/gp2xwiz-provider.h | 43 |
3 files changed, 0 insertions, 161 deletions
diff --git a/backends/platform/gp2xwiz/gp2xwiz-main.cpp b/backends/platform/gp2xwiz/gp2xwiz-main.cpp index fa08cff9f7..8c95a94639 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-main.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-main.cpp @@ -41,7 +41,6 @@ #include "common/file.h" #include "base/main.h" -#include "backends/plugins/gp2xwiz/gp2xwiz-provider.h" #include "backends/saves/default/default-saves.h" #include "backends/timer/default/default-timer.h" #include "sound/mixer_intern.h" @@ -54,9 +53,6 @@ #include <sys/stat.h> #include <time.h> // for getTimeAndDate() -//comment this out to use POSIX plugins -#define ELF_LOADER - /* Dump console info to files. */ // #define DUMP_STDOUT @@ -66,13 +62,7 @@ int main(int argc, char *argv[]) { assert(g_system); #ifdef DYNAMIC_MODULES - -#ifdef ELF_LOADER - PluginManager::instance().addPluginProvider(new GP2XWIZPluginProvider()); -#else PluginManager::instance().addPluginProvider(new POSIXPluginProvider()); -#endif /* ELF_LOADER */ - #endif /* DYNAMIC_MODULES */ // Invoke the actual ScummVM main entry point: diff --git a/backends/plugins/gp2xwiz/gp2xwiz-provider.cpp b/backends/plugins/gp2xwiz/gp2xwiz-provider.cpp deleted file mode 100644 index 859ac8fbc8..0000000000 --- a/backends/plugins/gp2xwiz/gp2xwiz-provider.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#if defined(DYNAMIC_MODULES) && defined(GP2XWIZ) - -#include "backends/plugins/gp2xwiz/gp2xwiz-provider.h" -#include "backends/plugins/dynamic-plugin.h" -#include "common/fs.h" - -#include "backends/platform/gp2xwiz/gp2xwiz-loader.h" - - -class GP2XWIZPlugin : public DynamicPlugin { -protected: - void *_dlHandle; - Common::String _filename; - - virtual VoidFunc findSymbol(const char *symbol) { - void *func = dlsym(_dlHandle, symbol); - if (!func) - warning("Failed loading symbol '%s' from plugin '%s' (%s)", symbol, _filename.c_str(), dlerror()); - - // FIXME HACK: This is a HACK to circumvent a clash between the ISO C++ - // standard and POSIX: ISO C++ disallows casting between function pointers - // and data pointers, but dlsym always returns a void pointer. For details, - // see e.g. <http://www.trilithium.com/johan/2004/12/problem-with-dlsym/>. - assert(sizeof(VoidFunc) == sizeof(func)); - VoidFunc tmp; - memcpy(&tmp, &func, sizeof(VoidFunc)); - return tmp; - } - -public: - GP2XWIZPlugin(const Common::String &filename) - : _dlHandle(0), _filename(filename) {} - - ~GP2XWIZPlugin() { - if (_dlHandle) unloadPlugin(); - } - - bool loadPlugin() { - assert(!_dlHandle); - _dlHandle = dlopen(_filename.c_str(), RTLD_LAZY); - - if (!_dlHandle) { - warning("Failed loading plugin '%s' (%s)", _filename.c_str(), dlerror()); - return false; - } - - bool ret = DynamicPlugin::loadPlugin(); - - if (ret) - dlforgetsyms(_dlHandle); - - return ret; - } - - void unloadPlugin() { - DynamicPlugin::unloadPlugin(); - if (_dlHandle) { - if (dlclose(_dlHandle) != 0) - warning("Failed unloading plugin '%s' (%s)", _filename.c_str(), dlerror()); - _dlHandle = 0; - } - } -}; - - -Plugin* GP2XWIZPluginProvider::createPlugin(const Common::FSNode &node) const { - return new GP2XWIZPlugin(node.getPath()); -} - -bool GP2XWIZPluginProvider::isPluginFilename(const Common::FSNode &node) const { - // Check the plugin suffix - Common::String filename = node.getName(); - printf("Testing name %s", filename.c_str()); - if (!filename.hasSuffix(".PLG") && !filename.hasSuffix(".plg") && !filename.hasSuffix(".PLUGIN") && !filename.hasSuffix(".plugin")) { - printf(" fail.\n"); - return false; - } - - printf(" success!\n"); - return true; -} - -#endif // defined(DYNAMIC_MODULES) && defined(GP2XWIZ) diff --git a/backends/plugins/gp2xwiz/gp2xwiz-provider.h b/backends/plugins/gp2xwiz/gp2xwiz-provider.h deleted file mode 100644 index 929a9af1f6..0000000000 --- a/backends/plugins/gp2xwiz/gp2xwiz-provider.h +++ /dev/null @@ -1,43 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/ps2-provider.h $ - * $Id: ps2-provider.h 49435 2010-06-05 01:05:19Z toneman1138 $ - * - */ - -#ifndef BACKENDS_PLUGINS_GP2XWIZ_GP2XWIZ_PROVIDER_H -#define BACKENDS_PLUGINS_GP2XWIZ_GP2XWIZ_PROVIDER_H - -#include "base/plugins.h" - -#if defined(DYNAMIC_MODULES) && defined(GP2XWIZ) - -class GP2XWIZPluginProvider : public FilePluginProvider { -protected: - Plugin* createPlugin(const Common::FSNode &node) const; - - bool isPluginFilename(const Common::FSNode &node) const; - -}; - -#endif // defined(DYNAMIC_MODULES) && defined(GP2XWIZ) - -#endif /* BACKENDS_PLUGINS_GP2XWIZ_GP2XWIZ_PROVIDER_H */ |