[Scummvm-git-logs] scummvm branch-2-7 -> 5d50286acf9e8e1a14c1e52de07212ef55098091

sev- noreply at scummvm.org
Sun Feb 5 22:02:21 UTC 2023


This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ed4f03545e SDL: Don't use SDLK_UNDO prior to its introduction in SDL-1.2.3
e6153bb8f6 SDL: Stub for Kolibri OS resolution
4440de10ce SDL: Allow joystick init to fail
73d935451c KOLIBRI: Add kolibrios backend
589ca41e27 KOLIBRI: Add a launch wrapper
b45e76f0ba CONFIGURE: Support for kolibri OS
5d50286acf NEWS: Mention KolibriOS support


Commit: ed4f03545e8511453f8226a70a1a27bf0e979b0c
    https://github.com/scummvm/scummvm/commit/ed4f03545e8511453f8226a70a1a27bf0e979b0c
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-02-05T22:59:29+01:00

Commit Message:
SDL: Don't use SDLK_UNDO prior to its introduction in SDL-1.2.3

Changed paths:
    backends/events/sdl/sdl-events.cpp


diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index 5d702698ee8..11a8f6849d6 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -318,7 +318,9 @@ Common::KeyCode SdlEventSource::SDLToOSystemKeycode(const SDL_Keycode key) {
 	case SDLK_SYSREQ: return Common::KEYCODE_SYSREQ;
 	case SDLK_MENU: return Common::KEYCODE_MENU;
 	case SDLK_POWER: return Common::KEYCODE_POWER;
+#if SDL_VERSION_ATLEAST(1, 2, 3)
 	case SDLK_UNDO: return Common::KEYCODE_UNDO;
+#endif
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 	case SDLK_SCROLLLOCK: return Common::KEYCODE_SCROLLOCK;
 	case SDLK_NUMLOCKCLEAR: return Common::KEYCODE_NUMLOCK;


Commit: e6153bb8f65bd4975ab7291e054aeaeda5be31b3
    https://github.com/scummvm/scummvm/commit/e6153bb8f65bd4975ab7291e054aeaeda5be31b3
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-02-05T22:59:56+01:00

Commit Message:
SDL: Stub for Kolibri OS resolution

Changed paths:
    backends/platform/sdl/sdl-window.cpp


diff --git a/backends/platform/sdl/sdl-window.cpp b/backends/platform/sdl/sdl-window.cpp
index 07264cf120a..e9f78cc19e6 100644
--- a/backends/platform/sdl/sdl-window.cpp
+++ b/backends/platform/sdl/sdl-window.cpp
@@ -51,6 +51,9 @@ SdlWindow::SdlWindow() :
 #elif defined(MAEMO)
 	// All supported Maemo devices have a display resolution of 800x480
 	_desktopRes = Common::Rect(800, 480);
+#elif defined(KOLIBRIOS)
+	// TODO: Use kolibriOS call to determine this.
+	_desktopRes = Common::Rect(640, 480);
 #else
 #error Unable to detect screen resolution
 #endif


Commit: 4440de10ce0f7954acf7960cc68442627a3377eb
    https://github.com/scummvm/scummvm/commit/4440de10ce0f7954acf7960cc68442627a3377eb
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-02-05T23:00:42+01:00

Commit Message:
SDL: Allow joystick init to fail

It's not critical so can be skipped

Changed paths:
    backends/events/sdl/sdl-events.cpp


diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index 11a8f6849d6..e69f694ecaa 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -81,12 +81,14 @@ SdlEventSource::SdlEventSource()
 	if (joystick_num >= 0) {
 		// Initialize SDL joystick subsystem
 		if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) {
-			error("Could not initialize SDL: %s", SDL_GetError());
+			warning("Could not initialize SDL joystick: %s", SDL_GetError());
+			return;
 		}
 
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 		if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1) {
-			error("Could not initialize SDL: %s", SDL_GetError());
+			warning("Could not initialize SDL game controller: %s", SDL_GetError());
+			return;
 		}
 		loadGameControllerMappingFile();
 #endif


Commit: 73d935451c6dc2c0d580797ca0d5411b79cf656e
    https://github.com/scummvm/scummvm/commit/73d935451c6dc2c0d580797ca0d5411b79cf656e
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-02-05T23:00:42+01:00

Commit Message:
KOLIBRI: Add kolibrios backend

Changed paths:
  A backends/fs/kolibrios/kolibrios-fs-factory.cpp
  A backends/fs/kolibrios/kolibrios-fs-factory.h
  A backends/fs/kolibrios/kolibrios-fs.cpp
  A backends/fs/kolibrios/kolibrios-fs.h
  A backends/platform/sdl/kolibrios/kolibrios-main.cpp
  A backends/platform/sdl/kolibrios/kolibrios.cpp
  A backends/platform/sdl/kolibrios/kolibrios.h
  A backends/platform/sdl/kolibrios/sdl-stubs.cpp
  A backends/plugins/kolibrios/kolibrios-provider.cpp
  A backends/plugins/kolibrios/kolibrios-provider.h
  A backends/saves/kolibrios/kolibrios-saves.cpp
  A backends/saves/kolibrios/kolibrios-saves.h
    backends/module.mk
    backends/platform/sdl/module.mk
    backends/plugins/sdl/sdl-provider.cpp
    graphics/scaler/hq.cpp


