From 68b986545a7ce24e3c0d2a8635d538941b67729f Mon Sep 17 00:00:00 2001 From: Tony Puccinelli Date: Sat, 7 Aug 2010 21:47:50 +0000 Subject: added necessary files I forgot to commit yesterday (whoops...) for mips and arm loaders svn-id: r51843 --- backends/plugins/arm-loader.h | 46 +++++++++++++++++++++ backends/plugins/mips-loader.h | 54 +++++++++++++++++++++++++ backends/plugins/ps2/ps2-provider.cpp | 76 +++++++++++++++++++++++++++++++++++ backends/plugins/ps2/ps2-provider.h | 31 ++++++++++++++ 4 files changed, 207 insertions(+) create mode 100644 backends/plugins/arm-loader.h create mode 100644 backends/plugins/mips-loader.h create mode 100644 backends/plugins/ps2/ps2-provider.cpp create mode 100644 backends/plugins/ps2/ps2-provider.h (limited to 'backends') diff --git a/backends/plugins/arm-loader.h b/backends/plugins/arm-loader.h new file mode 100644 index 0000000000..babbe69739 --- /dev/null +++ b/backends/plugins/arm-loader.h @@ -0,0 +1,46 @@ +/* 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$ + * + */ + +#include "backends/fs/ds/ds-fs.h" +#include "elf-loader.h" +#include "dsmain.h" + +class ARMDLObject : public DLObject { +protected: + bool relocate(Common::SeekableReadStream* DLFile, unsigned long offset, unsigned long size, void *relSegment); + bool relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr); + +public: + ARMDLObject() { + _segment = NULL; + _symtab = NULL; + _strtab = NULL; + _symbol_cnt = 0; + _symtab_sect = -1; + _dtors_start = NULL; + _dtors_end = NULL; + _segmentSize = 0; + } +}; diff --git a/backends/plugins/mips-loader.h b/backends/plugins/mips-loader.h new file mode 100644 index 0000000000..9d13feccbb --- /dev/null +++ b/backends/plugins/mips-loader.h @@ -0,0 +1,54 @@ + +/* 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$ + * + */ + +#include "elf-loader.h" +#include "shorts-segment-manager.h" + +class MIPSDLObject : public DLObject { +protected: + ShortSegmentManager::Segment *_shortsSegment; // For assigning shorts ranges + unsigned int _gpVal; // Value of Global Pointer + + bool relocate(Common::SeekableReadStream* DLFile, unsigned long offset, unsigned long size, void *relSegment); + bool relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr); + void relocateSymbols(Elf32_Addr offset); + bool loadSegment(Common::SeekableReadStream* DLFile, Elf32_Phdr *phdr); + void unload(); + +public: + MIPSDLObject() { + _segment = NULL; + _symtab = NULL; + _strtab = NULL; + _symbol_cnt = 0; + _symtab_sect = -1; + _dtors_start = NULL; + _dtors_end = NULL; + _segmentSize = 0; + _shortsSegment = NULL; + _gpVal = 0; + } +}; diff --git a/backends/plugins/ps2/ps2-provider.cpp b/backends/plugins/ps2/ps2-provider.cpp new file mode 100644 index 0000000000..7305c27c74 --- /dev/null +++ b/backends/plugins/ps2/ps2-provider.cpp @@ -0,0 +1,76 @@ +/* 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/mips-loader.h" +#include "backends/plugins/elf-provider.h" +#include "backends/plugins/ps2/ps2-provider.h" + + +class PS2Plugin : public ELFPlugin { +public: + PS2Plugin(const Common::String &filename) { + _dlHandle = 0; + _filename = filename; + } + + ~PS2Plugin() { + if (_dlHandle) + unloadPlugin(); + } + + bool loadPlugin(); +}; + +bool PS2Plugin::loadPlugin() { + assert(!_dlHandle); + DLObject *obj = new MIPSDLObject(); + if (obj->open(_filename.c_str())) { + _dlHandle = obj; + } else { + delete obj; + _dlHandle = NULL; + } + + if (!_dlHandle) { + warning("Failed loading plugin '%s'", _filename.c_str()); + return false; + } + + bool ret = DynamicPlugin::loadPlugin(); + + if (ret && _dlHandle) { + _dlHandle->discard_symtab(); + } + + return ret; +}; + +Plugin* PS2PluginProvider::createPlugin(const Common::FSNode &node) const { + return new PS2Plugin(node.getPath()); +} + +#endif // defined(DYNAMIC_MODULES) && defined(ELF_LOADER_TARGET) diff --git a/backends/plugins/ps2/ps2-provider.h b/backends/plugins/ps2/ps2-provider.h new file mode 100644 index 0000000000..28a2321c29 --- /dev/null +++ b/backends/plugins/ps2/ps2-provider.h @@ -0,0 +1,31 @@ +/* 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$ + * + */ + +#include "backends/plugins/elf-provider.h" + +class PS2PluginProvider : public ELFPluginProvider { + Plugin* createPlugin(const Common::FSNode &node) const; +}; + -- cgit v1.2.3