[Scummvm-cvs-logs] SF.net SVN: scummvm:[51826] scummvm/branches/gsoc2010-plugins/backends
toneman1138 at users.sourceforge.net
toneman1138 at users.sourceforge.net
Sat Aug 7 07:01:45 CEST 2010
Revision: 51826
http://scummvm.svn.sourceforge.net/scummvm/?rev=51826&view=rev
Author: toneman1138
Date: 2010-08-07 05:01:43 +0000 (Sat, 07 Aug 2010)
Log Message:
-----------
modified psp to use mips-loader.cpp (and added things to backends/module.mk)
Modified Paths:
--------------
scummvm/branches/gsoc2010-plugins/backends/module.mk
scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/makefile
scummvm/branches/gsoc2010-plugins/backends/platform/ps2/Makefile.ps2
scummvm/branches/gsoc2010-plugins/backends/platform/psp/Makefile
scummvm/branches/gsoc2010-plugins/backends/plugins/arm-loader.cpp
scummvm/branches/gsoc2010-plugins/backends/plugins/elf-loader.h
scummvm/branches/gsoc2010-plugins/backends/plugins/mips-loader.cpp
scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.cpp
scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.h
scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.cpp
Modified: scummvm/branches/gsoc2010-plugins/backends/module.mk
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/module.mk 2010-08-07 02:47:44 UTC (rev 51825)
+++ scummvm/branches/gsoc2010-plugins/backends/module.mk 2010-08-07 05:01:43 UTC (rev 51826)
@@ -30,6 +30,10 @@
midi/timidity.o \
midi/dmedia.o \
midi/windows.o \
+ plugins/elf-loader.o \
+ plugins/mips-loader.o \
+ plugins/shorts-segment-manager.o \
+ plugins/arm-loader.o \
plugins/elf-provider.o \
plugins/dc/dc-provider.o \
plugins/ds/ds-provider.o \
Modified: scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/makefile
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/makefile 2010-08-07 02:47:44 UTC (rev 51825)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/makefile 2010-08-07 05:01:43 UTC (rev 51826)
@@ -238,7 +238,7 @@
ASFLAGS = -mcpu=arm9tdmi -mthumb-interwork
-DEFINES += -D__DS__ -DNDS -DARM9 -DNONSTANDARD_PORT -DDISABLE_FANCY_THEMES -DVECTOR_RENDERER_FORMAT=1555 -DDISABLE_DOSBOX_OPL -DDISABLE_DEFAULT_SAVEFILEMANAGER -DELF_LOADER_TARGET -DARM#-DNEW_PLUGIN_DESIGN_FIRST_REFINEMENT
+DEFINES += -D__DS__ -DNDS -DARM9 -DNONSTANDARD_PORT -DDISABLE_FANCY_THEMES -DVECTOR_RENDERER_FORMAT=1555 -DDISABLE_DOSBOX_OPL -DDISABLE_DEFAULT_SAVEFILEMANAGER -DELF_LOADER_TARGET -DARM -DARM_TARGET#-DNEW_PLUGIN_DESIGN_FIRST_REFINEMENT
ifdef USE_MAD
DEFINES += -DUSE_MAD
endif
@@ -291,9 +291,7 @@
$(portdir)/source/osystem_ds.o $(portdir)/source/ramsave.o\
$(portdir)/source/touchkeyboard.o $(portdir)/source/zipreader.o\
$(portdir)/source/dsoptions.o $(portdir)/source/keys.o $(portdir)/source/wordcompletion.o\
- $(portdir)/source/interrupt.o\
- $(srcdir)/backends/plugins/elf-loader.o\
- $(srcdir)/backends/plugins/arm-loader.o
+ $(portdir)/source/interrupt.o
ifdef USE_PROFILER
PORT_OBJS += $(portdir)/source/profiler/cyg-profile.o
Modified: scummvm/branches/gsoc2010-plugins/backends/platform/ps2/Makefile.ps2
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/ps2/Makefile.ps2 2010-08-07 02:47:44 UTC (rev 51825)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/ps2/Makefile.ps2 2010-08-07 05:01:43 UTC (rev 51826)
@@ -77,7 +77,8 @@
TARGET = elf/scummvm.elf
-DEFINES += -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -DDISABLE_SAVEGAME_SORTING -D_EE -D__PLAYSTATION2__ -DELF_LOADER_TARGET -G2 -O2 -Wall -Wno-multichar -fno-rtti -fno-exceptions -DNO_ADAPTOR#-DNEW_PLUGIN_DESIGN_FIRST_REFINEMENT
+DEFINES += -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -DDISABLE_SAVEGAME_SORTING -D_EE -D__PLAYSTATION2__ -G2 -O2 -Wall -Wno-multichar -fno-rtti -fno-exceptions -DNO_ADAPTOR
+DEFINES += -DELF_LOADER_TARGET -DMIPS_TARGET#-DNEW_PLUGIN_DESIGN_FIRST_REFINEMENT
INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
INCLUDES += -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
@@ -111,9 +112,6 @@
$(srcdir)/backends/platform/ps2/systemps2.o \
$(srcdir)/backends/platform/ps2/ps2mutex.o \
$(srcdir)/backends/platform/ps2/ps2time.o \
- $(srcdir)/backends/plugins/elf-loader.o \
- $(srcdir)/backends/plugins/mips-loader.o \
- $(srcdir)/backends/plugins/shorts-segment-manager.o \
$(srcdir)/backends/platform/ps2/ps2debug.o
include $(srcdir)/Makefile.common
Modified: scummvm/branches/gsoc2010-plugins/backends/platform/psp/Makefile
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/psp/Makefile 2010-08-07 02:47:44 UTC (rev 51825)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/psp/Makefile 2010-08-07 05:01:43 UTC (rev 51826)
@@ -68,7 +68,7 @@
# Variables for common Scummvm makefile
CXX = psp-g++
CXXFLAGS = -O3 -Wall -Wno-multichar -fno-exceptions -fno-rtti
-DEFINES = -D__PSP__ -DNONSTANDARD_PORT -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DUSE_ZLIB -DDISABLE_DOSBOX_OPL -DUSE_RGB_COLOR -DELF_LOADER_TARGET
+DEFINES = -D__PSP__ -DNONSTANDARD_PORT -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DUSE_ZLIB -DDISABLE_DOSBOX_OPL -DUSE_RGB_COLOR -DELF_LOADER_TARGET -DMIPS_TARGET
LDFLAGS :=
INCDIR := $(srcdir) . $(srcdir)/engines/ $(PSPSDK)/include
Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/arm-loader.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/arm-loader.cpp 2010-08-07 02:47:44 UTC (rev 51825)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/arm-loader.cpp 2010-08-07 05:01:43 UTC (rev 51826)
@@ -23,7 +23,7 @@
*
*/
-#if defined(DYNAMIC_MODULES)
+#if defined(DYNAMIC_MODULES) && defined(ARM_TARGET)
#include "backends/fs/ds/ds-fs.h"
#include "elf-loader.h"
@@ -166,4 +166,4 @@
return true;
}
-#endif /* defined(DYNAMIC_MODULES) */
+#endif /* defined(DYNAMIC_MODULES) && defined(ARM_TARGET) */
Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf-loader.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf-loader.h 2010-08-07 02:47:44 UTC (rev 51825)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf-loader.h 2010-08-07 05:01:43 UTC (rev 51826)
@@ -30,15 +30,10 @@
#include "common/stream.h"
#include "backends/plugins/dynamic-plugin.h"
-#if defined(__PLAYSTATION2__) || defined(__PSP__)
-#define MIPS_TARGET
+#if defined(MIPS_TARGET)
#include "shorts-segment-manager.h"
#endif
-#if defined(__DS__)
-#define ARM_TARGET
-#endif
-
class DLObject {
protected:
void *_segment, *_symtab;
Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/mips-loader.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/mips-loader.cpp 2010-08-07 02:47:44 UTC (rev 51825)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/mips-loader.cpp 2010-08-07 05:01:43 UTC (rev 51826)
@@ -23,7 +23,7 @@
*
*/
-#if defined(DYNAMIC_MODULES)
+#if defined(DYNAMIC_MODULES) && defined(MIPS_TARGET)
#include "mips-loader.h"
@@ -259,4 +259,4 @@
return true;
}
-#endif /* defined(DYNAMIC_MODULES) */
+#endif /* defined(DYNAMIC_MODULES) && defined(MIPS_TARGET) */
Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.cpp 2010-08-07 02:47:44 UTC (rev 51825)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.cpp 2010-08-07 05:01:43 UTC (rev 51826)
@@ -25,84 +25,52 @@
#if defined(DYNAMIC_MODULES) && defined(__PSP__)
+#include "backends/plugins/mips-loader.h"
+#include "backends/plugins/elf-provider.h"
#include "backends/plugins/psp/psp-provider.h"
-#include "backends/plugins/dynamic-plugin.h"
-#include "common/fs.h"
-#include "backends/platform/psp/psploader.h"
-
-class PSPPlugin : 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;
+class PSPPlugin : public ELFPlugin {
+public:
+ PSPPlugin(const Common::String &filename) {
+ _dlHandle = 0;
+ _filename = filename;
}
-public:
- PSPPlugin(const Common::String &filename)
- : _dlHandle(0), _filename(filename) {}
-
~PSPPlugin() {
- if (_dlHandle) unloadPlugin();
+ if (_dlHandle)
+ unloadPlugin();
}
- bool loadPlugin() {
+ bool loadPlugin();
+};
+
+bool PSPPlugin::loadPlugin() {
assert(!_dlHandle);
- _dlHandle = dlopen(_filename.c_str(), RTLD_LAZY);
+ DLObject *obj = new MIPSDLObject();
+ if (obj->open(_filename.c_str())) {
+ _dlHandle = obj;
+ } else {
+ delete obj;
+ _dlHandle = NULL;
+ }
if (!_dlHandle) {
- warning("Failed loading plugin '%s' (%s)", _filename.c_str(), dlerror());
+ warning("Failed loading plugin '%s'", _filename.c_str());
return false;
}
bool ret = DynamicPlugin::loadPlugin();
- if (ret)
- dlforgetsyms(_dlHandle);
+ if (ret && _dlHandle) {
+ _dlHandle->discard_symtab();
+ }
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* PSPPluginProvider::createPlugin(const Common::FSNode &node) const {
return new PSPPlugin(node.getPath());
}
-bool PSPPluginProvider::isPluginFilename(const Common::FSNode &node) const {
- // Check the plugin suffix
- Common::String filename = node.getName();
- fprintf(stderr, "Testing name %s", filename.c_str());
- if (!filename.hasSuffix(".PLG") && !filename.hasSuffix(".plg")) {
- fprintf(stderr," fail.\n");
- return false;
- }
-
- fprintf(stderr," success!\n");
- return true;
-}
-
#endif // defined(DYNAMIC_MODULES) && defined(__PSP__)
Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.h 2010-08-07 02:47:44 UTC (rev 51825)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.h 2010-08-07 05:01:43 UTC (rev 51826)
@@ -26,16 +26,12 @@
#ifndef BACKENDS_PLUGINS_PSP_PSP_PROVIDER_H
#define BACKENDS_PLUGINS_PSP_PSP_PROVIDER_H
-#include "base/plugins.h"
+#include "backends/plugins/elf-provider.h"
#if defined(DYNAMIC_MODULES) && defined(__PSP__)
-class PSPPluginProvider : public FilePluginProvider {
-protected:
+class PSPPluginProvider : public ELFPluginProvider {
Plugin* createPlugin(const Common::FSNode &node) const;
-
- bool isPluginFilename(const Common::FSNode &node) const;
-
};
#endif // defined(DYNAMIC_MODULES) && defined(__PSP__)
Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.cpp 2010-08-07 02:47:44 UTC (rev 51825)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.cpp 2010-08-07 05:01:43 UTC (rev 51826)
@@ -23,7 +23,7 @@
*
*/
-#if defined(DYNAMIC_MODULES) //TODO: && defined (MIPS target)
+#if defined(DYNAMIC_MODULES) && defined(MIPS_TARGET)
#include "shorts-segment-manager.h"
@@ -86,4 +86,4 @@
delete seg;
}
-#endif /* DYNAMIC_MODULES */
+#endif /* DYNAMIC_MODULES && MIPS_TARGET */
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