diff --git a/backends/fs/kolibrios/kolibrios-fs-factory.cpp b/backends/fs/kolibrios/kolibrios-fs-factory.cpp
new file mode 100644
index 00000000000..51f06268a75
--- /dev/null
+++ b/backends/fs/kolibrios/kolibrios-fs-factory.cpp
@@ -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/>.
+ *
+ */
+
+// Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h.
+// Also with clock() in sys/time.h in some macOS SDKs.
+#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
+#define FORBIDDEN_SYMBOL_EXCEPTION_exit		//Needed for IRIX's unistd.h
+#define FORBIDDEN_SYMBOL_EXCEPTION_random
+#define FORBIDDEN_SYMBOL_EXCEPTION_srandom
+
+#include "backends/fs/kolibrios/kolibrios-fs-factory.h"
+#include "backends/fs/kolibrios/kolibrios-fs.h"
+
+#include <unistd.h>
+
+AbstractFSNode *KolibriOSFilesystemFactory::makeRootFileNode() const {
+	return new KolibriOSFilesystemNode("/");
+}
+
+AbstractFSNode *KolibriOSFilesystemFactory::makeCurrentDirectoryFileNode() const {
+	char buf[MAXPATHLEN];
+	return getcwd(buf, MAXPATHLEN) ? new KolibriOSFilesystemNode(buf) : NULL;
+}
+
+AbstractFSNode *KolibriOSFilesystemFactory::makeFileNodePath(const Common::String &path) const {
+	assert(!path.empty());
+	return new KolibriOSFilesystemNode(path);
+}
diff --git a/backends/fs/kolibrios/kolibrios-fs-factory.h b/backends/fs/kolibrios/kolibrios-fs-factory.h
new file mode 100644
index 00000000000..d226450505c
--- /dev/null
+++ b/backends/fs/kolibrios/kolibrios-fs-factory.h
@@ -0,0 +1,39 @@
+/* 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 KOLIBRIOS_FILESYSTEM_FACTORY_H
+#define KOLIBRIOS_FILESYSTEM_FACTORY_H
+
+#include "backends/fs/fs-factory.h"
+
+/**
+ * Creates KolibriOSFilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, FilesystemFactory.
+ */
+class KolibriOSFilesystemFactory : public FilesystemFactory {
+protected:
+	AbstractFSNode *makeRootFileNode() const override;
+	AbstractFSNode *makeCurrentDirectoryFileNode() const override;
+	AbstractFSNode *makeFileNodePath(const Common::String &path) const override;
+};
+
+#endif /*KOLIBRIOS_FILESYSTEM_FACTORY_H*/
diff --git a/backends/fs/kolibrios/kolibrios-fs.cpp b/backends/fs/kolibrios/kolibrios-fs.cpp
new file mode 100644
index 00000000000..b1bf8184f55
--- /dev/null
+++ b/backends/fs/kolibrios/kolibrios-fs.cpp
@@ -0,0 +1,302 @@
+/* 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_time_h
+#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
+#define FORBIDDEN_SYMBOL_EXCEPTION_getenv
+
+#include "backends/fs/kolibrios/kolibrios-fs.h"
+#include "backends/fs/posix/posix-iostream.h"
+#include "common/algorithm.h"
+#include "common/debug.h"
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/kos_io.h>
+#include <sys/ksys.h>
+
+#include "common/pack-start.h"	// START STRUCT PACKING
+
+struct kol_readdir_result_header {
+	uint32 version;
+	uint32 number_of_placed_blocks;
+	uint32 total_number_of_blocks;
+	byte reserved[20];
+} PACKED_STRUCT;
+
+struct kol_readdir_result_entry {
+	ksys_bdfe_t bdfe;
+	char fileName[520];
+} PACKED_STRUCT;
+
+struct kol_readdir_result {
+	kol_readdir_result_header header;
+	kol_readdir_result_entry entries[0];
+} PACKED_STRUCT;
+
+#include "common/pack-end.h"	// END STRUCT PACKING
+
+namespace {
+
+// opendir/readdir are buggy. And they encourage using syscalls. Whatever
+kol_readdir_result *kol_readdir(const char *path, uint32 max_blocks) {
+	ksys70_status_t ret_result;
+	int result_buffer_size = sizeof (kol_readdir_result_header)
+		+ max_blocks * sizeof (kol_readdir_result_entry);
+	kol_readdir_result *result_buffer = (kol_readdir_result *) malloc (result_buffer_size);
+	if (!result_buffer)
+		return nullptr;
+	memset(result_buffer, 0, result_buffer_size);
+	ksys70_t request;
+	request.p00 = 1; // Read directory
+	request.p04dw = 0;
+	request.p08dw = 3; // UTF-8
+	request.p12 = max_blocks;
+	request.buf16 = result_buffer;
+	request.p20 = 0; // Don't use inline path
+	request.p21 = path;
+
+	ret_result = _ksys70(&request);
+
+	// 0 is returned for normal dirs, 6 for virtual directories
+	if (ret_result.status != 0 && ret_result.status != 6) {
+		free (result_buffer);
+		return nullptr;
+	}
+
+	return result_buffer;
+}
+
+kol_readdir_result *kol_readdir(const char *path) {
+	kol_readdir_result *res = kol_readdir(path, 2);
+
+	if (!res)
+		return nullptr;
+
+	uint32 tot_blocks = res->header.total_number_of_blocks;
+	free(res);
+
+	return kol_readdir(path, tot_blocks);
+}
+
+bool getFileAttrs(Common::String path, uint32& attrs) {
+	fileinfo_t info;
+
+	memset(&info, 0, sizeof(info));
+	info.attr = 0x10;
+	if(get_fileinfo(path.c_str(), &info)) {
+		attrs = 0;
+		return false;
+	}
+
+	attrs = info.attr;
+	return true;
+}
+
+} // namespace
+
+bool KolibriOSFilesystemNode::exists() const {
+	uint32 attrs;
+	return getFileAttrs(_path, attrs);
+}
+
+bool KolibriOSFilesystemNode::isReadable() const {
+	uint32 attrs;
+	return getFileAttrs(_path, attrs);
+}
+
+bool KolibriOSFilesystemNode::isWritable() const {
+	uint32 attrs;
+	return getFileAttrs(_path, attrs) && !(attrs & 0x01);
+}
+
+void KolibriOSFilesystemNode::setFlags() {
+	_isValid = getFileAttrs(_path, _attributes);
+}
+
+KolibriOSFilesystemNode::KolibriOSFilesystemNode(const Common::String &p) {
+	assert(p.size() > 0);
+
+	_path = p;
+
+	// Normalize the path (that is, remove unneeded slashes etc.)
+	_path = Common::normalizePath(_path, '/');
+	_displayName = Common::lastPathComponent(_path, '/');
+
+	setFlags();
+}
+
+AbstractFSNode *KolibriOSFilesystemNode::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 KolibriOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const {
+	kol_readdir_result *res = kol_readdir(_path.c_str());
+
+	if (!res)
+		return false;
+
+	for (int i = 0; i < (int) res->header.number_of_placed_blocks; i++)
+	{
+		// Skip 'invisible' files if necessary
+		if (res->entries[i].fileName[0] == '.' && !hidden) {
+			continue;
+		}
+		// Skip '.' and '..' to avoid cycles
+		if ((res->entries[i].fileName[0] == '.' && res->entries[i].fileName[1] == 0)
+		    || (res->entries[i].fileName[0] == '.' && res->entries[i].fileName[1] == '.' && res->entries[i].fileName[2] == 0)) {
+			continue;
+		}
+
+		// Start with a clone of this node, with the correct path set
+		KolibriOSFilesystemNode entry(*this);
+		entry._displayName = res->entries[i].fileName;
+		if (_path.lastChar() != '/')
+			entry._path += '/';
+		entry._path += entry._displayName;
+
+		entry._isValid = true;
+		entry._attributes = res->entries[i].bdfe.attributes;
+
+		// Honor the chosen mode
+		if ((mode == Common::FSNode::kListFilesOnly && entry.isDirectory()) ||
+		    (mode == Common::FSNode::kListDirectoriesOnly && !entry.isDirectory()))
+			continue;
+
+		myList.push_back(new KolibriOSFilesystemNode(entry));
+
+	}
+
+	free(res);
+
+	return true;
+}
+
+AbstractFSNode *KolibriOSFilesystemNode::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;
+	}
+
+	return makeNode(Common::String(start, end));
+}
+
+Common::SeekableReadStream *KolibriOSFilesystemNode::createReadStream() {
+	return PosixIoStream::makeFromPath(getPath(), false);
+}
+
+Common::SeekableWriteStream *KolibriOSFilesystemNode::createWriteStream() {
+	return PosixIoStream::makeFromPath(getPath(), true);
+}
+
+bool KolibriOSFilesystemNode::createDirectory() {
+	if (mkdir(_path.c_str(), 0755) == 0)
+		setFlags();
+
+	return isDirectory();
+}
+
+namespace KolibriOS {
+
+bool assureDirectoryExists(const Common::String &dir, const char *prefix) {
+
+	// Check whether the prefix exists if one is supplied.
+	if (prefix) {
+		uint32 attrs;
+		if (!getFileAttrs(prefix, attrs) || !KolibriOSFilesystemNode::isDirectory(attrs)) {
+			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[0] == '/' && cur[1] >= 1 && cur[1] <= 3 && cur[2] == '/')
+		cur += 2;
+	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';
+		}
+
+		if (mkdir(path.c_str(), 0755) != 0) {
+			uint32 attrs;
+			if (!getFileAttrs(path, attrs) || !KolibriOSFilesystemNode::isDirectory(attrs))
+				return false;
+		}
+
+		*cur = '/';
+	} while (cur++ != end);
+
+	return true;
+}
+
+} // End of namespace KolibriOS
diff --git a/backends/fs/kolibrios/kolibrios-fs.h b/backends/fs/kolibrios/kolibrios-fs.h
new file mode 100644
index 00000000000..ffa6fd75f45
--- /dev/null
+++ b/backends/fs/kolibrios/kolibrios-fs.h
@@ -0,0 +1,93 @@
+/* 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 KOLIBRIOS_FS_H
+#define KOLIBRIOS_FS_H
+
+#include "backends/fs/abstract-fs.h"
+
+/**
+ * Implementation of the ScummVM file system API based on KolibriOS.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFSNode.
+ */
+class KolibriOSFilesystemNode : public AbstractFSNode {
+public:
+	/**
+	 * Creates a KolibriOSFilesystemNode for a given path.
+	 *
+	 * @param path the path the new node should point to.
+	 */
+	KolibriOSFilesystemNode(const Common::String &path);
+
+	bool exists() const override;
+	Common::U32String getDisplayName() const override { return _displayName; }
+	Common::String getName() const override { return _displayName; }
+	Common::String getPath() const override { return _path; }
+	static bool isDirectory(uint32 attrs) { return attrs & 0x18; }
+	bool isDirectory() const override { return isDirectory(_attributes); }
+	bool isReadable() const override;
+	bool isWritable() const override;
+
+	AbstractFSNode *getChild(const Common::String &n) const override;
+	bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const override;
+	AbstractFSNode *getParent() const override;
+
+	Common::SeekableReadStream *createReadStream() override;
+	Common::SeekableWriteStream *createWriteStream() override;
+	bool createDirectory() override;
+
+protected:
+	Common::String _displayName;
+	Common::String _path;
+	uint32 _attributes;
+	bool _isValid;
+
+	virtual AbstractFSNode *makeNode(const Common::String &path) const {
+		return new KolibriOSFilesystemNode(path);
+	}
+
+	/**
+	 * Plain constructor, for internal use only (hence protected).
+	 */
+	KolibriOSFilesystemNode() : _attributes(0), _isValid(false) {}
+
+	/**
+	 * Tests and sets the _isValid and _isDirectory flags, using the stat() function.
+	 */
+	virtual void setFlags();
+};
+
+namespace KolibriOS {
+
+/**
+ * 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 directory exists (or was created), false otherwise.
+ */
+bool assureDirectoryExists(const Common::String &dir, const char *prefix = nullptr);
+
+} // End of namespace KolibriOS
+
+#endif
diff --git a/backends/module.mk b/backends/module.mk
index 2db8d9a113e..aabb93103c5 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -146,9 +146,18 @@ MODULE_OBJS += \
 	graphics/surfacesdl/surfacesdl-graphics.o \
 	mixer/sdl/sdl-mixer.o \
 	mutex/sdl/sdl-mutex.o \
