Initial commit
This commit is contained in:
11
backends/platform/sdl/kolibrios/build-kolibri.sh
Normal file
11
backends/platform/sdl/kolibrios/build-kolibri.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
export KOS32_SDK_DIR=$HOME/kolibrios/contrib/sdk
|
||||
export KOS32_AUTOBUILD=$HOME/autobuild
|
||||
|
||||
# Use plugins for both engines and detection as KolibriOS has a limit per executable module
|
||||
./configure --host=kos32 --enable-release --enable-plugins --default-dynamic --enable-detection-dynamic --with-vorbis-prefix=$KOS32_SDK_DIR/sources/libvorbis-1.3.7 --with-ogg-prefix=$KOS32_SDK_DIR/sources/libogg-1.3.5 --enable-engine=testbed
|
||||
|
||||
make -j12 all zip-root scummvm-zip
|
||||
48
backends/platform/sdl/kolibrios/kolibrios-main.cpp
Normal file
48
backends/platform/sdl/kolibrios/kolibrios-main.cpp
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/>.
|
||||
*
|
||||
*/
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#include "backends/platform/sdl/kolibrios/kolibrios.h"
|
||||
#include "backends/plugins/kolibrios/kolibrios-provider.h"
|
||||
#include "base/main.h"
|
||||
|
||||
extern "C" int kolibrios_main(int argc, char *argv[]) {
|
||||
// Create our OSystem instance
|
||||
g_system = new OSystem_KolibriOS(argv[0]);
|
||||
assert(g_system);
|
||||
|
||||
// Pre initialize the backend
|
||||
g_system->init();
|
||||
|
||||
#ifdef DYNAMIC_MODULES
|
||||
PluginManager::instance().addPluginProvider(new KolibriOSPluginProvider());
|
||||
#endif
|
||||
|
||||
// Invoke the actual ScummVM main entry point:
|
||||
int res = scummvm_main(argc, argv);
|
||||
|
||||
// Free OSystem
|
||||
g_system->destroy();
|
||||
|
||||
return res;
|
||||
}
|
||||
117
backends/platform/sdl/kolibrios/kolibrios.cpp
Normal file
117
backends/platform/sdl/kolibrios/kolibrios.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
/* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_getenv
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_exit
|
||||
#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#include "backends/audiocd/default/default-audiocd.h"
|
||||
#include "backends/platform/sdl/kolibrios/kolibrios.h"
|
||||
#include "backends/saves/kolibrios/kolibrios-saves.h"
|
||||
#include "backends/fs/kolibrios/kolibrios-fs-factory.h"
|
||||
#include "backends/fs/kolibrios/kolibrios-fs.h"
|
||||
|
||||
#include "common/textconsole.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
OSystem_KolibriOS::OSystem_KolibriOS(const char *exeName) : _exeName(exeName) {
|
||||
}
|
||||
|
||||
void OSystem_KolibriOS::init() {
|
||||
_exePath = Common::Path(_exeName).getParent();
|
||||
if (KolibriOS::assureDirectoryExists("scummvm-home", _exePath.toString().c_str())) {
|
||||
debug("Using <exec>/scummvm-home");
|
||||
_writablePath = _exePath.join("scummvm-home");
|
||||
} else {
|
||||
KolibriOS::assureDirectoryExists("scummvm", "/tmp0/1");
|
||||
_writablePath = "/tmp0/1/scummvm";
|
||||
debug("Using /tmp0/1");
|
||||
}
|
||||
|
||||
// Initialze File System Factory
|
||||
_fsFactory = new KolibriOSFilesystemFactory();
|
||||
|
||||
// Invoke parent implementation of this method
|
||||
OSystem_SDL::init();
|
||||
}
|
||||
|
||||
void OSystem_KolibriOS::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
|
||||
Common::FSNode dataNode(_exePath);
|
||||
s.add("exePath", new Common::FSDirectory(dataNode, 4), priority);
|
||||
}
|
||||
|
||||
void OSystem_KolibriOS::initBackend() {
|
||||
Common::Path defaultThemePath = _exePath.join("themes");
|
||||
Common::Path defaultEngineData = _exePath.join("engine-data");
|
||||
ConfMan.registerDefault("themepath", defaultThemePath);
|
||||
ConfMan.registerDefault("extrapath", defaultEngineData);
|
||||
|
||||
if (!ConfMan.hasKey("themepath")) {
|
||||
ConfMan.setPath("themepath", defaultThemePath);
|
||||
}
|
||||
if (!ConfMan.hasKey("extrapath")) {
|
||||
ConfMan.setPath("extrapath", defaultEngineData);
|
||||
}
|
||||
|
||||
// Create the savefile manager
|
||||
if (_savefileManager == 0)
|
||||
_savefileManager = new KolibriOSSaveFileManager(_writablePath);
|
||||
|
||||
// Invoke parent implementation of this method
|
||||
OSystem_SDL::initBackend();
|
||||
}
|
||||
|
||||
Common::Path OSystem_KolibriOS::getDefaultConfigFileName() {
|
||||
return _writablePath.join("scummvm.ini");
|
||||
}
|
||||
|
||||
Common::Path OSystem_KolibriOS::getDefaultIconsPath() {
|
||||
return _exePath.join("icons");
|
||||
}
|
||||
|
||||
Common::Path OSystem_KolibriOS::getScreenshotsPath() {
|
||||
// If the user has configured a screenshots path, use it
|
||||
const Common::Path path = OSystem_SDL::getScreenshotsPath();
|
||||
if (!path.empty()) {
|
||||
return path;
|
||||
}
|
||||
|
||||
static const char *const SCREENSHOTS_DIR_NAME = "ScummVM Screenshots";
|
||||
if (!KolibriOS::assureDirectoryExists(SCREENSHOTS_DIR_NAME, _writablePath.toString(Common::Path::kNativeSeparator).c_str())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return _writablePath.join(SCREENSHOTS_DIR_NAME);
|
||||
}
|
||||
|
||||
Common::Path OSystem_KolibriOS::getDefaultLogFileName() {
|
||||
return _writablePath.join("scummvm.log");
|
||||
}
|
||||
|
||||
AudioCDManager *OSystem_KolibriOS::createAudioCDManager() {
|
||||
return new DefaultAudioCDManager();
|
||||
}
|
||||
52
backends/platform/sdl/kolibrios/kolibrios.h
Normal file
52
backends/platform/sdl/kolibrios/kolibrios.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 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_KOLIBRIOS_H
|
||||
#define PLATFORM_SDL_KOLIBRIOS_H
|
||||
|
||||
#include "backends/platform/sdl/sdl.h"
|
||||
|
||||
class OSystem_KolibriOS : public OSystem_SDL {
|
||||
public:
|
||||
OSystem_KolibriOS(const char *exeName);
|
||||
|
||||
void init() override;
|
||||
void initBackend() override;
|
||||
|
||||
// Default paths
|
||||
Common::Path getDefaultIconsPath() override;
|
||||
Common::Path getScreenshotsPath() override;
|
||||
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority) override;
|
||||
const Common::Path& getExePath() const { return _exePath; }
|
||||
|
||||
protected:
|
||||
Common::Path getDefaultConfigFileName() override;
|
||||
Common::Path getDefaultLogFileName() override;
|
||||
|
||||
AudioCDManager *createAudioCDManager() override;
|
||||
|
||||
private:
|
||||
Common::Path _exePath;
|
||||
Common::Path _writablePath;
|
||||
Common::String _exeName;
|
||||
};
|
||||
|
||||
#endif
|
||||
35
backends/platform/sdl/kolibrios/kolibrios.mk
Normal file
35
backends/platform/sdl/kolibrios/kolibrios.mk
Normal file
@@ -0,0 +1,35 @@
|
||||
bundle = zip-root
|
||||
|
||||
all: scummvm.kos $(EXECUTABLE)
|
||||
|
||||
scummvm.kos: $(srcdir)/backends/platform/sdl/kolibrios/wrapper-main.c
|
||||
+$(QUIET_CC)$(CXX) -I$(KOS32_SDK_DIR)/sources/newlib/libc/include -specs=$(srcdir)/backends/platform/sdl/kolibrios/kolibrios.spec -x c -o $@.coff $<
|
||||
+$(QUIET)$(KOS32_AUTOBUILD)/tools/win32/bin/kos32-objcopy $@.coff -O binary $@
|
||||
|
||||
$(bundle): all
|
||||
$(RM) -rf $(bundle)
|
||||
$(MKDIR) -p $(bundle)/scummvm
|
||||
$(CP) $(DIST_FILES_DOCS) $(bundle)/scummvm
|
||||
$(MKDIR) $(bundle)/scummvm/themes
|
||||
$(CP) $(DIST_FILES_THEMES) $(bundle)/scummvm/themes/
|
||||
|
||||
ifdef DIST_FILES_ENGINEDATA
|
||||
$(MKDIR) $(bundle)/scummvm/engine-data
|
||||
$(CP) $(DIST_FILES_ENGINEDATA) $(bundle)/scummvm/engine-data/
|
||||
endif
|
||||
ifdef DIST_FILES_NETWORKING
|
||||
$(CP) $(DIST_FILES_NETWORKING) $(bundle)/scummvm
|
||||
endif
|
||||
ifdef DIST_FILES_VKEYBD
|
||||
$(CP) $(DIST_FILES_VKEYBD) $(bundle)/scummvm
|
||||
endif
|
||||
ifdef DYNAMIC_MODULES
|
||||
$(MKDIR) $(bundle)/scummvm/plugins/
|
||||
$(CP) $(PLUGINS) $(bundle)/scummvm/plugins/
|
||||
endif
|
||||
$(CP) scummvm.kos $(bundle)/scummvm/scummvm
|
||||
$(CP) scummvm.dll $(bundle)/scummvm/scummvm.dll
|
||||
|
||||
scummvm-zip: $(bundle)
|
||||
$(RM) scummvm_kolibrios.zip
|
||||
cd $(bundle) && zip -r ../scummvm_kolibri.zip scummvm
|
||||
15
backends/platform/sdl/kolibrios/kolibrios.spec
Normal file
15
backends/platform/sdl/kolibrios/kolibrios.spec
Normal file
@@ -0,0 +1,15 @@
|
||||
*lib:
|
||||
-lc %{!static:-ldll}
|
||||
|
||||
*libgcc:
|
||||
-lsupc++ -lgcc
|
||||
|
||||
*link:
|
||||
%{mdll:%{shared: %eshared and mdll are not compatible} %{static: %estatic and mdll are not compatible}} -L%:getenv(KOS32_SDK_DIR /lib) %{shared|mdll: -shared --entry _DllStartup} %{shared:-T%:getenv(KOS32_SDK_DIR /sources/newlib/dll.lds)} %{static: -static -T%:getenv(KOS32_SDK_DIR /sources/newlib/app.lds)} %{!mdll:%{!static:%{!shared: -call_shared -T%:getenv(KOS32_SDK_DIR /sources/newlib/app-dynamic.lds)}}} %{!mdll:-s --image-base 0} %{mdll:--enable-auto-image-base} %(shared_libgcc_undefs)
|
||||
|
||||
*startfile:
|
||||
|
||||
|
||||
*endfile:
|
||||
|
||||
|
||||
59
backends/platform/sdl/kolibrios/wrapper-main.c
Normal file
59
backends/platform/sdl/kolibrios/wrapper-main.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void* get_proc_address(void *handle, const char *proc_name);
|
||||
void* load_library(const char *name);
|
||||
|
||||
/* This is just a small wrapper so that the main scummvm is loaded as dll. */
|
||||
int kolibrios_main(int argc, char *argv[]);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
printf("Loading SCUMMVM\n");
|
||||
if (argc < 1 || strnlen(argv[0], 3005) > 3000) {
|
||||
fprintf(stderr, "Couldn't determine exe path");
|
||||
return 1;
|
||||
}
|
||||
const char *r = strrchr(argv[0], '/');
|
||||
static char dllName[4000];
|
||||
int p = 0;
|
||||
if (r) {
|
||||
p = r - argv[0] + 1;
|
||||
memcpy(dllName, argv[0], p);
|
||||
}
|
||||
memcpy(dllName + p, "scummvm.dll", sizeof("scummvm.dll"));
|
||||
|
||||
void *dlHandle = load_library(dllName);
|
||||
if (!dlHandle) {
|
||||
fprintf(stderr, "Couldn't load %s", dllName);
|
||||
return 2;
|
||||
}
|
||||
|
||||
void (*kolibrios_main) (int argc, char *argv[]) = get_proc_address(dlHandle, "kolibrios_main");
|
||||
if (!kolibrios_main) {
|
||||
fprintf(stderr, "Failed to located kolibrios_main");
|
||||
return 3;
|
||||
}
|
||||
|
||||
kolibrios_main(argc, argv);
|
||||
}
|
||||
Reference in New Issue
Block a user