[Scummvm-cvs-logs] SF.net SVN: scummvm:[52556] scummvm/branches/gsoc2010-plugins/backends

dhewg at users.sourceforge.net dhewg at users.sourceforge.net
Sun Sep 5 14:52:17 CEST 2010


Revision: 52556
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52556&view=rev
Author:   dhewg
Date:     2010-09-05 12:52:17 +0000 (Sun, 05 Sep 2010)

Log Message:
-----------
PLUGINS: Move platform specific code out of the generic ELF loader.

Instead overwrite pure virtual functions in a backend specific class.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-plugins/backends/module.mk
    scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-provider.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/ps2-provider.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/wii/wii-provider.h

Added Paths:
-----------
    scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/ps2-provider.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/wii/wii-provider.cpp

Modified: scummvm/branches/gsoc2010-plugins/backends/module.mk
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/module.mk	2010-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/module.mk	2010-09-05 12:52:17 UTC (rev 52556)
@@ -50,7 +50,8 @@
 ifeq ($(BACKEND),ds)
 MODULE_OBJS += \
 	fs/ds/ds-fs-factory.o \
-	fs/ds/ds-fs.o
+	fs/ds/ds-fs.o \
+	plugins/ds/ds-provider.o
 endif
 
 ifeq ($(BACKEND),n64)
@@ -61,20 +62,23 @@
 
 ifeq ($(BACKEND),ps2)
 MODULE_OBJS += \
-	fs/ps2/ps2-fs-factory.o
+	fs/ps2/ps2-fs-factory.o \
+	plugins/ps2/ps2-provider.o
 endif
 
 ifeq ($(BACKEND),psp)
 MODULE_OBJS += \
 	fs/psp/psp-fs-factory.o \
 	fs/psp/psp-stream.o \
+	plugins/psp/psp-provider.o \
 	saves/psp/psp-saves.o \
 	timer/psp/timer.o
 endif
 
 ifeq ($(BACKEND),wii)
 MODULE_OBJS += \
-	fs/wii/wii-fs-factory.o
+	fs/wii/wii-fs-factory.o \
+	plugins/wii/wii-provider.o
 endif
 
 # Include common rules

Copied: scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.cpp (from rev 52555, scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.h)
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.cpp	2010-09-05 12:52:17 UTC (rev 52556)
@@ -0,0 +1,75 @@
+/* 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(__DS__)
+
+#include <malloc.h>
+#include <nds.h>
+
+#include "backends/plugins/ds/ds-provider.h"
+#include "backends/plugins/elf/arm-loader.h"
+
+class DSDLObject : public ARMDLObject {
+public:
+	DSDLObject() :
+		ARMDLObject() {
+	}
+
+	virtual ~DSDLObject() {
+		unload();
+	}
+
+protected:
+	virtual void *allocSegment(size_t boundary, size_t size) const {
+		return memalign(boundary, size);
+	}
+
+	virtual void freeSegment(void *segment) const {
+		free(segment);
+	}
+
+	virtual void flushDataCache(void *ptr, uint32 len) const {
+		DC_FlushRange(ptr, len);
+		IC_InvalidateRange(ptr, len);
+	}
+};
+
+class DSPlugin : public ELFPlugin {
+public:
+	DSPlugin(const Common::String &filename) :
+		ELFPlugin(filename) {
+	}
+
+	virtual DLObject *makeDLObject() {
+		return new DSDLObject();
+	}
+};
+
+Plugin *DSPluginProvider::createPlugin(const Common::FSNode &node) const {
+	return new DSPlugin(node.getPath());
+}
+
+#endif // defined(DYNAMIC_MODULES) && defined(__DS__)
+

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.h	2010-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.h	2010-09-05 12:52:17 UTC (rev 52556)
@@ -18,28 +18,24 @@
  * 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$
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.h $
+ * $Id: ds-provider.h 52112 2010-08-16 08:41:04Z toneman1138 $
  *
  */
 
 #if defined(DYNAMIC_MODULES) && defined(__DS__)
 
+#ifndef BACKENDS_PLUGINS_DS_PROVIDER_H
+#define BACKENDS_PLUGINS_DS_PROVIDER_H
+
 #include "backends/plugins/elf/elf-provider.h"
