1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 20:43:04 +01:00

Merge pull request #5706 from ibara/develop

Add OpenBSD support.
This commit is contained in:
Michael Steenbeek
2017-06-26 15:02:40 +02:00
committed by GitHub
9 changed files with 29 additions and 11 deletions

View File

@@ -14,7 +14,7 @@
*****************************************************************************/
#pragma endregion
#if defined(__linux__) && !defined(__ANDROID__)
#if (defined(__linux__) || defined(__OpenBSD__)) && !defined(__ANDROID__)
#include <dlfcn.h>
#include <sstream>
@@ -50,6 +50,7 @@ namespace OpenRCT2 { namespace Ui
bool IsSteamOverlayAttached() override
{
#ifdef __linux__
// See http://syprog.blogspot.ru/2011/12/listing-loaded-shared-objects-in-linux.html
struct lmap
{
@@ -84,6 +85,9 @@ namespace OpenRCT2 { namespace Ui
dlclose(processHandle);
}
return result;
#else
return false; // Needed for OpenBSD, likely all other Unixes.
#endif
}
void ShowMessageBox(SDL_Window * window, const std::string &message) override
@@ -351,4 +355,4 @@ namespace OpenRCT2 { namespace Ui
}
} }
#endif // __linux__
#endif // __linux__ || __OpenBSD__

View File

@@ -61,6 +61,9 @@
#ifdef __ANDROID__
#define OPENRCT2_PLATFORM "Android"
#endif
#ifdef __OpenBSD__
#define OPENRCT2_PLATFORM "OpenBSD"
#endif
#ifndef OPENRCT2_PLATFORM
#error Unknown platform!
#endif

View File

@@ -116,7 +116,7 @@ public:
{
#if defined(_MSC_VER)
return _ftelli64(_file);
#elif (defined(__APPLE__) && defined(__MACH__)) || defined(__ANDROID__)
#elif (defined(__APPLE__) && defined(__MACH__)) || defined(__ANDROID__) || defined(__OpenBSD__)
return ftello(_file);
#else
return ftello64(_file);
@@ -142,7 +142,7 @@ public:
_fseeki64(_file, offset, SEEK_END);
break;
}
#elif (defined(__APPLE__) && defined(__MACH__)) || defined(__ANDROID__)
#elif (defined(__APPLE__) && defined(__MACH__)) || defined(__ANDROID__) || defined(__OpenBSD__)
switch (origin) {
case STREAM_SEEK_BEGIN:
fseeko(_file, offset, SEEK_SET);

View File

@@ -16,6 +16,7 @@
#pragma once
#include <cstdarg>
#include <string>
#include <vector>
#include "../common.h"

View File

@@ -1372,7 +1372,7 @@ sint32 win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t
//log_warning("converting %s of size %d", src, srcLength);
char *buffer_conv = strndup(src, srcLength);
char *buffer_orig = buffer_conv;
const char *to_charset = "UTF8";
const char *to_charset = "UTF-8";
const char *from_charset = "CP1252";
iconv_t cd = iconv_open(to_charset, from_charset);
if ((iconv_t)-1 == cd)

View File

@@ -18,7 +18,7 @@
// Despite the name, this file contains support for more OSs besides Linux, provided the necessary ifdefs remain small.
// Otherwise, they should be spun off into their own files.
#if (defined(__linux__) || defined(__FREEBSD__)) && !defined(__ANDROID__)
#if (defined(__linux__) || defined(__FREEBSD__) || defined(__OpenBSD__)) && !defined(__ANDROID__)
#ifdef __FREEBSD__
#include <sys/sysctl.h>
@@ -56,6 +56,10 @@ void platform_get_exe_path(utf8 *outPath, size_t outSize)
log_fatal("failed to get process path");
}
#elif defined(__OpenBSD__)
// There is no way to get the path name of a running executable.
// If you are not using the port or package, you must change this line!
strlcpy(exePath, "/usr/local/bin/", sizeof(exePath));
#else
#error "Platform does not support full path exe retrieval"
#endif