-	plugins/sdl/sdl-provider.o \
 	timer/sdl/sdl-timer.o
 
+ifdef KOLIBRIOS
+MODULE_OBJS += plugins/kolibrios/kolibrios-provider.o
+endif
+
+ifndef RISCOS
+ifndef KOLIBRIOS
+MODULE_OBJS += plugins/sdl/sdl-provider.o
+endif
+endif
+
 # SDL 2 removed audio CD support
 ifndef USE_SDL2
 MODULE_OBJS += \
@@ -174,6 +183,19 @@ MODULE_OBJS += \
 endif
 endif
 
+ifdef KOLIBRIOS
+MODULE_OBJS += \
+	fs/kolibrios/kolibrios-fs.o \
+	fs/kolibrios/kolibrios-fs-factory.o \
+	fs/posix/posix-iostream.o \
+	fs/posix-drives/posix-drives-fs.o \
+	fs/posix-drives/posix-drives-fs-factory.o \
+	fs/chroot/chroot-fs-factory.o \
+	fs/chroot/chroot-fs.o \
+	plugins/posix/posix-provider.o \
+	saves/kolibrios/kolibrios-saves.o
+endif
+
 ifdef POSIX
 MODULE_OBJS += \
 	fs/posix/posix-fs.o \
diff --git a/backends/platform/sdl/kolibrios/kolibrios-main.cpp b/backends/platform/sdl/kolibrios/kolibrios-main.cpp
new file mode 100644
index 00000000000..5f363b7d415
--- /dev/null
+++ b/backends/platform/sdl/kolibrios/kolibrios-main.cpp
@@ -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;
+}
diff --git a/backends/platform/sdl/kolibrios/kolibrios.cpp b/backends/platform/sdl/kolibrios/kolibrios.cpp
new file mode 100644
index 00000000000..adafa025ef3
--- /dev/null
+++ b/backends/platform/sdl/kolibrios/kolibrios.cpp
@@ -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::String defaultThemePath = _exePath.join("themes").toString();
+	Common::String defaultEngineData = _exePath.join("engine-data").toString();
+	ConfMan.registerDefault("themepath", defaultThemePath);
+	ConfMan.registerDefault("extrapath", defaultEngineData);
+
+	if (!ConfMan.hasKey("themepath")) {
+		ConfMan.set("themepath", defaultThemePath);
+	}
+	if (!ConfMan.hasKey("extrapath")) {
+		ConfMan.set("extrapath", defaultEngineData);
+	}
+
+	// Create the savefile manager
+	if (_savefileManager == 0)
+		_savefileManager = new KolibriOSSaveFileManager(_writablePath);
+
+	// Invoke parent implementation of this method
+	OSystem_SDL::initBackend();
+}
+
+Common::String OSystem_KolibriOS::getDefaultConfigFileName() {
+	return _writablePath.join("scummvm.ini").toString();
+}
+
+Common::String OSystem_KolibriOS::getDefaultIconsPath() {
+	return _exePath.join("icons").toString();
+}
+
+Common::String OSystem_KolibriOS::getScreenshotsPath() {
+	// If the user has configured a screenshots path, use it
+	const Common::String path = OSystem_SDL::getScreenshotsPath();
+	if (!path.empty()) {
+		return path;
+	}
+
+	static const char *SCREENSHOTS_DIR_NAME = "ScummVM Screenshots";
+	if (!KolibriOS::assureDirectoryExists(SCREENSHOTS_DIR_NAME, _writablePath.toString().c_str())) {
+		return "";
+	}
+
+	return _writablePath.join(SCREENSHOTS_DIR_NAME).toString();
+}
+
+Common::String OSystem_KolibriOS::getDefaultLogFileName() {
+	return _writablePath.join("scummvm.log").toString();
+}
+
+AudioCDManager *OSystem_KolibriOS::createAudioCDManager() {
+	return new DefaultAudioCDManager();
+}
diff --git a/backends/platform/sdl/kolibrios/kolibrios.h b/backends/platform/sdl/kolibrios/kolibrios.h
new file mode 100644
index 00000000000..4a3d4056444
--- /dev/null
+++ b/backends/platform/sdl/kolibrios/kolibrios.h
@@ -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::String getDefaultIconsPath() override;
+	Common::String getScreenshotsPath() override;
+	void addSysArchivesToSearchSet(Common::SearchSet &s, int priority) override;
+	const Common::Path& getExePath() const { return _exePath; }
+
+protected:
+	Common::String getDefaultConfigFileName() override;
+	Common::String getDefaultLogFileName() override;
+
+	AudioCDManager *createAudioCDManager() override;
+
+private:
+	Common::Path _exePath;
+	Common::Path _writablePath;
+	Common::String _exeName;
+};
+
+#endif
diff --git a/backends/platform/sdl/kolibrios/sdl-stubs.cpp b/backends/platform/sdl/kolibrios/sdl-stubs.cpp
new file mode 100644
index 00000000000..0c8f23f1b08
--- /dev/null
+++ b/backends/platform/sdl/kolibrios/sdl-stubs.cpp
@@ -0,0 +1,58 @@
+/* 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 "backends/events/sdl/sdl-events.h"
+
+SDL_Joystick *SDL_JoystickOpen (int index) {
+	return nullptr;
+}
+
+const char *SDL_JoystickName (int index) {
+	return nullptr;
+}
+
+int SDL_NumJoysticks (void) {
+	return 0;
+}
+
+void SDL_JoystickClose (SDL_Joystick *joystick) {
+}
+
+// SDL CDAudio is not used on kolibri as it's redirected away from
+// in platform-specific code but since it's still linked-in it needs those stubs
+CDstatus SDL_CDStatus (SDL_CD *cdrom) {
+	return CD_ERROR;
+}
+
+int SDL_CDPlayTracks (SDL_CD *cdrom, int start_track, int start_frame, int ntracks, int nframes) {
+	return -1;
+}
+
+int SDL_CDStop (SDL_CD *cdrom) {
+	return -1;
+}
+
+SDL_CD *SDL_CDOpen (int drive) {
+	return nullptr;
+}
+
+void SDL_CDClose (SDL_CD *cdrom) {
+}
diff --git a/backends/platform/sdl/module.mk b/backends/platform/sdl/module.mk
index ca8628f6f2a..c5095560193 100644
--- a/backends/platform/sdl/module.mk
+++ b/backends/platform/sdl/module.mk
@@ -4,6 +4,13 @@ MODULE_OBJS := \
 	sdl.o \
 	sdl-window.o
 
+ifdef KOLIBRIOS
+MODULE_OBJS += \
+	kolibrios/kolibrios-main.o \
+	kolibrios/kolibrios.o \
+	kolibrios/sdl-stubs.o
+endif
+
 ifdef POSIX
 MODULE_OBJS += \
 	posix/posix-main.o \
diff --git a/backends/plugins/kolibrios/kolibrios-provider.cpp b/backends/plugins/kolibrios/kolibrios-provider.cpp
new file mode 100644
index 00000000000..0327273a948
--- /dev/null
+++ b/backends/plugins/kolibrios/kolibrios-provider.cpp
@@ -0,0 +1,88 @@
+/* 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"
+
+#if defined(DYNAMIC_MODULES)
+
+#include "backends/platform/sdl/kolibrios/kolibrios.h"
+#include "backends/plugins/kolibrios/kolibrios-provider.h"
+#include "backends/plugins/dynamic-plugin.h"
+
+#include "common/debug.h"
+
+#include <kos32sys.h>
+#include <errno.h>
+
+class KolibriOSPlugin final : public DynamicPlugin {
+protected:
+	void *_dlHandle;
+
+	VoidFunc findSymbol(const char *symbol) override {
+		void *func = get_proc_address(_dlHandle, symbol);
+		if (!func)
+			debug("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str());
+
+		return (void (*)())func;
+	}
+
+public:
+	KolibriOSPlugin(const Common::String &filename)
+		: DynamicPlugin(filename), _dlHandle(0) {}
+
+	bool loadPlugin() override {
+		if (_dlHandle)
+			return true;
+		_dlHandle = load_library(_filename.c_str());
+
+		if (!_dlHandle) {
+			debug("Failed loading plugin '%s' (error code %d)", _filename.c_str(), errno);
+			return false;
+		} else {
+			debug(1, "Success loading plugin '%s', handle %p", _filename.c_str(), _dlHandle);
+		}
+
+		return DynamicPlugin::loadPlugin();
+	}
+
+	void unloadPlugin() override {
+		DynamicPlugin::unloadPlugin();
+		/* Not supported */
+	}
+};
+
+
+Plugin* KolibriOSPluginProvider::createPlugin(const Common::FSNode &node) const {
+	return new KolibriOSPlugin(node.getPath());
+}
+
+void KolibriOSPluginProvider::addCustomDirectories(Common::FSList &dirs) const {
+	OSystem_KolibriOS *sys = dynamic_cast<OSystem_KolibriOS *>(g_system);
+	// load_library doesn't handle relative paths correctly so remove all other paths which are relative
+	dirs.clear();
+	if (sys) {
+		debug(1, "Adding path %s", sys->getExePath().join("plugins").toString().c_str());
+		dirs.push_back(Common::FSNode(sys->getExePath().join("plugins")));
+	}
+}
+
+#endif // defined(DYNAMIC_MODULES)
diff --git a/backends/plugins/kolibrios/kolibrios-provider.h b/backends/plugins/kolibrios/kolibrios-provider.h
new file mode 100644
index 00000000000..7af3e7f4390
--- /dev/null
+++ b/backends/plugins/kolibrios/kolibrios-provider.h
@@ -0,0 +1,37 @@
+/* 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/>.
+ *
+ */
+
+#if defined(DYNAMIC_MODULES)
+
+#ifndef BACKENDS_PLUGINS_KOLIBRIOS_PROVIDER_H
+#define BACKENDS_PLUGINS_KOLIBRIOS_PROVIDER_H
+
+#include "base/plugins.h"
+
+class KolibriOSPluginProvider : public FilePluginProvider {
+public:
+	Plugin *createPlugin(const Common::FSNode &node) const override;
+	void addCustomDirectories(Common::FSList &dirs) const override;
+};
+
+#endif // BACKENDS_PLUGINS_KOLIBRIOS_PROVIDER_H
+
+#endif // defined(DYNAMIC_MODULES)
diff --git a/backends/plugins/sdl/sdl-provider.cpp b/backends/plugins/sdl/sdl-provider.cpp
index 7793a8b8f5b..75c51dfe0de 100644
--- a/backends/plugins/sdl/sdl-provider.cpp
+++ b/backends/plugins/sdl/sdl-provider.cpp
@@ -22,7 +22,7 @@
 #include "common/scummsys.h"
 
 // RiscOS uses its own plugin provider and SDL one doesn't work
-#if defined(DYNAMIC_MODULES) && defined(SDL_BACKEND) && !defined(RISCOS)
+#if defined(DYNAMIC_MODULES) && defined(SDL_BACKEND)
 
 #include "backends/plugins/sdl/sdl-provider.h"
 #include "backends/plugins/dynamic-plugin.h"
diff --git a/backends/saves/kolibrios/kolibrios-saves.cpp b/backends/saves/kolibrios/kolibrios-saves.cpp
new file mode 100644
index 00000000000..34fe433293f
--- /dev/null
+++ b/backends/saves/kolibrios/kolibrios-saves.cpp
@@ -0,0 +1,74 @@
+/* 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_mkdir
+#define FORBIDDEN_SYMBOL_EXCEPTION_getenv
+#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+
+#include "common/scummsys.h"
+
+#if !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
+
+#include "backends/saves/kolibrios/kolibrios-saves.h"
+#include "backends/fs/kolibrios/kolibrios-fs.h"
+
+#include "common/config-manager.h"
+#include "common/savefile.h"
+#include "common/textconsole.h"
+
+#include <sys/stat.h>
+
+KolibriOSSaveFileManager::KolibriOSSaveFileManager(const Common::Path& writeablePath) {
+	// Register default savepath.
+	Common::String savePath;
+
+	if (KolibriOS::assureDirectoryExists("saves", writeablePath.toString().c_str())) {
+		savePath = writeablePath.join("saves").toString().c_str();
+	}
+
+	if (!savePath.empty() && savePath.size() < MAXPATHLEN) {
+		ConfMan.registerDefault("savepath", savePath);
+	}
+
+	// The user can override the savepath with the SCUMMVM_SAVEPATH
+	// environment variable. This is weaker than a --savepath on the
+	// command line, but overrides the default savepath.
+	//
+	// To ensure that the command line option (if given) has precedence,
+	// we only set the value in the transient domain if it is not
+	// yet present there.
+	if (!ConfMan.hasKey("savepath", Common::ConfigManager::kTransientDomain)) {
+		const char *dir = getenv("SCUMMVM_SAVEPATH");
+		if (dir && *dir && strlen(dir) < MAXPATHLEN) {
+			Common::FSNode saveDir(dir);
+			if (!saveDir.exists()) {
+				warning("Ignoring non-existent SCUMMVM_SAVEPATH '%s'", dir);
+			} else if (!saveDir.isWritable()) {
+				warning("Ignoring non-writable SCUMMVM_SAVEPATH '%s'", dir);
+			} else {
+				ConfMan.set("savepath", dir, Common::ConfigManager::kTransientDomain);
+			}
+		}
+	}
+}
+
+#endif
diff --git a/backends/saves/kolibrios/kolibrios-saves.h b/backends/saves/kolibrios/kolibrios-saves.h
new file mode 100644
index 00000000000..1e665be1639
--- /dev/null
+++ b/backends/saves/kolibrios/kolibrios-saves.h
@@ -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 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/>.
+ *
+ */
+
+#if !defined(BACKEND_KOLIBRIOS_SAVES_H) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
+#define BACKEND_KOLIBRIOS_SAVES_H
+
+#include "backends/saves/default/default-saves.h"
+
+#if !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
+/**
+ * Customization of the DefaultSaveFileManager for KolibriOS.
+ * The only two differences are that the default constructor sets
+ * up the savepath based on HOME, and that checkPath tries to
+ * create the savedir, if missing, via the mkdir() syscall.
+ */
+class KolibriOSSaveFileManager : public DefaultSaveFileManager {
+public:
+	KolibriOSSaveFileManager(const Common::Path& writeablePath);
+};
+#endif
+
+#endif
diff --git a/graphics/scaler/hq.cpp b/graphics/scaler/hq.cpp
index 9510be8598f..479accd9635 100644
--- a/graphics/scaler/hq.cpp
+++ b/graphics/scaler/hq.cpp
@@ -42,7 +42,7 @@ struct hqx_parameters {
 
 extern "C" {
 
-#if !defined(_WIN32) && !defined(MACOSX) && !defined(__OS2__)
+#if !defined(_WIN32) && !defined(MACOSX) && !defined(__OS2__) && !defined(KOLIBRIOS)
 #define hq2x_16 _hq2x_16
 #define hq3x_16 _hq3x_16
 #endif


Commit: 589ca41e27f178117e2311e811229e2ca430fecc
    https://github.com/scummvm/scummvm/commit/589ca41e27f178117e2311e811229e2ca430fecc
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-02-05T23:00:55+01:00

Commit Message:
KOLIBRI: Add a launch wrapper

Exporting symbols from main binary is cumbersome on KolibriOS but importing
from another dll is fine. So we make scummvm core into a dll and add a thin
launcher for it.

Changed paths:
  A backends/platform/sdl/kolibrios/wrapper-main.c


diff --git a/backends/platform/sdl/kolibrios/wrapper-main.c b/backends/platform/sdl/kolibrios/wrapper-main.c
new file mode 100644
index 00000000000..ac5d05e96c3
--- /dev/null
+++ b/backends/platform/sdl/kolibrios/wrapper-main.c
@@ -0,0 +1,56 @@
+/* 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 <kos32sys.h>
+#include <stdio.h>
+
+/* 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);
+}


Commit: b45e76f0ba5286dd64b952dc6be83ffabe05d95c
    https://github.com/scummvm/scummvm/commit/b45e76f0ba5286dd64b952dc6be83ffabe05d95c
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-02-05T23:01:09+01:00

Commit Message:
CONFIGURE: Support for kolibri OS

Changed paths:
  A backends/platform/sdl/kolibrios/build-kolibri.sh
  A backends/platform/sdl/kolibrios/kolibrios.mk
  A backends/platform/sdl/kolibrios/kolibrios.spec
    backends/module.mk
    configure


diff --git a/backends/module.mk b/backends/module.mk
index aabb93103c5..996455f2052 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -148,10 +148,6 @@ MODULE_OBJS += \
 	mutex/sdl/sdl-mutex.o \
 	timer/sdl/sdl-timer.o
 
-ifdef KOLIBRIOS
-MODULE_OBJS += plugins/kolibrios/kolibrios-provider.o
-endif
-
 ifndef RISCOS
 ifndef KOLIBRIOS
 MODULE_OBJS += plugins/sdl/sdl-provider.o
@@ -188,11 +184,7 @@ MODULE_OBJS += \
 	fs/kolibrios/kolibrios-fs.o \
 	fs/kolibrios/kolibrios-fs-factory.o \
 	fs/posix/posix-iostream.o \
-	fs/posix-drives/posix-drives-fs.o \
-	fs/posix-drives/posix-drives-fs-factory.o \
-	fs/chroot/chroot-fs-factory.o \
-	fs/chroot/chroot-fs.o \
-	plugins/posix/posix-provider.o \
+	plugins/kolibrios/kolibrios-provider.o \
 	saves/kolibrios/kolibrios-saves.o
 endif
 
diff --git a/backends/platform/sdl/kolibrios/build-kolibri.sh b/backends/platform/sdl/kolibrios/build-kolibri.sh
new file mode 100755
index 00000000000..1a2228d5fe4
--- /dev/null
+++ b/backends/platform/sdl/kolibrios/build-kolibri.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+export KOS32_SDK_DIR=$HOME/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 --enable-engine=testbed
+
+make -j5 all zip-root scummvm-zip
diff --git a/backends/platform/sdl/kolibrios/kolibrios.mk b/backends/platform/sdl/kolibrios/kolibrios.mk
new file mode 100644
index 00000000000..6de4096498a
--- /dev/null
+++ b/backends/platform/sdl/kolibrios/kolibrios.mk
@@ -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)/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
diff --git a/backends/platform/sdl/kolibrios/kolibrios.spec b/backends/platform/sdl/kolibrios/kolibrios.spec
new file mode 100644
index 00000000000..1f2db4241dc
--- /dev/null
+++ b/backends/platform/sdl/kolibrios/kolibrios.spec
@@ -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:
+
+
diff --git a/configure b/configure
index f27bd05acea..65ffbf191f6 100755
--- a/configure
+++ b/configure
@@ -557,6 +557,9 @@ get_system_exe_extension() {
 	gph-linux)
 		_exeext=".gph"
 		;;
+	kolibrios | kos32)
+		_exeext=".dll"
+		;;
 	mingw* | *os2-emx)
 		_exeext=".exe"
 		;;
@@ -835,6 +838,7 @@ Special configuration feature:
                                            iphone for Apple iPhone (iOS <= 6)
                                            ios7 for Apple iPhone / iPad (iOS >= 7)
                                            ios7-arm64 for Apple iPhone / iPad (iOS >= 7, 64-bit)
+                                           kos32 for Kolibri OS
                                            maemo for Nokia Maemo
                                            miyoo for 1st generation Miyoo
                                            miyoomini for Miyoo Mini
@@ -1627,6 +1631,11 @@ ios7-arm64)
 	_host_cpu=aarch64
 	_host_alias=arm64-apple-darwin11
 	;;
+kos32)
+	_host_os=kolibrios
+	_host_cpu=i686
+	_host_alias=kos32
+	;;
 maemo)
 	_host_os=maemo
 	_host_cpu=arm
@@ -1847,6 +1856,24 @@ emscripten)
 		exit 1
 	fi
 	;;
+kolibrios)
+	if test -z "$KOS32_SDK_DIR" || test -z "$KOS32_AUTOBUILD"; then
+		echo "Please set KOS32_SDK_DIR and KOS32_AUTOBUILD in your environment. export KOS32_SDK_DIR=<path to KOS32 SDK> and export KOS32_AUTOBUILD=<path to KOS32 build>"
+		exit 1
+	fi
+	_as="${KOS32_AUTOBUILD}/bin/kos32-as"
+	_ar="${KOS32_AUTOBUILD}/bin/kos32-ar cr"
+	_ranlib="${KOS32_AUTOBUILD}/bin/kos32-ar -s"
+	_strip="${KOS32_AUTOBUILD}/bin/kos32-strip"
+	if test -z "$CXX"; then
+		CXX="${KOS32_AUTOBUILD}/bin/kos32-g++"
+	fi
+	append_var DEFINES "-U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -DKOLIBRIOS=1 -D_POSIX_C_SOURCE=1 -D_XOPEN_SOURCE=1"
+	append_var CXXFLAGS "-I${KOS32_SDK_DIR}/sources/newlib/libc/include -I${KOS32_SDK_DIR}/sources/libstdc++-v3/include -fno-ident -fomit-frame-pointer"
+	# Final executable will be a DLL but for tests we need to stick to a standard binary because DLLs having a main function trigger a build failure
+	# We will add the -shared option at the end
+	append_var LDFLAGS "-specs=$_srcdir/backends/platform/sdl/kolibrios/kolibrios.spec"
+	;;
 n64)
 	if test -z "$N64SDK"; then
 		echo "Please set N64SDK in your environment. export N64SDK=<path to n64 sdk>"
@@ -2191,7 +2218,7 @@ if test "$have_gcc" = yes ; then
 	case $_host_os in
 	# newlib-based system include files suppress non-C89 function
 	# declarations under __STRICT_ANSI__, undefine it
-	3ds | android | gamecube | psp | switch | wii)
+	3ds | android | gamecube | kolibrios | psp | switch | wii)
 		std_variant=gnu++
 		pedantic=no
 		;;
@@ -3486,6 +3513,35 @@ if test -n "$_host"; then
 			_seq_midi=no
 			_timidity=no
 			;;
+		kos32)
+			# neither pkg-config nor *-config work, so we setup everything manually
+			_pkgconfig=/bin/false
+			_pkg_config=no
+
+			ZLIB_CFLAGS="-I${KOS32_SDK_DIR}/sources/zlib"
+			if test "$_png" != no; then
+				PNG_CFLAGS="-I${KOS32_SDK_DIR}/sources/libpng"
+				PNG_LIBS="-lpng16 -lz"
+				_png=yes
+			fi
+			JPEG_CFLAGS="-I${KOS32_SDK_DIR}/sources/libjpeg"
+
+			FREETYPE2_STATIC_LIBS="-lfreetype"
+			FREETYPE2_CFLAGS="-I${KOS32_SDK_DIR}/sources/freetype/include"
+			_freetype_found="true"
+
+			SDL_CFLAGS="-I${KOS32_SDK_DIR}/sources/SDL-1.2.2_newlib/include"
+			SDL_LIBS="-lSDLn -lsound"
+			_sdl=yes
+			_sdlversion=1.2.2
+			_backend="kolibrios"
+
+			_timidity=no
+			add_line_to_config_mk 'KOLIBRIOS = 1'
+			add_line_to_config_mk 'KOS32_AUTOBUILD = '"${KOS32_AUTOBUILD}"
+			add_line_to_config_mk 'KOS32_SDK_DIR = '"${KOS32_SDK_DIR}"
+			_port_mk="backends/platform/sdl/kolibrios/kolibrios.mk"
+			;;
 		m68k-atari-mint)
 			_seq_midi=no
 			_timidity=no
@@ -3828,6 +3884,10 @@ case $_backend in
 			append_var CXXFLAGS "-isysroot $SDKROOT -I$SDKROOT/usr/include/c++/4.2.1 -F$SDKROOT/System/Library/Frameworks"
 		fi
 		;;
+	kolibrios)
+		_sdl=yes
+		append_var MODULES "backends/platform/sdl"
+		;;
 	maemo)
 		append_var DEFINES "-DMAEMO"
 		append_var LIBS "-lX11"
@@ -3910,7 +3970,6 @@ case $_backend in
 		;;
 esac
 
-
 append_var MODULES "backends/platform/$_backend"
 
 #
@@ -4044,7 +4103,7 @@ fi
 # Enable 16bit support only for backends which support it
 #
 case $_backend in
-	3ds | android | dingux | dc | ds | gph | iphone | ios7 | maemo | null | opendingux | miyoomini | miyoo | openpandora | psp | psp2 | samsungtv | sdl | switch | wii)
+	3ds | android | dingux | dc | ds | gph | iphone | ios7 | kolibrios | maemo | null | opendingux | miyoomini | miyoo | openpandora | psp | psp2 | samsungtv | sdl | switch | wii)
 		if test "$_16bit" = auto ; then
 			_16bit=yes
 		else
@@ -4117,7 +4176,7 @@ esac
 #
 echo_n "Checking if host is POSIX compliant... "
 case $_host_os in
-	amigaos* | dreamcast | ds | gamecube | mingw* | morphos | n64 | ps3 | psp2 | psp | riscos | wii)
+	amigaos* | dreamcast | ds | gamecube | kolibrios | mingw* | morphos | n64 | ps3 | psp2 | psp | riscos | wii)
 		_posix=no
 		;;
 	3ds | android | beos* | bsd* | cygwin* | darwin* | dragonfly* | freebsd* | gnu* | gph-linux | haiku* | hpux* | iphone | ios7 | irix*| k*bsd*-gnu* | linux* | maemo | mint* | netbsd* | openbsd* | serenity* | solaris* | sunos* | switch | uclinux*)
@@ -4401,6 +4460,16 @@ PLUGIN_EXTRA_DEPS =
 PLUGIN_LDFLAGS  += -shared -static-libgcc
 PRE_OBJS_FLAGS  := -Wl,-export-dynamic -Wl,-whole-archive
 POST_OBJS_FLAGS := -Wl,-no-whole-archive
+'
+		;;
+	kolibrios)
+		_plugin_suffix=".svm.dll"
+		append_var DEFINES "-DUNCACHED_PLUGINS"
+_mak_plugins='
+PLUGIN_EXTRA_DEPS   = $(EXECUTABLE)
+PLUGIN_LDFLAGS      += -specs=$(srcdir)/backends/platform/sdl/kolibrios/kolibrios.spec -mdll -Wl,-q,--retain-symbols-file,$(srcdir)/backends/plugins/elf/plugin.syms -Wl,--enable-auto-import ./libscummvm.a
+PRE_OBJS_FLAGS      := -Wl,--whole-archive
+POST_OBJS_FLAGS     := -Wl,--export-all-symbols -Wl,--no-whole-archive -Wl,--out-implib,./libscummvm.a
 '
 		;;
 
@@ -5918,7 +5987,7 @@ if test "$_have_x86" = yes ; then
 				darwin*)
 					append_var NASMFLAGS "-f macho"
 				;;
-				mingw*)
+				mingw* | kolibrios)
 					append_var NASMFLAGS "-f win32"
 				;;
 				os2-emx*)
@@ -6454,6 +6523,12 @@ case $_host_os in
 			LIBS=`echo ${LIBS} | sed 's/-lz//g'`
 		fi
 		;;
+	kolibrios)
+		# In reality we will build a DLL
+		append_var LDFLAGS "-shared"
+		# kos32 toolchain only has libpng16
+		LIBS=`echo ${LIBS} | sed 's/-lpng //g'`
+		;;
 	mingw*)
 		if test "$_windows_unicode" = yes; then
 			append_var DEFINES "-DUNICODE -D_UNICODE"


Commit: 5d50286acf9e8e1a14c1e52de07212ef55098091
    https://github.com/scummvm/scummvm/commit/5d50286acf9e8e1a14c1e52de07212ef55098091
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-05T23:01:40+01:00

Commit Message:
NEWS: Mention KolibriOS support

Changed paths:
    NEWS.md


diff --git a/NEWS.md b/NEWS.md
index 3c31f23bac9..2a86a21e98a 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -19,6 +19,7 @@ For a more comprehensive changelog of the latest experimental code, see:
    - 1st generation Miyoo (New BittBoy, Pocket Go and PowKiddy Q90-V90-Q20)
      under TriForceX MiyooCFW.
    - Miyoo mini
+   - KolibriOS
 
  General:
    - Reduced amount of false positives in Mass Add.




More information about the Scummvm-git-logs mailing list