aboutsummaryrefslogtreecommitdiff
path: root/backends/plugins/psp
diff options
context:
space:
mode:
authorAndre Heider2010-09-05 12:52:17 +0000
committerAndre Heider2010-09-05 12:52:17 +0000
commitc4a88559a5577e816793b02a6eaaa3ab69c8ecdb (patch)
tree2ac2f6abc8d4c5e584bccf283582273bfad2791e /backends/plugins/psp
parent86f4dbd956fa2b6622ceb8748427700373a1aceb (diff)
downloadscummvm-rg350-c4a88559a5577e816793b02a6eaaa3ab69c8ecdb.tar.gz
scummvm-rg350-c4a88559a5577e816793b02a6eaaa3ab69c8ecdb.tar.bz2
scummvm-rg350-c4a88559a5577e816793b02a6eaaa3ab69c8ecdb.zip
PLUGINS: Move platform specific code out of the generic ELF loader.
Instead overwrite pure virtual functions in a backend specific class. svn-id: r52556
Diffstat (limited to 'backends/plugins/psp')
-rw-r--r--backends/plugins/psp/psp-provider.cpp75
-rw-r--r--backends/plugins/psp/psp-provider.h19
2 files changed, 80 insertions, 14 deletions
diff --git a/backends/plugins/psp/psp-provider.cpp b/backends/plugins/psp/psp-provider.cpp
new file mode 100644
index 0000000000..5bf9b0cc20
--- /dev/null
+++ b/backends/plugins/psp/psp-provider.cpp
@@ -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__)
+
diff --git a/backends/plugins/psp/psp-provider.h b/backends/plugins/psp/psp-provider.h
index 18623e448c..39e0d32caa 100644
--- a/backends/plugins/psp/psp-provider.h
+++ b/backends/plugins/psp/psp-provider.h
@@ -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__)
+