scummvm: platform savepath for Haiku

This commit is contained in:
Jérôme Duval
2025-01-25 13:24:55 +01:00
parent aebc995174
commit 8126f6f5f5
2 changed files with 101 additions and 6 deletions

View File

@@ -0,0 +1,99 @@
From 631a3d098e0749eb1389f403dd409ae16ff17212 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 25 Jan 2025 10:12:50 +0100
Subject: Haiku patch
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index f2330f7..979dca9 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -379,13 +379,13 @@ bool OSystem_POSIX::displayLogFile() {
return false;
} else if (pid == 0) {
- // Try xdg-open first
- execlp("xdg-open", "xdg-open", _logFilePath.toString(Common::Path::kNativeSeparator).c_str(), (char *)0);
+ // Try open first
+ execlp("open", "open", _logFilePath.toString(Common::Path::kNativeSeparator).c_str(), (char *)0);
// If we're here, that clearly failed.
// TODO: We may also want to try detecting the case where
- // xdg-open is successfully executed but returns an error code.
+ // open is successfully executed but returns an error code.
// Try xterm+less next
@@ -401,7 +401,7 @@ bool OSystem_POSIX::displayLogFile() {
int status;
// Wait for viewer to close.
- // (But note that xdg-open may have spawned a viewer in the background.)
+ // (But note that open may have spawned a viewer in the background.)
// FIXME: We probably want the viewer to always open in the background.
// This may require installing a SIGCHLD handler.
@@ -420,7 +420,7 @@ bool OSystem_POSIX::openUrl(const Common::String &url) {
// inspired by Qt's "qdesktopservices_x11.cpp"
// try "standards"
- if (launchBrowser("xdg-open", url))
+ if (launchBrowser("open", url))
return true;
if (launchBrowser(getenv("DEFAULT_BROWSER"), url))
return true;
diff --git a/backends/saves/posix/posix-saves.cpp b/backends/saves/posix/posix-saves.cpp
index b8b3932..a5f329c 100644
--- a/backends/saves/posix/posix-saves.cpp
+++ b/backends/saves/posix/posix-saves.cpp
@@ -25,6 +25,10 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h //On IRIX, sys/stat.h includes sys/time.h
#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
#define FORBIDDEN_SYMBOL_EXCEPTION_getenv
+#define FORBIDDEN_SYMBOL_EXCEPTION_chdir
+#define FORBIDDEN_SYMBOL_EXCEPTION_getcwd
+#define FORBIDDEN_SYMBOL_EXCEPTION_unlink
+
#include "common/scummsys.h"
@@ -41,6 +45,9 @@
#include "common/textconsole.h"
#include <sys/stat.h>
+#if defined(HAIKU)
+#include <FindDirectory.h>
+#endif
POSIXSaveFileManager::POSIXSaveFileManager() {
// Register default savepath.
@@ -52,6 +59,13 @@ POSIXSaveFileManager::POSIXSaveFileManager() {
savePath.joinInPlace("Savegames");
ConfMan.registerDefault("savepath", savePath);
}
+#elif defined(HAIKU)
+ char buffer[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, buffer, sizeof(buffer)) != B_OK)
+ strlcpy(buffer, "/boot/home/config/settings", sizeof(buffer));
+ savePath = buffer;
+ savePath.joinInPlace("scummvm/saves");
+ ConfMan.registerDefault("savepath", savePath);
#else
const char *envVar;
diff --git a/configure b/configure
index cacc106..8042b09 100755
--- a/configure
+++ b/configure
@@ -3245,6 +3245,7 @@ EOF
fi
;;
haiku*)
+ append_var DEFINES "-DHAIKU"
append_var DEFINES "-DSYSTEM_NOT_SUPPORTING_D_TYPE"
append_var DEFINES "-D_GNU_SOURCE"
# Needs -lnetwork for the timidity MIDI driver
--
2.45.2

View File

@@ -7,10 +7,11 @@ were never designed!"
HOMEPAGE="https://www.scummvm.org/"
COPYRIGHT="2001-2024 ScummVM Team"
LICENSE="GNU GPL v3"
REVISION="1"
REVISION="2"
SOURCE_URI="http://www.scummvm.org/frs/scummvm/$portVersion/scummvm-$portVersion.tar.gz"
CHECKSUM_SHA256="65460973933ea9b5a24f53799900165a72af880482778fffa305ef20efd282d7"
ADDITIONAL_FILES="scummvm.rdef.in"
PATCHES="scummvm-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
@@ -81,11 +82,6 @@ BUILD_PREREQUIRES="
cmd:pkg_config$secondaryArchSuffix
"
PATCH()
{
sed -i 's/xdg-open/open/g' backends/platform/sdl/posix/posix.cpp
}
BUILD()
{
libtoolize --force --copy --install