added necessary files I forgot to commit yesterday (whoops...) for mips and arm loaders
svn-id: r51843
This commit is contained in:
parent
59b2b46fe8
commit
68b986545a
4 changed files with 207 additions and 0 deletions
46
backends/plugins/arm-loader.h
Normal file
46
backends/plugins/arm-loader.h
Normal file
|
@ -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;
|
||||
}
|
||||
};
|
54
backends/plugins/mips-loader.h
Normal file
54
backends/plugins/mips-loader.h
Normal file
|
@ -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;
|
||||
}
|
||||
};
|
76
backends/plugins/ps2/ps2-provider.cpp
Normal file
76
backends/plugins/ps2/ps2-provider.cpp
Normal file
|
@ -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)
|
31
backends/plugins/ps2/ps2-provider.h
Normal file
31
backends/plugins/ps2/ps2-provider.h
Normal file
|
@ -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;
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue