mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Copied Teeworld patches for the Haiku operating system
Co-authored-by: Gerasim Troeglazov <3dEyes@gmail.com>
This commit is contained in:
parent
2bc420bef8
commit
6c02076c05
|
@ -155,7 +155,7 @@ if(CMAKE_GENERATOR STREQUAL "Ninja")
|
|||
add_c_compiler_flag_if_supported(OUR_FLAGS -fcolor-diagnostics)
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
if(NOT MSVC AND NOT HAIKU)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.1 OR TARGET_OS STREQUAL "mac")
|
||||
check_cxx_compiler_flag(-std=gnu++11 FLAG_SUPPORTED_std_gnu__11)
|
||||
if(FLAG_SUPPORTED_std_gnu__11)
|
||||
|
@ -210,9 +210,15 @@ if(NOT MSVC)
|
|||
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wthread-safety)
|
||||
# TODO: Enable for C++ code except gtest
|
||||
#add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN "-Wuseless-cast")
|
||||
else()
|
||||
if(TARGET_OS STREQUAL "haiku")
|
||||
set(PLATFORM_CLIENT)
|
||||
find_package(OpenGL)
|
||||
set(PLATFORM_LIBS GL network)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
if(NOT MSVC AND NOT HAIKU)
|
||||
check_c_compiler_flag("-O2;-Wp,-Werror;-D_FORTIFY_SOURCE=2" DEFINE_FORTIFY_SOURCE) # Some distributions define _FORTIFY_SOURCE by themselves.
|
||||
endif()
|
||||
|
||||
|
|
|
@ -82,6 +82,13 @@
|
|||
#define PLATFORM_STRING "beos"
|
||||
#endif
|
||||
|
||||
#if defined(__HAIKU__)
|
||||
#define CONF_FAMILY_UNIX 1
|
||||
#define CONF_FAMILY_STRING "unix"
|
||||
#define CONF_PLATFORM_HAIKU 1
|
||||
#define CONF_PLATFORM_STRING "haiku"
|
||||
#endif
|
||||
|
||||
/* use gcc endianness definitions when available */
|
||||
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__MINGW32__) && !defined(__sun)
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
|
|
|
@ -2074,6 +2074,11 @@ int fs_storage_path(const char *appname, char *path, int max)
|
|||
if(!home)
|
||||
return -1;
|
||||
|
||||
#if defined(CONF_PLATFORM_HAIKU)
|
||||
str_format(path, max, "%s/config/settings/%s", home, appname);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#if defined(CONF_PLATFORM_MACOS)
|
||||
snprintf(path, max, "%s/Library/Application Support/%s", home, appname);
|
||||
#else
|
||||
|
@ -2113,6 +2118,11 @@ int fs_makedir(const char *path)
|
|||
return 0;
|
||||
return -1;
|
||||
#else
|
||||
#ifdef CONF_PLATFORM_HAIKU
|
||||
struct stat st;
|
||||
if(stat(path, &st) == 0)
|
||||
return 0;
|
||||
#endif
|
||||
if(mkdir(path, 0755) == 0)
|
||||
return 0;
|
||||
if(errno == EEXIST)
|
||||
|
|
|
@ -631,7 +631,11 @@ void sphore_destroy(SEMAPHORE *sem);
|
|||
/* if compiled with -pedantic-errors it will complain about long
|
||||
not being a C90 thing.
|
||||
*/
|
||||
#ifdef CONF_PLATFORM_HAIKU
|
||||
#include <SupportDefs.h>
|
||||
#else
|
||||
__extension__ typedef long long int64;
|
||||
#endif
|
||||
__extension__ typedef unsigned long long uint64;
|
||||
#else
|
||||
typedef long long int64;
|
||||
|
|
|
@ -4777,7 +4777,7 @@ void CGraphicsBackend_SDL_OpenGL::SetWindowParams(int FullscreenMode, bool IsBor
|
|||
{
|
||||
if(FullscreenMode == 1)
|
||||
{
|
||||
#if defined(CONF_PLATFORM_MACOS) // Todo SDL: remove this when fixed (game freezes when losing focus in fullscreen)
|
||||
#if defined(CONF_PLATFORM_MACOS) || defined(CONF_PLATFORM_HAIKU) // Todo SDL: remove this when fixed (game freezes when losing focus in fullscreen)
|
||||
SDL_SetWindowFullscreen(m_pWindow, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
#else
|
||||
SDL_SetWindowFullscreen(m_pWindow, SDL_WINDOW_FULLSCREEN);
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
#include <engine/client/updater.h>
|
||||
#include <engine/storage.h>
|
||||
|
||||
#ifdef CONF_PLATFORM_HAIKU
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
class CStorage : public IStorage
|
||||
{
|
||||
public:
|
||||
|
@ -193,6 +197,9 @@ public:
|
|||
|
||||
// 3) check for usable path in argv[0]
|
||||
{
|
||||
#ifdef CONF_PLATFORM_HAIKU
|
||||
pArgv0 = realpath(pArgv0, NULL);
|
||||
#endif
|
||||
unsigned int Pos = ~0U;
|
||||
for(unsigned i = 0; pArgv0[i]; i++)
|
||||
if(pArgv0[i] == '/' || pArgv0[i] == '\\')
|
||||
|
@ -211,6 +218,9 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef CONF_PLATFORM_HAIKU
|
||||
free((void *)pArgv0);
|
||||
#endif
|
||||
|
||||
#if defined(CONF_FAMILY_UNIX)
|
||||
// 4) check for all default locations
|
||||
|
|
Loading…
Reference in a new issue