-#include "backends/plugins/elf/arm-loader.h"
 
 class DSPluginProvider : public ELFPluginProvider {
-	class DSPlugin : public ELFPlugin {
-	public:
-		DSPlugin(const Common::String &filename) : ELFPlugin(filename) {}
-
-		DLObject *makeDLObject() { return new ARMDLObject(); }
-	};
-
 public:
-	Plugin* createPlugin(const Common::FSNode &node) const {
-		return new DSPlugin(node.getPath());
-	}
+	Plugin *createPlugin(const Common::FSNode &node) const;
 };
 
+#endif // BACKENDS_PLUGINS_DS_PROVIDER_H
+
 #endif // defined(DYNAMIC_MODULES) && defined(__DS__)
+

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.h	2010-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.h	2010-09-05 12:52:17 UTC (rev 52556)
@@ -25,6 +25,9 @@
 
 #if defined(DYNAMIC_MODULES) && defined(ARM_TARGET)
 
+#ifndef BACKENDS_PLUGINS_ARM_LOADER_H
+#define BACKENDS_PLUGINS_ARM_LOADER_H
+
 #include "backends/plugins/elf/elf-loader.h"
 
 class ARMDLObject : public DLObject {
@@ -36,4 +39,6 @@
 	ARMDLObject() : DLObject() {}
 };
 
+#endif /* BACKENDS_PLUGINS_ARM_LOADER_H */
+
 #endif /* defined(DYNAMIC_MODULES) && defined(ARM_TARGET) */

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.cpp	2010-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.cpp	2010-09-05 12:52:17 UTC (rev 52556)
@@ -25,53 +25,12 @@
 
 #if defined(DYNAMIC_MODULES) && defined(ELF_LOADER_TARGET)
 
-#include <string.h>
-#include <stdarg.h>
-
-#ifdef __PSP__
-#include <psputils.h>
-#include <psputilsforkernel.h>
-#endif
-
-#ifdef __DS__
-#include <nds.h>
-#endif
-
-#ifdef __WII__
-#include <malloc.h>
-#include <ogc/cache.h>
-#endif
-
 #include "backends/plugins/elf/elf-loader.h"
 
 #include "common/debug.h"
 #include "common/file.h"
 #include "common/fs.h"
 
-/**
- * Flushes the data cache (Platform Specific).
- */
-static void flushDataCache(void *ptr, uint32 len) {
-#ifdef __DS__
-	DC_FlushRange(ptr, len);
-	IC_InvalidateRange(ptr, len);
-#endif
-#ifdef __PLAYSTATION2__
-	(void) ptr;
-	(void) len;
-	FlushCache(0);
-	FlushCache(2);
-#endif
-#ifdef __PSP__
-	sceKernelDcacheWritebackRange(ptr, len);
-	sceKernelIcacheInvalidateRange(ptr, len);
-#endif
-#ifdef __WII__
-	DCFlushRange(ptr, len);
-	ICInvalidateRange(ptr, len);
-#endif
-}
-
 DLObject::DLObject() :
 	_segment(0),
 	_symtab(0),
@@ -86,7 +45,6 @@
 }
 
 DLObject::~DLObject() {
-	unload();
 }
 
 // Expel the symbol table from memory
