1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +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

@@ -57,6 +57,7 @@ Includes all git commit authors. Aliases are GitHub user names.
* Hielke Morsink (Broxzier) - Tile inspector, heightmap loader, misc.
* Joël Troch (JoelTroch) - Keyboard shortcuts for ride construction.
* Thomas Delebo (delebota) - Misc.
* Brian Callahan (ibara) - OpenBSD port.
## Bug fixes
* (halfbro)

View File

@@ -7,6 +7,7 @@
- Feature: [#5576] Add a persistent 'display real names of guests' setting.
- Feature: OpenRCT2 now starts up on the display it was last shown on.
- Feature: [#5611] Add support for Android
- Feature: [#5706] Add support for OpenBSD
- Improved: Construction rights can now be placed on park entrances.
- Improved: Mouse can now be dragged to select scenery when saving track designs
- Fix: [#259] Money making glitch involving swamps (original bug)

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

View File

@@ -104,7 +104,11 @@ set(LANGUAGEPACK_TEST_SOURCES
"${ROOT_DIR}/src/openrct2/localisation/LanguagePack.cpp"
)
add_executable(test_languagepack ${LANGUAGEPACK_TEST_SOURCES})
target_link_libraries(test_languagepack ${GTEST_LIBRARIES} test-common dl z SDL2)
if (UNIX AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "BSD")
# Include libdl for dlopen
set(LDL dl)
endif ()
target_link_libraries(test_languagepack ${GTEST_LIBRARIES} test-common ${LDL} z SDL2)
add_test(NAME languagepack COMMAND test_languagepack)
# INI test
@@ -117,7 +121,7 @@ set(INI_TEST_SOURCES
"${ROOT_DIR}/src/openrct2/core/MemoryStream.cpp"
)
add_executable(test_ini ${INI_TEST_SOURCES})
target_link_libraries(test_ini ${GTEST_LIBRARIES} test-common dl z)
target_link_libraries(test_ini ${GTEST_LIBRARIES} test-common ${LDL} z)
add_test(NAME ini COMMAND test_ini)
# String test
@@ -125,7 +129,7 @@ set(STRING_TEST_SOURCES
"${CMAKE_CURRENT_LIST_DIR}/StringTest.cpp"
)
add_executable(test_string ${STRING_TEST_SOURCES})
target_link_libraries(test_string ${GTEST_LIBRARIES} test-common dl z)
target_link_libraries(test_string ${GTEST_LIBRARIES} test-common ${LDL} z)
add_test(NAME string COMMAND test_string)
if (NOT DISABLE_RCT2_TESTS)
@@ -133,13 +137,13 @@ if (NOT DISABLE_RCT2_TESTS)
set(RIDE_RATINGS_TEST_SOURCES "${CMAKE_CURRENT_LIST_DIR}/RideRatings.cpp"
"${CMAKE_CURRENT_LIST_DIR}/TestData.cpp")
add_executable(test_ride_ratings ${RIDE_RATINGS_TEST_SOURCES})
target_link_libraries(test_ride_ratings ${GTEST_LIBRARIES} libopenrct2 dl z)
target_link_libraries(test_ride_ratings ${GTEST_LIBRARIES} libopenrct2 ${LDL} z)
add_test(NAME ride_ratings COMMAND test_ride_ratings)
# Multi-launch test
set(MULTILAUNCH_TEST_SOURCES "${CMAKE_CURRENT_LIST_DIR}/MultiLaunch.cpp"
"${CMAKE_CURRENT_LIST_DIR}/TestData.cpp")
add_executable(test_multilaunch ${MULTILAUNCH_TEST_SOURCES})
target_link_libraries(test_multilaunch ${GTEST_LIBRARIES} libopenrct2 dl z)
target_link_libraries(test_multilaunch ${GTEST_LIBRARIES} libopenrct2 ${LDL} z)
add_test(NAME multilaunch COMMAND test_multilaunch)
endif ()