mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-27 21:54:15 +00:00
RISCOS: Add RISC OS support
This commit is contained in:
parent
66654cb376
commit
0f45b7f9bc
2
.gitignore
vendored
2
.gitignore
vendored
@ -23,6 +23,8 @@ lib*.a
|
||||
/MT32_PCM.ROM
|
||||
/ResidualVM.app
|
||||
/residualvm.docktileplugin
|
||||
/\!ResidualVM
|
||||
/*,e1f
|
||||
/residualvm-ps3.pkg
|
||||
/*.ipk
|
||||
/*.dmg
|
||||
|
46
backends/fs/riscos/riscos-fs-factory.cpp
Normal file
46
backends/fs/riscos/riscos-fs-factory.cpp
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.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(RISCOS)
|
||||
|
||||
// Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h.
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
|
||||
|
||||
#include "backends/fs/riscos/riscos-fs-factory.h"
|
||||
#include "backends/fs/riscos/riscos-fs.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
AbstractFSNode *RISCOSFilesystemFactory::makeRootFileNode() const {
|
||||
return new RISCOSFilesystemNode("/");
|
||||
}
|
||||
|
||||
AbstractFSNode *RISCOSFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
||||
char buf[MAXPATHLEN];
|
||||
return getcwd(buf, MAXPATHLEN) ? new RISCOSFilesystemNode(buf) : NULL;
|
||||
}
|
||||
|
||||
AbstractFSNode *RISCOSFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
||||
assert(!path.empty());
|
||||
return new RISCOSFilesystemNode(path);
|
||||
}
|
||||
#endif
|
40
backends/fs/riscos/riscos-fs-factory.h
Normal file
40
backends/fs/riscos/riscos-fs-factory.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef RISCOS_FILESYSTEM_FACTORY_H
|
||||
#define RISCOS_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "backends/fs/fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates RISCOSFilesystemNode objects.
|
||||
*
|
||||
* Parts of this class are documented in the base interface class, FilesystemFactory.
|
||||
*/
|
||||
class RISCOSFilesystemFactory : public FilesystemFactory {
|
||||
protected:
|
||||
virtual AbstractFSNode *makeRootFileNode() const;
|
||||
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
|
||||
};
|
||||
|
||||
#endif /*RISCOS_FILESYSTEM_FACTORY_H*/
|
329
backends/fs/riscos/riscos-fs.cpp
Normal file
329
backends/fs/riscos/riscos-fs.cpp
Normal file
@ -0,0 +1,329 @@
|
||||
/* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(RISCOS)
|
||||
|
||||
// Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h.
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
|
||||
|
||||
#include "backends/fs/riscos/riscos-fs.h"
|
||||
#include "backends/fs/stdiostream.h"
|
||||
#include "common/algorithm.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <unixlib/local.h>
|
||||
#include <kernel.h>
|
||||
#include <swis.h>
|
||||
|
||||
bool RISCOSFilesystemNode::exists() const {
|
||||
return access(_path.c_str(), F_OK) == 0;
|
||||
}
|
||||
|
||||
bool RISCOSFilesystemNode::isReadable() const {
|
||||
return access(_path.c_str(), R_OK) == 0;
|
||||
}
|
||||
|
||||
bool RISCOSFilesystemNode::isWritable() const {
|
||||
return access(_path.c_str(), W_OK) == 0;
|
||||
}
|
||||
|
||||
RISCOSFilesystemNode::RISCOSFilesystemNode(const Common::String &p) {
|
||||
_path = p;
|
||||
if (p == "/") {
|
||||
_isDirectory = true;
|
||||
_isValid = true;
|
||||
} else {
|
||||
int type = _swi(OS_File, _INR(0,1)|_RETURN(0), 20, toRISCOS(_path).c_str());
|
||||
if (type == 0) {
|
||||
_isDirectory = false;
|
||||
_isValid = false;
|
||||
} else if (type == 2) {
|
||||
_isDirectory = true;
|
||||
_isValid = true;
|
||||
} else {
|
||||
_isDirectory = false;
|
||||
_isValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Common::String RISCOSFilesystemNode::toRISCOS(Common::String &path) {
|
||||
char start[PATH_MAX];
|
||||
char *end = __riscosify_std(path.c_str(), 0, start, PATH_MAX, 0);
|
||||
return Common::String(start, end);
|
||||
}
|
||||
|
||||
Common::String RISCOSFilesystemNode::toUnix(Common::String &path) {
|
||||
Common::String out = Common::String(path);
|
||||
uint32 start = 0;
|
||||
if (out.contains("$")) {
|
||||
char *x = strstr(out.c_str(), "$");
|
||||
start = x ? x - out.c_str() : -1;
|
||||
} else if (out.contains(":")) {
|
||||
char *x = strstr(out.c_str(), ":");
|
||||
start = x ? x - out.c_str() : -1;
|
||||
}
|
||||
|
||||
for (uint32 ptr = start; ptr < out.size(); ptr += 1) {
|
||||
switch (out.c_str()[ptr]) {
|
||||
case '.':
|
||||
out.setChar('/', ptr);
|
||||
break;
|
||||
case '/':
|
||||
out.setChar('.', ptr);
|
||||
break;
|
||||
case '\xA0':
|
||||
out.setChar(' ', ptr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (out.contains("$") || out.contains(":"))
|
||||
out = "/" + out;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
AbstractFSNode *RISCOSFilesystemNode::getChild(const Common::String &n) const {
|
||||
assert(!_path.empty());
|
||||
assert(_isDirectory);
|
||||
|
||||
// Make sure the string contains no slashes
|
||||
assert(!n.contains('/'));
|
||||
|
||||
// We assume here that _path is already normalized (hence don't bother to call
|
||||
// Common::normalizePath on the final path).
|
||||
Common::String newPath(_path);
|
||||
if (_path.lastChar() != '/')
|
||||
newPath += '/';
|
||||
newPath += n;
|
||||
|
||||
return makeNode(newPath);
|
||||
}
|
||||
|
||||
bool RISCOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const {
|
||||
assert(_isDirectory);
|
||||
|
||||
if (_path == "/") {
|
||||
// Special case for the root dir: List all drives
|
||||
char fsname[PATH_MAX] = "";
|
||||
for (int fsNum = 0; fsNum < 256; fsNum += 1) {
|
||||
_swi(OS_FSControl, _INR(0,3), 33, fsNum, fsname, sizeof(fsname));
|
||||
if (strcmp(fsname, "") != 0) {
|
||||
if (!(fsNum == 46 || fsNum == 53 || fsNum == 99)) {
|
||||
int drives = 9;
|
||||
if (fsNum == 193)
|
||||
drives = 23;
|
||||
|
||||
for (int discnum = 0; discnum <= drives; discnum += 1) {
|
||||
const Common::String path = Common::String::format("%s::%d.$", fsname, discnum);
|
||||
char outpath[PATH_MAX] = "";
|
||||
if(_swix(OS_FSControl, _INR(0,2)|_IN(5), 37, path.c_str(), outpath, sizeof(outpath)) == NULL) {
|
||||
int exist;
|
||||
if (_swix(OS_File, _INR(0,1)|_OUT(0), 23, outpath, &exist) != NULL || exist != 2)
|
||||
continue;
|
||||
|
||||
RISCOSFilesystemNode *entry = new RISCOSFilesystemNode();
|
||||
entry->_isDirectory = true;
|
||||
entry->_isValid = true;
|
||||
entry->_path = Common::String::format("/%s", outpath);
|
||||
entry->_displayName = outpath;
|
||||
myList.push_back(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
int read = 0;
|
||||
char file[PATH_MAX];
|
||||
Common::String dir = _path;
|
||||
|
||||
while (count != -1) {
|
||||
_swix(OS_GBPB, _INR(0,5)|_OUTR(3,4), 9, toRISCOS(dir).c_str(), file, 1, count, sizeof(file), &read, &count);
|
||||
|
||||
if (count == -1)
|
||||
continue;
|
||||
|
||||
// Start with a clone of this node, with the correct path set
|
||||
RISCOSFilesystemNode entry(*this);
|
||||
entry._displayName = file;
|
||||
entry._displayName = toUnix(entry._displayName);
|
||||
if (_path.lastChar() != '/')
|
||||
entry._path += '/';
|
||||
entry._path += entry._displayName;
|
||||
|
||||
int type = _swi(OS_File, _INR(0,1)|_RETURN(0), 20, toRISCOS(entry._path).c_str());
|
||||
if (type == 0) {
|
||||
continue;
|
||||
} else if (type == 2) {
|
||||
entry._isDirectory = true;
|
||||
} else {
|
||||
entry._isDirectory = false;
|
||||
}
|
||||
|
||||
// Honor the chosen mode
|
||||
if ((mode == Common::FSNode::kListFilesOnly && entry._isDirectory) ||
|
||||
(mode == Common::FSNode::kListDirectoriesOnly && !entry._isDirectory))
|
||||
continue;
|
||||
|
||||
myList.push_back(new RISCOSFilesystemNode(entry));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
AbstractFSNode *RISCOSFilesystemNode::getParent() const {
|
||||
if (_path == "/")
|
||||
return 0; // The filesystem root has no parent
|
||||
|
||||
const char *start = _path.c_str();
|
||||
const char *end = start + _path.size();
|
||||
|
||||
// Strip of the last component. We make use of the fact that at this
|
||||
// point, _path is guaranteed to be normalized
|
||||
while (end > start && *(end-1) != '/')
|
||||
end--;
|
||||
|
||||
if (end == start) {
|
||||
// This only happens if we were called with a relative path, for which
|
||||
// there simply is no parent.
|
||||
// TODO: We could also resolve this by assuming that the parent is the
|
||||
// current working directory, and returning a node referring to that.
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*(end-1) == '/' && end != start + 1)
|
||||
end--;
|
||||
|
||||
return makeNode(Common::String(start, end));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *RISCOSFilesystemNode::createReadStream() {
|
||||
return StdioStream::makeFromPath(getPath(), false);
|
||||
}
|
||||
|
||||
Common::WriteStream *RISCOSFilesystemNode::createWriteStream() {
|
||||
return StdioStream::makeFromPath(getPath(), true);
|
||||
}
|
||||
|
||||
bool RISCOSFilesystemNode::create(bool isDirectoryFlag) {
|
||||
bool success;
|
||||
|
||||
if (isDirectoryFlag) {
|
||||
success = _swix(OS_File, _INR(0,1), 8, toRISCOS(_path).c_str()) == NULL;
|
||||
} else {
|
||||
int fd = open(_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0755);
|
||||
success = fd >= 0;
|
||||
|
||||
if (fd >= 0) {
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
if (success) {
|
||||
if (exists()) {
|
||||
_isDirectory = _swi(OS_File, _INR(0,1)|_RETURN(0), 20, toRISCOS(_path).c_str()) == 2;
|
||||
if (_isDirectory != isDirectoryFlag) warning("failed to create %s: got %s", isDirectoryFlag ? "directory" : "file", _isDirectory ? "directory" : "file");
|
||||
return _isDirectory == isDirectoryFlag;
|
||||
}
|
||||
|
||||
warning("RISCOSFilesystemNode: Attempting to create a %s was a success, but access indicates there is no such %s",
|
||||
isDirectoryFlag ? "directory" : "file", isDirectoryFlag ? "directory" : "file");
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace Riscos {
|
||||
|
||||
bool assureDirectoryExists(const Common::String &dir, const char *prefix) {
|
||||
AbstractFSNode *node;
|
||||
|
||||
// Check whether the prefix exists if one is supplied.
|
||||
if (prefix) {
|
||||
node = new RISCOSFilesystemNode(prefix);
|
||||
if (!node->isDirectory()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Obtain absolute path.
|
||||
Common::String path;
|
||||
if (prefix) {
|
||||
path = prefix;
|
||||
path += '/';
|
||||
path += dir;
|
||||
} else {
|
||||
path = dir;
|
||||
}
|
||||
|
||||
path = Common::normalizePath(path, '/');
|
||||
|
||||
const Common::String::iterator end = path.end();
|
||||
Common::String::iterator cur = path.begin();
|
||||
if (*cur == '/')
|
||||
++cur;
|
||||
|
||||
do {
|
||||
if (cur + 1 != end) {
|
||||
if (*cur != '/') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// It is kind of ugly and against the purpose of Common::String to
|
||||
// insert 0s inside, but this is just for a local string and
|
||||
// simplifies the code a lot.
|
||||
*cur = '\0';
|
||||
}
|
||||
|
||||
node = new RISCOSFilesystemNode(path);
|
||||
if (!node->create(true)) {
|
||||
if (node->exists()) {
|
||||
if (!node->isDirectory()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
*cur = '/';
|
||||
} while (cur++ != end);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace RISCOS
|
||||
|
||||
#endif //#if defined(RISCOS)
|
105
backends/fs/riscos/riscos-fs.h
Normal file
105
backends/fs/riscos/riscos-fs.h
Normal file
@ -0,0 +1,105 @@
|
||||
/* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef RISCOS_FILESYSTEM_H
|
||||
#define RISCOS_FILESYSTEM_H
|
||||
|
||||
#include "backends/fs/abstract-fs.h"
|
||||
|
||||
/**
|
||||
* Implementation of the ScummVM file system API.
|
||||
*
|
||||
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||
*/
|
||||
class RISCOSFilesystemNode : public AbstractFSNode {
|
||||
protected:
|
||||
Common::String _displayName;
|
||||
Common::String _path;
|
||||
bool _isDirectory;
|
||||
bool _isValid;
|
||||
|
||||
virtual AbstractFSNode *makeNode(const Common::String &path) const {
|
||||
return new RISCOSFilesystemNode(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Plain constructor, for internal use only (hence protected).
|
||||
*/
|
||||
RISCOSFilesystemNode() : _isDirectory(false), _isValid(false) {}
|
||||
public:
|
||||
/**
|
||||
* Creates a RISCOSFilesystemNode for a given path.
|
||||
*
|
||||
* @param path the path the new node should point to.
|
||||
*/
|
||||
RISCOSFilesystemNode(const Common::String &path);
|
||||
|
||||
virtual bool exists() const;
|
||||
virtual Common::String getDisplayName() const { return _displayName; }
|
||||
virtual Common::String getName() const { return _displayName; }
|
||||
virtual Common::String getPath() const { return _path; }
|
||||
virtual bool isDirectory() const { return _isDirectory; }
|
||||
virtual bool isReadable() const;
|
||||
virtual bool isWritable() const;
|
||||
|
||||
virtual AbstractFSNode *getChild(const Common::String &n) const;
|
||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||
virtual AbstractFSNode *getParent() const;
|
||||
|
||||
virtual Common::SeekableReadStream *createReadStream();
|
||||
virtual Common::WriteStream *createWriteStream();
|
||||
virtual bool create(bool isDirectoryFlag);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Converts a Unix style path to a RISC OS style path.
|
||||
*
|
||||
* @param str Unix style path to convert.
|
||||
* @return RISC OS style path.
|
||||
*/
|
||||
static Common::String toRISCOS(Common::String &path);
|
||||
|
||||
/**
|
||||
* Converts a RISC OS style path to a Unix style path.
|
||||
*
|
||||
* @param str RISC OS style path to convert.
|
||||
* @return Unix style path.
|
||||
*/
|
||||
static Common::String toUnix(Common::String &path);
|
||||
|
||||
};
|
||||
|
||||
namespace Riscos {
|
||||
|
||||
/**
|
||||
* Assure that a directory path exists.
|
||||
*
|
||||
* @param dir The path which is required to exist.
|
||||
* @param prefix An (optional) prefix which should not be created if non existent.
|
||||
* prefix is prepended to dir if supplied.
|
||||
* @return true in case the directoy exists (or was created), false otherwise.
|
||||
*/
|
||||
bool assureDirectoryExists(const Common::String &dir, const char *prefix = nullptr);
|
||||
|
||||
} // End of namespace RISCOS
|
||||
|
||||
#endif
|
53
backends/platform/sdl/riscos/riscos-main.cpp
Normal file
53
backends/platform/sdl/riscos/riscos-main.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
/* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#if defined(RISCOS)
|
||||
|
||||
#include "backends/platform/sdl/riscos/riscos.h"
|
||||
#include "backends/plugins/sdl/sdl-provider.h"
|
||||
#include "base/main.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
// Create our OSystem instance
|
||||
g_system = new OSystem_RISCOS();
|
||||
assert(g_system);
|
||||
|
||||
// Pre initialize the backend
|
||||
((OSystem_RISCOS *)g_system)->init();
|
||||
|
||||
#ifdef DYNAMIC_MODULES
|
||||
PluginManager::instance().addPluginProvider(new SDLPluginProvider());
|
||||
#endif
|
||||
|
||||
// Invoke the actual ScummVM main entry point
|
||||
int res = scummvm_main(argc, argv);
|
||||
|
||||
// Free OSystem
|
||||
g_system->destroy();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
104
backends/platform/sdl/riscos/riscos.cpp
Normal file
104
backends/platform/sdl/riscos/riscos.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
/* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#ifdef RISCOS
|
||||
|
||||
#include "backends/platform/sdl/riscos/riscos.h"
|
||||
#include "backends/saves/default/default-saves.h"
|
||||
#include "backends/fs/riscos/riscos-fs-factory.h"
|
||||
#include "backends/fs/riscos/riscos-fs.h"
|
||||
|
||||
#include <kernel.h>
|
||||
#include <swis.h>
|
||||
|
||||
#ifndef URI_Dispatch
|
||||
#define URI_Dispatch 0x4e381
|
||||
#endif
|
||||
|
||||
void OSystem_RISCOS::init() {
|
||||
// Initialze File System Factory
|
||||
_fsFactory = new RISCOSFilesystemFactory();
|
||||
|
||||
// Invoke parent implementation of this method
|
||||
OSystem_SDL::init();
|
||||
}
|
||||
|
||||
void OSystem_RISCOS::initBackend() {
|
||||
// Create the savefile manager
|
||||
if (_savefileManager == 0) {
|
||||
Common::String savePath = "/<Choices$Write>/ResidualVM/Saves";
|
||||
if (Riscos::assureDirectoryExists(savePath))
|
||||
_savefileManager = new DefaultSaveFileManager(savePath);
|
||||
}
|
||||
|
||||
// Invoke parent implementation of this method
|
||||
OSystem_SDL::initBackend();
|
||||
}
|
||||
|
||||
bool OSystem_RISCOS::hasFeature(Feature f) {
|
||||
if (f == kFeatureOpenUrl)
|
||||
return true;
|
||||
|
||||
return OSystem_SDL::hasFeature(f);
|
||||
}
|
||||
|
||||
bool OSystem_RISCOS::openUrl(const Common::String &url) {
|
||||
int flags;
|
||||
if (_swix(URI_Dispatch, _INR(0,2)|_OUT(0), 0, url.c_str(), 0, &flags) != NULL) {
|
||||
warning("openUrl() (RISCOS) failed to open URL");
|
||||
return false;
|
||||
}
|
||||
if ((flags & 1) == 1) {
|
||||
warning("openUrl() (RISCOS) failed to open URL");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Common::String OSystem_RISCOS::getDefaultConfigFileName() {
|
||||
return "/<Choices$Write>/ResidualVM/residualvm";
|
||||
}
|
||||
|
||||
Common::WriteStream *OSystem_RISCOS::createLogFile() {
|
||||
// Start out by resetting _logFilePath, so that in case
|
||||
// of a failure, we know that no log file is open.
|
||||
_logFilePath.clear();
|
||||
|
||||
Common::String logFile = "/<Choices$Write>/ResidualVM/Logs";
|
||||
|
||||
if (!Riscos::assureDirectoryExists(logFile)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
logFile += "/residualvm";
|
||||
|
||||
Common::FSNode file(logFile);
|
||||
Common::WriteStream *stream = file.createWriteStream();
|
||||
if (stream)
|
||||
_logFilePath = logFile;
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
52
backends/platform/sdl/riscos/riscos.h
Normal file
52
backends/platform/sdl/riscos/riscos.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_SDL_RISCOS_H
|
||||
#define PLATFORM_SDL_RISCOS_H
|
||||
|
||||
#include "backends/platform/sdl/sdl.h"
|
||||
|
||||
class OSystem_RISCOS : public OSystem_SDL {
|
||||
public:
|
||||
virtual void init();
|
||||
virtual void initBackend();
|
||||
|
||||
virtual bool hasFeature(Feature f);
|
||||
|
||||
virtual bool openUrl(const Common::String &url);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The path of the currently open log file, if any.
|
||||
*
|
||||
* @note This is currently a string and not an FSNode for simplicity;
|
||||
* e.g. we don't need to include fs.h here, and currently the
|
||||
* only use of this value is to use it to open the log file in an
|
||||
* editor; for that, we need it only as a string anyway.
|
||||
*/
|
||||
Common::String _logFilePath;
|
||||
|
||||
virtual Common::String getDefaultConfigFileName();
|
||||
virtual Common::WriteStream *createLogFile();
|
||||
};
|
||||
|
||||
#endif
|
43
backends/platform/sdl/riscos/riscos.mk
Normal file
43
backends/platform/sdl/riscos/riscos.mk
Normal file
@ -0,0 +1,43 @@
|
||||
ifeq ($(shell echo a | iconv --to-code=RISCOS-LATIN1//TRANSLIT >/dev/null 2>&1; echo $$?),0)
|
||||
ENCODING=RISCOS-LATIN1//TRANSLIT
|
||||
else
|
||||
ENCODING=ISO-8859-1//TRANSLIT
|
||||
endif
|
||||
|
||||
APP_NAME=!ResidualVM
|
||||
|
||||
# Special target to create an RISC OS snapshot installation
|
||||
riscosdist: all
|
||||
mkdir -p $(APP_NAME)
|
||||
elf2aif $(EXECUTABLE) $(APP_NAME)/residualvm,ff8
|
||||
cp ${srcdir}/dists/riscos/!Boot,feb $(APP_NAME)/!Boot,feb
|
||||
cp ${srcdir}/dists/riscos/!Run,feb $(APP_NAME)/!Run,feb
|
||||
cp ${srcdir}/dists/riscos/!Sprites,ff9 $(APP_NAME)/!Sprites,ff9
|
||||
sed -i -e "s/|WimpSlot/WimpSlot -min `du -k $(APP_NAME)/residualvm,ff8 | cut -f1`K/g" $(APP_NAME)/!Run,feb
|
||||
mkdir -p $(APP_NAME)/data
|
||||
cp $(DIST_FILES_THEMES) $(APP_NAME)/data/
|
||||
ifdef DIST_FILES_NETWORKING
|
||||
cp $(DIST_FILES_NETWORKING) $(APP_NAME)/data/
|
||||
endif
|
||||
ifdef DIST_FILES_ENGINEDATA
|
||||
cp $(DIST_FILES_ENGINEDATA) $(APP_NAME)/data/
|
||||
endif
|
||||
# ResidualVM specific
|
||||
ifdef USE_OPENGL_SHADERS
|
||||
mkdir -p $(APP_NAME)/data/shaders
|
||||
cp $(DIST_FILES_SHADERS) $(APP_NAME)/data/shaders/
|
||||
endif
|
||||
ifdef DYNAMIC_MODULES
|
||||
mkdir -p $(APP_NAME)/plugins
|
||||
cp $(PLUGINS) $(APP_NAME)/plugins/
|
||||
endif
|
||||
mkdir -p $(APP_NAME)/docs
|
||||
cp ${srcdir}/dists/riscos/!Help,feb $(APP_NAME)/!Help,feb
|
||||
@$(foreach file, $(DIST_FILES_DOCS) $(srcdir)/doc/QuickStart, echo ' ' ICONV ' ' $(APP_NAME)/docs/$(notdir $(file)),fff;iconv --to-code=$(ENCODING) $(file) > $(APP_NAME)/docs/$(notdir $(file)),fff;)
|
||||
|
||||
clean: riscosclean
|
||||
|
||||
riscosclean:
|
||||
$(RM_REC) $(APP_NAME)
|
||||
|
||||
.PHONY: riscosdist riscosclean
|
2
configure
vendored
2
configure
vendored
@ -1509,7 +1509,7 @@ arm-*riscos)
|
||||
_host_os=riscos
|
||||
_host_cpu=arm
|
||||
_host_alias=$_host
|
||||
datarootdir='/\<ScummVM\$$Dir\>'
|
||||
datarootdir='/\<ResidualVM\$$Dir\>'
|
||||
datadir='${datarootdir}/data'
|
||||
docdir='${datarootdir}/docs'
|
||||
;;
|
||||
|
@ -38,6 +38,7 @@ my @subs_files = qw(
|
||||
dists/macosx/dockplugin/Info.plist
|
||||
dists/irix/residualvm.spec
|
||||
dists/android/AndroidManifest.xml
|
||||
dists/riscos/!Boot,feb
|
||||
);
|
||||
|
||||
my %subs = (
|
||||
|
8
dists/riscos/!Boot,feb
Normal file
8
dists/riscos/!Boot,feb
Normal file
@ -0,0 +1,8 @@
|
||||
Set ResidualVM$Dir <Obey$Dir>
|
||||
IconSprites <ResidualVM$Dir>.!Sprites
|
||||
|
||||
Set ResidualVM$Title "ResidualVM"
|
||||
Set ResidualVM$Description "Interpreter for several 3D games"
|
||||
Set ResidualVM$Publisher "ResidualVM Developers"
|
||||
Set ResidualVM$Web "http://www.residualvm.org/"
|
||||
Set ResidualVM$Version "0.4.0git"
|
8
dists/riscos/!Boot,feb.in
Normal file
8
dists/riscos/!Boot,feb.in
Normal file
@ -0,0 +1,8 @@
|
||||
Set ResidualVM$Dir <Obey$Dir>
|
||||
IconSprites <ResidualVM$Dir>.!Sprites
|
||||
|
||||
Set ResidualVM$Title "ResidualVM"
|
||||
Set ResidualVM$Description "Interpreter for several 3D games"
|
||||
Set ResidualVM$Publisher "ResidualVM Developers"
|
||||
Set ResidualVM$Web "http://www.residualvm.org/"
|
||||
Set ResidualVM$Version "@VERSION@"
|
2
dists/riscos/!Help,feb
Normal file
2
dists/riscos/!Help,feb
Normal file
@ -0,0 +1,2 @@
|
||||
Run <Obey$Dir>.!Boot
|
||||
Filer_Opendir <ResidualVM$Dir>.docs
|
13
dists/riscos/!Run,feb
Normal file
13
dists/riscos/!Run,feb
Normal file
@ -0,0 +1,13 @@
|
||||
Run <Obey$Dir>.!Boot
|
||||
|
||||
RMEnsure SharedUnixLibrary 1.14 RMLoad System:Modules.SharedULib
|
||||
RMEnsure SharedUnixLibrary 1.14 Error ResidualVM requires SharedUnixLibrary 1.14 or later. This can be downloaded from https://www.riscos.info/packages/LibraryDetails.html#SharedUnixLibrary
|
||||
|
||||
RMEnsure DigitalRenderer 0.56 RMLoad System:Modules.DRenderer
|
||||
RMEnsure DigitalRenderer 0.56 Error ResidualVM requires DigitalRenderer 0.56 or later. This can be downloaded from https://www.riscos.info/packages/LibraryDetails.html#DRenderer
|
||||
|
||||
Set ResidualVM$stdout ><Choices$Write>.ResidualVM.stdout 2><Choices$Write>.ResidualVM.stderr
|
||||
If "<Wimp$State>"="commands" Then Unset ResidualVM$stdout Else CDir <Choices$Write>.ResidualVM
|
||||
|
||||
|WimpSlot
|
||||
Do Run <ResidualVM$Dir>.residualvm %*0 <ResidualVM$stdout>
|
BIN
dists/riscos/!Sprites,ff9
Executable file
BIN
dists/riscos/!Sprites,ff9
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user