mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-03 13:38:52 +02:00
129 lines
3.6 KiB
Plaintext
129 lines
3.6 KiB
Plaintext
From 50932c734a5d0489bb3d8bc49095e9f4f34ac51f Mon Sep 17 00:00:00 2001
|
|
From: Sergei Reznikov <diver@gelios.net>
|
|
Date: Tue, 9 Oct 2018 16:48:35 +0300
|
|
Subject: Add Haiku support
|
|
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index f38d575..7541fe0 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -132,6 +132,8 @@ endif()
|
|
# General linker flags.
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
list(APPEND yquake2LinkerFlags "-lm -static-libgcc")
|
|
+elseif(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
|
+ list(APPEND yquake2LinkerFlags "-lnetwork")
|
|
else()
|
|
list(APPEND yquake2LinkerFlags "-lm -rdynamic")
|
|
endif()
|
|
diff --git a/src/backends/unix/main.c b/src/backends/unix/main.c
|
|
index 1201e1f..7ee797a 100644
|
|
--- a/src/backends/unix/main.c
|
|
+++ b/src/backends/unix/main.c
|
|
@@ -85,6 +85,8 @@ main(int argc, char **argv)
|
|
}
|
|
}
|
|
|
|
+#ifndef __HAIKU__
|
|
+
|
|
/* Prevent running Quake II as root. Only very mad
|
|
minded or stupid people even think about it. :) */
|
|
if (getuid() == 0)
|
|
@@ -106,12 +108,13 @@ main(int argc, char **argv)
|
|
|
|
return 1;
|
|
}
|
|
+#endif
|
|
|
|
// enforce C locale
|
|
setenv("LC_ALL", "C", 1);
|
|
|
|
/// Do not delay reads on stdin
|
|
- fcntl(fileno(stdin), F_SETFL, fcntl(fileno(stdin), F_GETFL, NULL) | FNDELAY);
|
|
+ fcntl(fileno(stdin), F_SETFL, fcntl(fileno(stdin), F_GETFL, NULL) | O_NDELAY);
|
|
|
|
// Initialize the game.
|
|
// Never returns.
|
|
diff --git a/src/backends/unix/system.c b/src/backends/unix/system.c
|
|
index 0554598..7769a42 100644
|
|
--- a/src/backends/unix/system.c
|
|
+++ b/src/backends/unix/system.c
|
|
@@ -62,7 +62,7 @@ Sys_Error(char *error, ...)
|
|
char string[1024];
|
|
|
|
/* change stdin to non blocking */
|
|
- fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~FNDELAY);
|
|
+ fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~O_NDELAY);
|
|
|
|
#ifndef DEDICATED_ONLY
|
|
CL_Shutdown();
|
|
@@ -91,7 +91,7 @@ Sys_Quit(void)
|
|
}
|
|
|
|
Qcommon_Shutdown();
|
|
- fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~FNDELAY);
|
|
+ fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~O_NDELAY);
|
|
|
|
printf("------------------------------------\n");
|
|
|
|
diff --git a/src/client/input/sdl.c b/src/client/input/sdl.c
|
|
index a2e6f18..9397d97 100644
|
|
--- a/src/client/input/sdl.c
|
|
+++ b/src/client/input/sdl.c
|
|
@@ -1239,9 +1239,9 @@ IN_Init(void)
|
|
SDL_StartTextInput();
|
|
|
|
/* Joystick init */
|
|
- if (!SDL_WasInit(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC))
|
|
+ if (!SDL_WasInit(SDL_INIT_GAMECONTROLLER))
|
|
{
|
|
- if (SDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) == -1)
|
|
+ if (SDL_Init(SDL_INIT_GAMECONTROLLER) == -1)
|
|
{
|
|
Com_Printf ("Couldn't init SDL joystick: %s.\n", SDL_GetError ());
|
|
}
|
|
--
|
|
2.19.1
|
|
|
|
From 7cf68509bfbd20fe3fa84f0598973e8558c28742 Mon Sep 17 00:00:00 2001
|
|
From: Nikolay0054 <nikolay0054@gmail.com>
|
|
Date: Sat, 3 Nov 2018 14:10:59 +0500
|
|
Subject: [PATCH] fix find path
|
|
|
|
---
|
|
src/backends/generic/misc.c | 11 +++++++++++
|
|
1 file changed, 11 insertions(+)
|
|
|
|
diff --git a/src/backends/generic/misc.c b/src/backends/generic/misc.c
|
|
index 973a2cba..11832be0 100644
|
|
--- a/src/backends/generic/misc.c
|
|
+++ b/src/backends/generic/misc.c
|
|
@@ -45,6 +45,10 @@
|
|
#include <mach-o/dyld.h> // _NSGetExecutablePath
|
|
#endif
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <FindDirectory.h> // find_path()
|
|
+#endif
|
|
+
|
|
#ifndef PATH_MAX
|
|
// this is mostly for windows. windows has a MAX_PATH = 260 #define, but allows
|
|
// longer paths anyway.. this might not be the maximum allowed length, but is
|
|
@@ -119,6 +123,13 @@ static void SetExecutablePath(char* exePath)
|
|
// TODO: realpath() ?
|
|
// TODO: no idea what this is if the executable is in an app bundle
|
|
|
|
+#elif defined(__HAIKU__)
|
|
+
|
|
+ if(find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_IMAGE_PATH, NULL, exePath, PATH_MAX) != B_OK)
|
|
+ {
|
|
+ exePath[0] = '\0';
|
|
+ }
|
|
+
|
|
#else
|
|
|
|
// Several platforms (for example OpenBSD) donn't provide a
|
|
--
|
|
2.19.1
|