Initial commit
This commit is contained in:
62
backends/platform/sdl/riscos/riscos-main.cpp
Normal file
62
backends/platform/sdl/riscos/riscos-main.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#if defined(RISCOS)
|
||||
|
||||
#include "backends/platform/sdl/riscos/riscos.h"
|
||||
#include "backends/plugins/riscos/riscos-provider.h"
|
||||
#include "base/main.h"
|
||||
|
||||
#include <unixlib/local.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
||||
static void signal_handler(int signum) {
|
||||
__write_backtrace(signum);
|
||||
error("Received unexpected signal: %s, exiting", strsignal(signum));
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
signal(SIGSEGV, signal_handler);
|
||||
|
||||
// Create our OSystem instance
|
||||
g_system = new OSystem_RISCOS();
|
||||
assert(g_system);
|
||||
|
||||
// Pre initialize the backend
|
||||
g_system->init();
|
||||
|
||||
#ifdef DYNAMIC_MODULES
|
||||
PluginManager::instance().addPluginProvider(new RiscOSPluginProvider());
|
||||
#endif
|
||||
|
||||
// Invoke the actual ScummVM main entry point
|
||||
int res = scummvm_main(argc, argv);
|
||||
|
||||
// Free OSystem
|
||||
g_system->destroy();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
||||
68
backends/platform/sdl/riscos/riscos-utils.cpp
Normal file
68
backends/platform/sdl/riscos/riscos-utils.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "backends/platform/sdl/riscos/riscos-utils.h"
|
||||
|
||||
#include <unixlib/local.h>
|
||||
|
||||
namespace RISCOS_Utils {
|
||||
|
||||
Common::String 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 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;
|
||||
}
|
||||
|
||||
}
|
||||
48
backends/platform/sdl/riscos/riscos-utils.h
Normal file
48
backends/platform/sdl/riscos/riscos-utils.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_SDL_RISCOS_UTILS_H
|
||||
#define PLATFORM_SDL_RISCOS_UTILS_H
|
||||
|
||||
#include "common/str.h"
|
||||
|
||||
// Helper functions
|
||||
namespace RISCOS_Utils {
|
||||
|
||||
/**
|
||||
* Converts a Unix style path to a RISC OS style path.
|
||||
*
|
||||
* @param str Unix style path to convert.
|
||||
* @return RISC OS style path.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
Common::String toUnix(Common::String path);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
171
backends/platform/sdl/riscos/riscos.cpp
Normal file
171
backends/platform/sdl/riscos/riscos.cpp
Normal file
@@ -0,0 +1,171 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#ifdef RISCOS
|
||||
|
||||
#include "backends/platform/sdl/riscos/riscos.h"
|
||||
#include "backends/saves/default/default-saves.h"
|
||||
#include "backends/events/riscossdl/riscossdl-events.h"
|
||||
#include "backends/graphics/riscossdl/riscossdl-graphics.h"
|
||||
#include "backends/fs/riscos/riscos-fs-factory.h"
|
||||
#include "backends/fs/riscos/riscos-fs.h"
|
||||
|
||||
#include "common/config-manager.h"
|
||||
|
||||
#include <kernel.h>
|
||||
#include <swis.h>
|
||||
|
||||
#ifndef URI_Dispatch
|
||||
#define URI_Dispatch 0x4e381
|
||||
#endif
|
||||
|
||||
#ifndef Report_Text0
|
||||
#define Report_Text0 0x54c80
|
||||
#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() {
|
||||
ConfMan.registerDefault("enable_reporter", false);
|
||||
|
||||
// Create the events manager
|
||||
if (_eventSource == 0)
|
||||
_eventSource = new RISCOSSdlEventSource();
|
||||
|
||||
// Create the graphics manager
|
||||
if (!_graphicsManager)
|
||||
_graphicsManager = new RISCOSSdlGraphicsManager(_eventSource, _window);
|
||||
|
||||
// Create the savefile manager
|
||||
if (_savefileManager == 0) {
|
||||
Common::String savePath = "/<Choices$Write>/ScummVM/Saves";
|
||||
if (Riscos::assureDirectoryExists(savePath))
|
||||
_savefileManager = new DefaultSaveFileManager(Common::Path(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;
|
||||
}
|
||||
|
||||
void OSystem_RISCOS::logMessage(LogMessageType::Type type, const char *message) {
|
||||
OSystem_SDL::logMessage(type, message);
|
||||
|
||||
// Log messages using !Reporter, available from http://www.avisoft.force9.co.uk/Reporter.htm
|
||||
if (!(ConfMan.hasKey("enable_reporter") && ConfMan.getBool("enable_reporter")))
|
||||
return;
|
||||
|
||||
char colour;
|
||||
switch (type) {
|
||||
case LogMessageType::kError:
|
||||
colour = 'r';
|
||||
break;
|
||||
case LogMessageType::kWarning:
|
||||
colour = 'o';
|
||||
break;
|
||||
case LogMessageType::kInfo:
|
||||
colour = 'l';
|
||||
break;
|
||||
case LogMessageType::kDebug:
|
||||
default:
|
||||
colour = 'f';
|
||||
break;
|
||||
}
|
||||
|
||||
Common::String report = Common::String::format("\\%c %s", colour, message);
|
||||
_swix(Report_Text0, _IN(0), report.c_str());
|
||||
}
|
||||
|
||||
void OSystem_RISCOS::messageBox(LogMessageType::Type type, const char *message) {
|
||||
_kernel_swi_regs regs;
|
||||
_kernel_oserror error;
|
||||
|
||||
error.errnum = 0;
|
||||
Common::strlcpy(error.errmess, message, 252);
|
||||
regs.r[0] = (int)&error;
|
||||
regs.r[1] = 0;
|
||||
regs.r[2] = (int)"ScummVM";
|
||||
regs.r[3] = 0;
|
||||
regs.r[4] = 0;
|
||||
regs.r[5] = 0;
|
||||
|
||||
switch (type) {
|
||||
case LogMessageType::kError:
|
||||
regs.r[1] |= (1 << 8);
|
||||
break;
|
||||
case LogMessageType::kWarning:
|
||||
regs.r[1] |= (1 << 8) | (2 << 9);
|
||||
break;
|
||||
case LogMessageType::kInfo:
|
||||
case LogMessageType::kDebug:
|
||||
default:
|
||||
regs.r[1] |= (1 << 8) | (1 << 9);
|
||||
break;
|
||||
}
|
||||
|
||||
_kernel_swi(Wimp_ReportError, ®s, ®s);
|
||||
}
|
||||
|
||||
Common::Path OSystem_RISCOS::getDefaultConfigFileName() {
|
||||
return "/<Choices$Write>/ScummVM/scummvmrc";
|
||||
}
|
||||
|
||||
Common::Path OSystem_RISCOS::getDefaultLogFileName() {
|
||||
Common::String logFile = "/<Choices$Write>/ScummVM/Logs";
|
||||
|
||||
if (!Riscos::assureDirectoryExists(logFile)) {
|
||||
return Common::Path();
|
||||
}
|
||||
|
||||
Common::Path logPath(logFile);
|
||||
logPath.joinInPlace("scummvm");
|
||||
return logPath;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
44
backends/platform/sdl/riscos/riscos.h
Normal file
44
backends/platform/sdl/riscos/riscos.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#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);
|
||||
|
||||
virtual void logMessage(LogMessageType::Type type, const char *message);
|
||||
virtual void messageBox(LogMessageType::Type type, const char *message);
|
||||
|
||||
protected:
|
||||
virtual Common::Path getDefaultConfigFileName();
|
||||
virtual Common::Path getDefaultLogFileName();
|
||||
};
|
||||
|
||||
#endif
|
||||
69
backends/platform/sdl/riscos/riscos.mk
Normal file
69
backends/platform/sdl/riscos/riscos.mk
Normal file
@@ -0,0 +1,69 @@
|
||||
ifeq ($(shell echo a | iconv --to-code=RISCOS-LATIN1//IGNORE//TRANSLIT >/dev/null 2>&1; echo $$?),0)
|
||||
ENCODING=RISCOS-LATIN1//IGNORE//TRANSLIT
|
||||
else
|
||||
ENCODING=ISO-8859-1//IGNORE//TRANSLIT
|
||||
endif
|
||||
|
||||
BASE_APP_NAME ?= !ScummVM
|
||||
APP_NAME ?= $(BASE_APP_NAME)
|
||||
|
||||
DIST_FILES_DOCS_plaintext := $(filter-out $(DIST_FILES_MANUAL),$(DIST_FILES_DOCS))
|
||||
|
||||
# Special target to create an RISC OS snapshot installation
|
||||
riscosdist: all
|
||||
mkdir -p $(APP_NAME)
|
||||
elf2aif $(EXECUTABLE) $(APP_NAME)/scummvm,ff8
|
||||
cp ${srcdir}/dists/riscos/!Help,feb $(APP_NAME)/!Help,feb
|
||||
ifdef MAKERUN
|
||||
$(MAKERUN) $(APP_NAME)/scummvm,ff8 ${srcdir}/dists/riscos/!Run,feb $(APP_NAME)/!Run,feb
|
||||
else
|
||||
cp ${srcdir}/dists/riscos/!Run,feb $(APP_NAME)/!Run,feb
|
||||
sed -i -e "s/WIMPSLOT/WimpSlot -min $$(($$(du -k $(EXECUTABLE) | cut -f1) + 32))K/g" $(APP_NAME)/!Run,feb
|
||||
endif
|
||||
ifeq ($(APP_NAME),$(BASE_APP_NAME))
|
||||
cp ${srcdir}/dists/riscos/!Boot,feb $(APP_NAME)/!Boot,feb
|
||||
cp ${srcdir}/dists/riscos/!Sprites,ff9 $(APP_NAME)/!Sprites,ff9
|
||||
cp ${srcdir}/dists/riscos/!Sprites11,ff9 $(APP_NAME)/!Sprites11,ff9
|
||||
cp ${srcdir}/dists/riscos/!SpritesA1,ff9 $(APP_NAME)/!SpritesA1,ff9
|
||||
cp ${srcdir}/dists/riscos/!SpritesA2,ff9 $(APP_NAME)/!SpritesA2,ff9
|
||||
else
|
||||
cp ${srcdir}/dists/riscos/$(APP_NAME)/!Boot,feb $(APP_NAME)/!Boot,feb
|
||||
cp ${srcdir}/dists/riscos/$(APP_NAME)/!Sprites,ff9 $(APP_NAME)/!Sprites,ff9
|
||||
cp ${srcdir}/dists/riscos/$(APP_NAME)/!Sprites11,ff9 $(APP_NAME)/!Sprites11,ff9
|
||||
endif
|
||||
mkdir -p $(BASE_APP_NAME)/data
|
||||
cp $(DIST_FILES_THEMES) $(BASE_APP_NAME)/data/
|
||||
ifdef DIST_FILES_NETWORKING
|
||||
cp $(DIST_FILES_NETWORKING) $(BASE_APP_NAME)/data/
|
||||
endif
|
||||
ifdef DIST_FILES_ENGINEDATA
|
||||
cp $(DIST_FILES_ENGINEDATA) $(BASE_APP_NAME)/data/
|
||||
endif
|
||||
ifdef DIST_FILES_VKEYBD
|
||||
cp $(DIST_FILES_VKEYBD) $(BASE_APP_NAME)/data/
|
||||
endif
|
||||
ifdef DYNAMIC_MODULES
|
||||
mkdir -p $(APP_NAME)/plugins
|
||||
cp $(PLUGINS) $(APP_NAME)/plugins/
|
||||
endif
|
||||
ifeq ($(APP_NAME),$(BASE_APP_NAME))
|
||||
mkdir -p $(APP_NAME)/docs
|
||||
ifdef TOKENIZE
|
||||
$(TOKENIZE) ${srcdir}/dists/riscos/FindHelp,fd1 -out $(APP_NAME)/FindHelp,ffb
|
||||
endif
|
||||
ifdef DIST_FILES_MANUAL
|
||||
ifneq ("$(wildcard $(DIST_FILES_MANUAL))","")
|
||||
cp $(DIST_FILES_MANUAL) $(APP_NAME)/docs/ScummVM,adf
|
||||
endif
|
||||
endif
|
||||
@$(foreach file, $(DIST_FILES_DOCS_plaintext) $(srcdir)/doc/QuickStart, echo ' ' ICONV ' ' $(APP_NAME)/docs/$(notdir $(file)),fff;iconv --to-code=$(ENCODING) $(file) > $(APP_NAME)/docs/$(notdir $(file)),fff;)
|
||||
@$(foreach lang, $(DIST_FILES_DOCS_languages), mkdir -p $(APP_NAME)/docs/$(lang); $(foreach file, $(DIST_FILES_DOCS_$(lang)), echo ' ' ICONV ' ' $(APP_NAME)/docs/$(lang)/$(notdir $(file)),fff;iconv --from-code=UTF-8 --to-code=$(ENCODING) $(file) > $(APP_NAME)/docs/$(lang)/$(notdir $(file)),fff;))
|
||||
endif
|
||||
|
||||
clean: riscosclean
|
||||
|
||||
riscosclean:
|
||||
$(RM_REC) $(APP_NAME)
|
||||
$(RM_REC) $(BASE_APP_NAME)
|
||||
|
||||
.PHONY: riscosdist riscosclean
|
||||
Reference in New Issue
Block a user