Initial commit
This commit is contained in:
82
backends/platform/sdl/amigaos/amigaos-main.cpp
Normal file
82
backends/platform/sdl/amigaos/amigaos-main.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/* 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(__amigaos4__)
|
||||
|
||||
#include "backends/fs/amigaos/amigaos-fs.h"
|
||||
#include "backends/platform/sdl/amigaos/amigaos.h"
|
||||
#include "backends/plugins/sdl/sdl-provider.h"
|
||||
#include "base/main.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
// Update support (AmiUpdate):
|
||||
// This will save ScummVM's system application name and add it's binary
|
||||
// path to a variable in the platforms native ENV(ARC) system.
|
||||
const char *const appname = "ScummVM";
|
||||
|
||||
BPTR lock;
|
||||
APTR reqwin;
|
||||
|
||||
// Obtain a lock to it's home directory.
|
||||
if ((lock = IDOS->GetProgramDir())) {
|
||||
TEXT progpath[2048];
|
||||
TEXT apppath[1024] = "AppPaths";
|
||||
|
||||
if (IDOS->DevNameFromLock(lock, progpath, sizeof(progpath), DN_FULLPATH)) {
|
||||
// Stop any "Please insert volume ..." type system requester.
|
||||
reqwin = IDOS->SetProcWindow((APTR)-1);
|
||||
|
||||
// Set the AppPaths variable to the path the binary was run from.
|
||||
IDOS->AddPart(apppath, appname, 1024);
|
||||
IDOS->SetVar(apppath, progpath, -1, GVF_GLOBAL_ONLY|GVF_SAVE_VAR);
|
||||
|
||||
// Turn system requester back on.
|
||||
IDOS->SetProcWindow(reqwin);
|
||||
}
|
||||
}
|
||||
|
||||
// Set a stack cookie to avoid crashes from a too low stack.
|
||||
static const char *stack_cookie __attribute__((used)) = "$STACK: 4096000";
|
||||
|
||||
// Create our OSystem instance.
|
||||
g_system = new OSystem_AmigaOS();
|
||||
assert(g_system);
|
||||
|
||||
// Pre-initialize the backend.
|
||||
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
|
||||
156
backends/platform/sdl/amigaos/amigaos.cpp
Normal file
156
backends/platform/sdl/amigaos/amigaos.cpp
Normal file
@@ -0,0 +1,156 @@
|
||||
/* 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 __amigaos4__
|
||||
|
||||
#include "backends/platform/sdl/amigaos/amigaos.h"
|
||||
#include "backends/fs/amigaos/amigaos-fs-factory.h"
|
||||
#include "backends/dialogs/amigaos/amigaos-dialogs.h"
|
||||
|
||||
static bool cleanupDone = false;
|
||||
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
static bool sdlGLLoadLibrary(const char *path) {
|
||||
return SDL_GL_LoadLibrary(path);
|
||||
}
|
||||
#else
|
||||
static bool sdlGLLoadLibrary(const char *path) {
|
||||
return SDL_GL_LoadLibrary(path) != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void cleanup() {
|
||||
if (!cleanupDone)
|
||||
g_system->destroy();
|
||||
}
|
||||
|
||||
OSystem_AmigaOS::~OSystem_AmigaOS() {
|
||||
cleanupDone = true;
|
||||
}
|
||||
|
||||
void OSystem_AmigaOS::init() {
|
||||
// Register cleanup function to avoid unfreed signals
|
||||
if (atexit(cleanup))
|
||||
warning("Failed to register cleanup function via atexit()");
|
||||
|
||||
// Initialize File System Factory
|
||||
_fsFactory = new AmigaOSFilesystemFactory();
|
||||
|
||||
// Invoke parent implementation of this method
|
||||
OSystem_SDL::init();
|
||||
|
||||
#if defined(USE_SYSDIALOGS)
|
||||
_dialogManager = new AmigaOSDialogManager();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool OSystem_AmigaOS::hasFeature(Feature f) {
|
||||
#if defined(USE_SYSDIALOGS)
|
||||
if (f == kFeatureSystemBrowserDialog)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return OSystem_SDL::hasFeature(f);
|
||||
}
|
||||
|
||||
void OSystem_AmigaOS::initBackend() {
|
||||
// AmigaOS4 SDL provides two OpenGL implementations
|
||||
// (OpenGL 1.3 with miniGL and OpenGL ES with OGLES2)
|
||||
// This is chosen by setting the profile mask attribute
|
||||
// before the first window creation but after init
|
||||
int force = 0;
|
||||
if (ConfMan.hasKey("opengl_implementation")) {
|
||||
Common::String implem = ConfMan.get("opengl_implementation");
|
||||
if (implem == "gl") {
|
||||
force = 1;;
|
||||
} else if (implem == "gles2") {
|
||||
force = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// If not forcing, try OGLES2 first
|
||||
if (!force || force == 2) {
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
if (!sdlGLLoadLibrary(NULL)) {
|
||||
if (force) {
|
||||
warning("OpenGL implementation chosen is unsupported, falling back");
|
||||
force = 0;
|
||||
}
|
||||
// SDL doesn't seem to be clean when loading fail
|
||||
SDL_GL_UnloadLibrary();
|
||||
SDL_GL_ResetAttributes();
|
||||
} else {
|
||||
// Loading succeeded, don't try anything more
|
||||
force = 2;
|
||||
}
|
||||
}
|
||||
// If not forcing, next try miniGL
|
||||
if (!force || force == 1) {
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
||||
if (!sdlGLLoadLibrary(NULL)) {
|
||||
if (force) {
|
||||
warning("OpenGL implementation chosen is unsupported, falling back");
|
||||
force = 0;
|
||||
}
|
||||
// SDL doesn't seem to be clean when loading fail
|
||||
SDL_GL_UnloadLibrary();
|
||||
SDL_GL_ResetAttributes();
|
||||
} else {
|
||||
// Loading succeeded, don't try anything more
|
||||
force = 1;
|
||||
}
|
||||
}
|
||||
// First time user defaults
|
||||
ConfMan.registerDefault("audio_buffer_size", "2048");
|
||||
ConfMan.registerDefault("extrapath", Common::Path("extras/"));
|
||||
ConfMan.registerDefault("iconspath", Common::Path("icons/"));
|
||||
ConfMan.registerDefault("pluginspath", Common::Path("plugins/"));
|
||||
ConfMan.registerDefault("savepath", Common::Path("saves/"));
|
||||
ConfMan.registerDefault("themepath", Common::Path("themes/"));
|
||||
// First time .ini defaults
|
||||
if (!ConfMan.hasKey("audio_buffer_size")) {
|
||||
ConfMan.set("audio_buffer_size", "2048");
|
||||
}
|
||||
if (!ConfMan.hasKey("extrapath")) {
|
||||
ConfMan.setPath("extrapath", "extras/");
|
||||
}
|
||||
if (!ConfMan.hasKey("iconspath")) {
|
||||
ConfMan.setPath("iconspath", "icons/");
|
||||
}
|
||||
if (!ConfMan.hasKey("pluginspath")) {
|
||||
ConfMan.setPath("pluginspath", "plugins/");
|
||||
}
|
||||
if (!ConfMan.hasKey("savepath")) {
|
||||
ConfMan.setPath("savepath", "saves/");
|
||||
}
|
||||
if (!ConfMan.hasKey("themepath")) {
|
||||
ConfMan.setPath("themepath", "themes/");
|
||||
}
|
||||
OSystem_SDL::initBackend();
|
||||
}
|
||||
|
||||
#endif
|
||||
38
backends/platform/sdl/amigaos/amigaos.h
Normal file
38
backends/platform/sdl/amigaos/amigaos.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/* 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_AMIGAOS_H
|
||||
#define PLATFORM_SDL_AMIGAOS_H
|
||||
|
||||
#include "backends/platform/sdl/sdl.h"
|
||||
|
||||
class OSystem_AmigaOS : public OSystem_SDL {
|
||||
public:
|
||||
OSystem_AmigaOS() {}
|
||||
virtual ~OSystem_AmigaOS();
|
||||
|
||||
bool hasFeature(Feature f) override;
|
||||
|
||||
void init() override;
|
||||
void initBackend() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
74
backends/platform/sdl/amigaos/amigaos.mk
Normal file
74
backends/platform/sdl/amigaos/amigaos.mk
Normal file
@@ -0,0 +1,74 @@
|
||||
# Special target to create an AmigaOS snapshot installation.
|
||||
#
|
||||
# WORKAROUNDS:
|
||||
#
|
||||
# 'mkdir' seems to incorrectly set permissions to path/dirs on AmigaOS.
|
||||
# Once a vanilla installation is created, none of the corresponding subdirs
|
||||
# are found or accessible (extras, themes, plugins), instead ScummVM will
|
||||
# report missing theme files and a missing valid translation.dat. Same with
|
||||
# cross-partition access (which make we wonder if it's a FS bug afterall).
|
||||
# Switching to AmigaOS' own "makedir" until there is a fix or other solution.
|
||||
#
|
||||
amigaosdist: $(EXECUTABLE) $(PLUGINS)
|
||||
# Releases should always be completely fresh installs.
|
||||
rm -rf $(AMIGAOSPATH)
|
||||
makedir all $(AMIGAOSPATH)
|
||||
$(CP) ${srcdir}/dists/amigaos/scummvm_drawer.info $(patsubst %/,%,$(AMIGAOSPATH)).info
|
||||
$(CP) ${srcdir}/dists/amigaos/scummvm.info $(AMIGAOSPATH)/$(EXECUTABLE).info
|
||||
ifdef DIST_FILES_DOCS
|
||||
makedir all $(AMIGAOSPATH)/doc
|
||||
$(CP) $(DIST_FILES_DOCS) $(AMIGAOSPATH)/doc
|
||||
$(foreach lang, $(DIST_FILES_DOCS_languages), makedir all $(AMIGAOSPATH)/doc/$(lang); $(CP) $(DIST_FILES_DOCS_$(lang)) $(AMIGAOSPATH)/doc/$(lang);)
|
||||
# README.md and corresponding scripts must be in cwd
|
||||
# when building out of tree.
|
||||
$(CP) ${srcdir}/README.md README.tmp
|
||||
$(CP) ${srcdir}/dists/amigaos/md2ag.rexx .
|
||||
# (buildbot) LC_ALL is here to work around Debian bug #973647
|
||||
LC_ALL=C rx md2ag.rexx README.tmp $(AMIGAOSPATH)/doc/
|
||||
rm -f md2ag.rexx README.tmp
|
||||
endif
|
||||
# Copy mandatory installation files.
|
||||
makedir all $(AMIGAOSPATH)/extras
|
||||
ifdef DIST_FILES_ENGINEDATA
|
||||
$(CP) $(DIST_FILES_ENGINEDATA) $(AMIGAOSPATH)/extras
|
||||
endif
|
||||
ifdef DIST_FILES_NETWORKING
|
||||
$(CP) $(DIST_FILES_NETWORKING) $(AMIGAOSPATH)/extras
|
||||
endif
|
||||
ifdef DIST_FILES_VKEYBD
|
||||
$(CP) $(DIST_FILES_VKEYBD) $(AMIGAOSPATH)/extras
|
||||
endif
|
||||
ifdef DIST_FILES_THEMES
|
||||
makedir all $(AMIGAOSPATH)/themes
|
||||
$(CP) $(DIST_FILES_THEMES) $(AMIGAOSPATH)/themes
|
||||
endif
|
||||
ifneq ($(DIST_FILES_SHADERS),)
|
||||
makedir all $(AMIGAOSPATH)/extras/shaders
|
||||
$(CP) $(DIST_FILES_SHADERS) $(AMIGAOSPATH)/extras/shaders
|
||||
endif
|
||||
ifdef DYNAMIC_MODULES
|
||||
makedir all $(AMIGAOSPATH)/plugins
|
||||
# Catch edge-case when no engines/plugins are compiled
|
||||
# otherwise cp/strip will error out due to missing source files.
|
||||
ifneq ($(PLUGINS),)
|
||||
ifdef DEBUG_BUILD
|
||||
# Preserve all debug information on debug builds
|
||||
$(CP) $(PLUGINS) $(AMIGAOSPATH)/plugins/$(plugin)
|
||||
else
|
||||
$(foreach plugin, $(PLUGINS), $(STRIP) $(plugin) -o $(AMIGAOSPATH)/$(plugin);)
|
||||
endif
|
||||
endif
|
||||
makedir all $(AMIGAOSPATH)/sobjs
|
||||
# AmigaOS installations, especially vanilla ones, won't have every
|
||||
# mandatory shared library in place, let alone the correct versions.
|
||||
# Extract and install compiled-in shared libraries to their own subdir.
|
||||
$(CP) ${srcdir}/dists/amigaos/install_deps.rexx .
|
||||
rx install_deps.rexx $(EXECUTABLE) $(AMIGAOSPATH)
|
||||
rm -f install_deps.rexx
|
||||
endif
|
||||
ifdef DEBUG_BUILD
|
||||
# Preserve all debug information on debug builds
|
||||
$(CP) $(EXECUTABLE) $(AMIGAOSPATH)/$(EXECUTABLE)
|
||||
else
|
||||
$(STRIP) $(EXECUTABLE) -o $(AMIGAOSPATH)/$(EXECUTABLE)
|
||||
endif
|
||||
Reference in New Issue
Block a user