@@ -101,8 +59,11 @@
 // Unload all objects from memory
 void DLObject::unload() {
 	discard_symtab();
-	free(_segment);
+	freeSegment(_segment);
 	_segment = 0;
+	_segmentSize = 0;
+	_segmentOffset = 0;
+	_segmentVMA = 0;
 }
 
 bool DLObject::readElfHeader(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr) {
@@ -193,7 +154,7 @@
 	int extra = phdr->p_vaddr % phdr->p_align;	// Get extra length TODO: check logic here
 	debug(2, "elfloader: Extra mem is %x", extra);
 
-	if (!(_segment = (char *)memalign(phdr->p_align, phdr->p_memsz + extra))) {
+	if (!(_segment = (char *) allocSegment(phdr->p_align, phdr->p_memsz + extra))) {
 		warning("elfloader: Out of memory.");
 		return false;
 	}

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.h	2010-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.h	2010-09-05 12:52:17 UTC (rev 52556)
@@ -25,8 +25,8 @@
 
 #if defined(DYNAMIC_MODULES) && defined(ELF_LOADER_TARGET)
 
-#ifndef ELF_LOADER_H
-#define ELF_LOADER_H
+#ifndef BACKENDS_PLUGINS_ELF_LOADER_H
+#define BACKENDS_PLUGINS_ELF_LOADER_H
 
 #include <stddef.h>
 
@@ -65,9 +65,14 @@
 	bool loadStringTable(Common::SeekableReadStream* DLFile, Elf32_Shdr *shdr);
 	virtual void relocateSymbols(ptrdiff_t offset);
 
+	// architecture specific
 	virtual bool relocate(Common::SeekableReadStream* DLFile, unsigned long offset, unsigned long size, void *relSegment) = 0;
 	virtual bool relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) = 0;
 
+	// platform specific
+	virtual void *allocSegment(size_t boundary, size_t size) const = 0;
+	virtual void freeSegment(void *segment) const = 0;
+	virtual void flushDataCache(void *ptr, uint32 len) const = 0;
 public:
 	DLObject();
 	virtual ~DLObject();
@@ -78,6 +83,6 @@
 	void discard_symtab();
 };
 
-#endif /* ELF_LOADER_H */
+#endif /* BACKENDS_PLUGINS_ELF_LOADER_H */
 
 #endif /* defined(DYNAMIC_MODULES) && defined(ELF_LOADER_TARGET) */

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-provider.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-provider.h	2010-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-provider.h	2010-09-05 12:52:17 UTC (rev 52556)
@@ -52,7 +52,7 @@
 	ELFPlugin(const Common::String &filename)
 		: _dlHandle(0), _filename(filename) {}
 
