Files
haikuports/games-strategy/openxcom/patches/openxcom-1.0.patchset
Mikołaj 'lich' Halber 482b251cf2 Openxcom: Added recipe, patches and icon for 1.0
Running OpenXcom in Haiku requires a workaround as there is system
locale problem which causes game to crash with an error:

terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Abort
Abort

The problem is only happening when there is no config file generated
to fix it, game has to be run once like this:

LC_ALL=C exec /system/apps/OpenXcom

Then game creates config and can be run from menu. I am not including
the fix in recipe as this would hide this system locale bug.

Also the game data subfolders (GEODATA, GEOGRAPH, MAPS, ROUTES,
SOUND, TERRAIN, UFOGRAPH, UFOINTRO, UNITS) should be provided
to /settings/OpenXcom.
2016-01-06 21:54:35 +01:00

119 lines
3.5 KiB
Plaintext

From c965aec6b307f3b6bc614a1ee3733ef23fd8e17a Mon Sep 17 00:00:00 2001
From: Mikolaj 'lich' Halber <lich@opmbx.org>
Date: Sun, 3 Jan 2016 21:31:07 +0000
Subject: Added Haiku support
diff --git a/cmake/modules/FindSDL2.cmake b/cmake/modules/FindSDL2.cmake
index b407bef..7764974 100644
--- a/cmake/modules/FindSDL2.cmake
+++ b/cmake/modules/FindSDL2.cmake
@@ -78,7 +78,7 @@
FIND_PATH(SDL_INCLUDE_DIR SDL.h
HINTS
$ENV{SDLDIR}
- PATH_SUFFIXES include/SDL include
+ PATH_SUFFIXES include/SDL include SDL
PATHS
~/Library/Frameworks
/Library/Frameworks
@@ -219,7 +219,7 @@ macro ( FindSDL_component _component )
HINTS
$ENV{SDL${UPPERCOMPONENT}DIR}
$ENV{SDLDIR}
- PATH_SUFFIXES include/SDL include
+ PATH_SUFFIXES include/SDL include SDL
PATHS
~/Library/Frameworks
/Library/Frameworks
diff --git a/cmake/modules/FindSDL_gfx.cmake b/cmake/modules/FindSDL_gfx.cmake
index 2e09b9b..c4c0633 100644
--- a/cmake/modules/FindSDL_gfx.cmake
+++ b/cmake/modules/FindSDL_gfx.cmake
@@ -28,7 +28,7 @@ FIND_PATH(SDLGFX_INCLUDE_DIR SDL_gfx.h
HINTS
$ENV{SDLGFXDIR}
$ENV{SDLDIR}
- PATH_SUFFIXES include
+ PATH_SUFFIXES include SDL
PATHS
~/Library/Frameworks
/Library/Frameworks
@@ -72,7 +72,7 @@ IF(NOT SDLGFX_INCLUDE_DIR)
HINTS
$ENV{SDLGFXDIR}
$ENV{SDLDIR}
- PATH_SUFFIXES include
+ PATH_SUFFIXES include SDL
PATHS
~/Library/Frameworks
/Library/Frameworks
diff --git a/cmake/modules/FindYaml_cpp.cmake b/cmake/modules/FindYaml_cpp.cmake
index 64ccc2f..27a0f4b 100644
--- a/cmake/modules/FindYaml_cpp.cmake
+++ b/cmake/modules/FindYaml_cpp.cmake
@@ -29,7 +29,7 @@ FIND_PATH(YAMLCPP_INCLUDE_DIR yaml.h
${PC_YAMLCPP_INCLUDEDIR}
${PC_YAMLCPP_INCLUDE_DIRS}
$ENV{YAMLCPPDIR}
- PATH_SUFFIXES include/yaml-cpp include
+ PATH_SUFFIXES include/yaml-cpp include yaml-cpp
PATHS
~/Library/Frameworks
/Library/Frameworks
diff --git a/src/Engine/CrossPlatform.cpp b/src/Engine/CrossPlatform.cpp
index a5704f4..53823e6 100644
--- a/src/Engine/CrossPlatform.cpp
+++ b/src/Engine/CrossPlatform.cpp
@@ -59,6 +59,10 @@
#include <SDL.h>
#include <SDL_syswm.h>
#include <SDL_image.h>
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <StorageDefs.h>
+#endif
namespace OpenXcom
{
@@ -144,7 +148,10 @@ std::vector<std::string> findDataFolders()
#else
char const *home = getHome();
#ifdef __HAIKU__
- list.push_back("/boot/apps/OpenXcom/data/");
+ char data_path[B_PATH_NAME_LENGTH];
+ find_directory(B_SYSTEM_SETTINGS_DIRECTORY, 0, true, data_path, sizeof(data_path)-strlen("/OpenXcom/"));
+ strcat(data_path,"/OpenXcom/");
+ list.push_back(data_path);
#endif
char path[MAXPATHLEN];
@@ -237,7 +244,10 @@ std::vector<std::string> findUserFolders()
}
#else
#ifdef __HAIKU__
- list.push_back("/boot/apps/OpenXcom/");
+ char user_path[B_PATH_NAME_LENGTH];
+ find_directory(B_USER_SETTINGS_DIRECTORY, 0, true, user_path, sizeof(user_path)-strlen("/OpenXcom/"));
+ strcat(user_path,"/OpenXcom/");
+ list.push_back(user_path);
#endif
char const *home = getHome();
char path[MAXPATHLEN];
@@ -281,7 +291,10 @@ std::string findConfigFolder()
#if defined(_WIN32) || defined(__APPLE__)
return "";
#elif defined (__HAIKU__)
- return "/boot/home/config/settings/openxcom/";
+ char settings_path[B_PATH_NAME_LENGTH];
+ find_directory(B_USER_SETTINGS_DIRECTORY, 0, true, settings_path, sizeof(settings_path)-strlen("/OpenXcom/"));
+ strcat(settings_path,"/OpenXcom/");
+ return settings_path;
#else
char const *home = getHome();
char path[MAXPATHLEN];
--
2.2.2