-	~ELFPlugin() {
+	virtual ~ELFPlugin() {
 		if (_dlHandle)
 			unloadPlugin();
 	}

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.cpp	2010-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.cpp	2010-09-05 12:52:17 UTC (rev 52556)
@@ -321,10 +321,6 @@
 
 // Unload all objects from memory
 void MIPSDLObject::unload() {
-	discard_symtab();
-	free(_segment);
-	_segment = 0;
-
 	if (_shortsSegment) {
 		ShortsMan.deleteSegment(_shortsSegment);
 		_shortsSegment = 0;

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.h	2010-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.h	2010-09-05 12:52:17 UTC (rev 52556)
@@ -26,6 +26,9 @@
 
 #if defined(DYNAMIC_MODULES) && defined(MIPS_TARGET)
 
+#ifndef BACKENDS_PLUGINS_MIPS_LOADER_H
+#define BACKENDS_PLUGINS_MIPS_LOADER_H
+
 #include "backends/plugins/elf/elf-loader.h"
 #include "backends/plugins/elf/shorts-segment-manager.h"
 
@@ -47,4 +50,7 @@
     }
 };
 
+#endif /* BACKENDS_PLUGINS_MIPS_LOADER_H */
+
 #endif /* defined(DYNAMIC_MODULES) && defined(MIPS_TARGET) */
+

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.h	2010-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.h	2010-09-05 12:52:17 UTC (rev 52556)
@@ -25,6 +25,9 @@
 
 #if defined(DYNAMIC_MODULES) && defined(PPC_TARGET)
 
+#ifndef BACKENDS_PLUGINS_PPC_LOADER_H
+#define BACKENDS_PLUGINS_PPC_LOADER_H
+
 #include "backends/plugins/elf/elf-loader.h"
 
 class PPCDLObject : public DLObject {
@@ -36,5 +39,7 @@
     PPCDLObject() : DLObject() {}
 };
 
+#endif /* BACKENDS_PLUGINS_PPC_LOADER_H */
+
 #endif /* defined(DYNAMIC_MODULES) && defined(PPC_TARGET) */
 

Copied: scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/ps2-provider.cpp (from rev 52555, scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/ps2-provider.h)
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/ps2-provider.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/ps2-provider.cpp	2010-09-05 12:52:17 UTC (rev 52556)
@@ -0,0 +1,72 @@
+/* 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(__PLAYSTATION2__)
+
+#include "backends/plugins/ps2/ps2-provider.h"
+#include "backends/plugins/elf/mips-loader.h"
+
+class PS2DLObject : public MIPSDLObject {
+public:
+	PS2DLObject() :
+		MIPSDLObject() {
+	}
+
+	virtual ~PS2DLObject() {
+		unload();
+	}
+
+protected:
+	virtual void *allocSegment(size_t boundary, size_t size) const {
+		return memalign(boundary, size);
+	}
+
+	virtual void freeSegment(void *segment) const {
+		free(segment);
+	}
+
+	virtual void flushDataCache(void *, uint32) const {
+		FlushCache(0);
+		FlushCache(2);
+	}
+};
+
+class PS2Plugin : public ELFPlugin {
+public:
+	PS2Plugin(const Common::String &filename) :
+		ELFPlugin(filename) {
+	}
+
+	virtual DLObject *makeDLObject() {
+		return new PS2DLObject();
+	}
+};
+
+Plugin *PS2PluginProvider::createPlugin(const Common::FSNode &node) const {
+	return new PS2Plugin(node.getPath());
+}
+
+#endif // defined(DYNAMIC_MODULES) && defined(__PLAYSTATION2__)
+

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/ps2-provider.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/ps2-provider.h	2010-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/ps2-provider.h	2010-09-05 12:52:17 UTC (rev 52556)
@@ -18,29 +18,24 @@
  * 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$
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.h $
+ * $Id: ds-provider.h 52112 2010-08-16 08:41:04Z toneman1138 $
  *
  */
 
 #if defined(DYNAMIC_MODULES) && defined(__PLAYSTATION2__)
 
+#ifndef BACKENDS_PLUGINS_PS2_PROVIDER_H
+#define BACKENDS_PLUGINS_PS2_PROVIDER_H
+
 #include "backends/plugins/elf/elf-provider.h"
-#include "backends/plugins/elf/mips-loader.h"
 
 class PS2PluginProvider : public ELFPluginProvider {
-	class PS2Plugin : public ELFPlugin {
-	public:
-		PS2Plugin(const Common::String &filename) : ELFPlugin(filename) {}
-
-		DLObject *makeDLObject() { return new MIPSDLObject(); }
-	};
-
 public:
-	Plugin* createPlugin(const Common::FSNode &node) const {
-		return new PS2Plugin(node.getPath());
-	}
+	Plugin *createPlugin(const Common::FSNode &node) const;
 };
 
+#endif // BACKENDS_PLUGINS_PS2_PROVIDER_H
+
 #endif // defined(DYNAMIC_MODULES) && defined(__PLAYSTATION2__)
 

Copied: scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.cpp (from rev 52555, scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.h)
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.cpp	2010-09-05 12:52:17 UTC (rev 52556)
@@ -0,0 +1,75 @@
+/* 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(__PSP__)
+
+#include <psputils.h>
+#include <psputilsforkernel.h>
+
+#include "backends/plugins/psp/psp-provider.h"
+#include "backends/plugins/elf/mips-loader.h"
+
+class PSPDLObject : public MIPSDLObject {
+public:
+	PSPDLObject() :
+		MIPSDLObject() {
+	}
+
+	virtual ~PSPDLObject() {
+		unload();
+	}
+
+protected:
+	virtual void *allocSegment(size_t boundary, size_t size) const {
+		return memalign(boundary, size);
+	}
+
+	virtual void freeSegment(void *segment) const {
+		free(segment);
+	}
+
+	virtual void flushDataCache(void *ptr, uint32 len) const {
+		sceKernelDcacheWritebackRange(ptr, len);
+		sceKernelIcacheInvalidateRange(ptr, len);
+	}
+};
+
+class PSPPlugin : public ELFPlugin {
+public:
+	PSPPlugin(const Common::String &filename) :
+		ELFPlugin(filename) {
+	}
+
+	virtual DLObject *makeDLObject() {
+		return new PSPDLObject();
+	}
+};
+
+Plugin *PSPPluginProvider::createPlugin(const Common::FSNode &node) const {
+	return new PSPPlugin(node.getPath());
+}
+
+#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-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/psp/psp-provider.h	2010-09-05 12:52:17 UTC (rev 52556)
@@ -18,8 +18,8 @@
  * 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$
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.h $
+ * $Id: ds-provider.h 52112 2010-08-16 08:41:04Z toneman1138 $
  *
  */
 
@@ -29,22 +29,13 @@
 #define BACKENDS_PLUGINS_PSP_PSP_PROVIDER_H
 
 #include "backends/plugins/elf/elf-provider.h"
-#include "backends/plugins/elf/mips-loader.h"
 
 class PSPPluginProvider : public ELFPluginProvider {
-	class PSPPlugin : public ELFPlugin {
-	public:
-		PSPPlugin(const Common::String &filename) : ELFPlugin(filename) {}
-
-		DLObject *makeDLObject() { return new MIPSDLObject(); }
-	};
-
 public:
-	Plugin* createPlugin(const Common::FSNode &node) const {
-		return new PSPPlugin(node.getPath());
-	}
+	Plugin *createPlugin(const Common::FSNode &node) const;
 };
 
-#endif /* BACKENDS_PLUGINS_PSP_PSP_PROVIDER_H */
+#endif // BACKENDS_PLUGINS_PSP_PROVIDER_H
 
 #endif // defined(DYNAMIC_MODULES) && defined(__PSP__)
+

Copied: scummvm/branches/gsoc2010-plugins/backends/plugins/wii/wii-provider.cpp (from rev 52555, scummvm/branches/gsoc2010-plugins/backends/plugins/wii/wii-provider.h)
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/wii/wii-provider.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/wii/wii-provider.cpp	2010-09-05 12:52:17 UTC (rev 52556)
@@ -0,0 +1,75 @@
+/* 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(__WII__)
+
+#include <malloc.h>
+#include <ogc/cache.h>
+
+#include "backends/plugins/wii/wii-provider.h"
+#include "backends/plugins/elf/ppc-loader.h"
+
+class WiiDLObject : public PPCDLObject {
+public:
+	WiiDLObject() :
+		PPCDLObject() {
+	}
+
+	virtual ~WiiDLObject() {
+		unload();
+	}
+
+protected:
+	virtual void *allocSegment(size_t boundary, size_t size) const {
+		return memalign(boundary, size);
+	}
+
+	virtual void freeSegment(void *segment) const {
+		free(segment);
+	}
+
+	virtual void flushDataCache(void *ptr, uint32 len) const {
+		DCFlushRange(ptr, len);
+		ICInvalidateRange(ptr, len);
+	}
+};
+
+class WiiPlugin : public ELFPlugin {
+public:
+	WiiPlugin(const Common::String &filename) :
+		ELFPlugin(filename) {
+	}
+
+	virtual DLObject *makeDLObject() {
+		return new WiiDLObject();
+	}
+};
+
+Plugin *WiiPluginProvider::createPlugin(const Common::FSNode &node) const {
+	return new WiiPlugin(node.getPath());
+}
+
+#endif // defined(DYNAMIC_MODULES) && defined(__WII__)
+

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/wii/wii-provider.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/wii/wii-provider.h	2010-09-05 12:51:25 UTC (rev 52555)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/wii/wii-provider.h	2010-09-05 12:52:17 UTC (rev 52556)
@@ -25,21 +25,17 @@
 
 #if defined(DYNAMIC_MODULES) && defined(__WII__)
 
+#ifndef BACKENDS_PLUGINS_WII_PROVIDER_H
+#define BACKENDS_PLUGINS_WII_PROVIDER_H
+
 #include "backends/plugins/elf/elf-provider.h"
-#include "backends/plugins/elf/ppc-loader.h"
 
 class WiiPluginProvider : public ELFPluginProvider {
-	class WiiPlugin : public ELFPlugin {
-	public:
-		WiiPlugin(const Common::String &filename) : ELFPlugin(filename) {}
-
-		DLObject *makeDLObject() { return new PPCDLObject(); }
-	};
-
 public:
-	Plugin* createPlugin(const Common::FSNode &node) const {
-		return new WiiPlugin(node.getPath());
-	}
+	Plugin *createPlugin(const Common::FSNode &node) const;
 };
 
+#endif // BACKENDS_PLUGINS_WII_PROVIDER_H
+
 #endif // defined(DYNAMIC_MODULES) && defined(__WII__)
+


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