mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Use standard platform defines
This commit is contained in:
@@ -38,16 +38,16 @@
|
||||
#endif
|
||||
|
||||
// Platform
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
#define OPENRCT2_PLATFORM "Windows"
|
||||
#endif
|
||||
#ifdef __LINUX__
|
||||
#ifdef __linux__
|
||||
#define OPENRCT2_PLATFORM "Linux"
|
||||
#endif
|
||||
#ifdef __MACOSX__
|
||||
#if (defined(__APPLE__) && defined(__MACH__))
|
||||
#define OPENRCT2_PLATFORM "macOS"
|
||||
#endif
|
||||
#ifdef __FREEBSD__
|
||||
#ifdef __FreeBSD__
|
||||
#define OPENRCT2_PLATFORM "FreeBSD"
|
||||
#endif
|
||||
#ifndef OPENRCT2_PLATFORM
|
||||
|
||||
@@ -176,7 +176,7 @@ void audio_populate_devices()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __LINUX__
|
||||
#ifndef __linux__
|
||||
// The first device is always system default on Windows and macOS
|
||||
std::string defaultDevice = language_get_string(STR_OPTIONS_SOUND_VALUE_DEFAULT);
|
||||
devices.insert(devices.begin(), defaultDevice);
|
||||
|
||||
@@ -519,7 +519,7 @@ namespace CommandLine
|
||||
|
||||
static bool HandleSpecialArgument(const char * argument)
|
||||
{
|
||||
#ifdef __MACOSX__
|
||||
#ifdef __APPLE__
|
||||
if (String::Equals(argument, "-NSDocumentRevisionsDebugMode"))
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -94,7 +94,7 @@ static exitcode_t HandleCommandJoin(CommandLineArgEnumerator * enumerator);
|
||||
static exitcode_t HandleCommandSetRCT2(CommandLineArgEnumerator * enumerator);
|
||||
static exitcode_t HandleCommandScanObjects(CommandLineArgEnumerator * enumerator);
|
||||
|
||||
#if defined(__WINDOWS__) && !defined(__MINGW32__)
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
|
||||
static bool _removeShell = false;
|
||||
|
||||
@@ -131,7 +131,7 @@ const CommandLineCommand CommandLine::RootCommands[]
|
||||
DefineCommand("scan-objects", "<path>", StandardOptions, HandleCommandScanObjects),
|
||||
DefineCommand("handle-uri", "openrct2://.../", StandardOptions, CommandLine::HandleCommandUri),
|
||||
|
||||
#if defined(__WINDOWS__) && !defined(__MINGW32__)
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
DefineCommand("register-shell", "", RegisterShellOptions, HandleCommandRegisterShell),
|
||||
#endif
|
||||
|
||||
@@ -400,7 +400,7 @@ static exitcode_t HandleCommandScanObjects(CommandLineArgEnumerator * enumerator
|
||||
return EXITCODE_OK;
|
||||
}
|
||||
|
||||
#if defined(__WINDOWS__) && !defined(__MINGW32__)
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
static exitcode_t HandleCommandRegisterShell(CommandLineArgEnumerator * enumerator)
|
||||
{
|
||||
exitcode_t result = CommandLine::HandleCommandDefault();
|
||||
@@ -419,7 +419,7 @@ static exitcode_t HandleCommandRegisterShell(CommandLineArgEnumerator * enumerat
|
||||
}
|
||||
return EXITCODE_OK;
|
||||
}
|
||||
#endif // defined(__WINDOWS__) && !defined(__MINGW32__)
|
||||
#endif // defined(_WIN32) && !defined(__MINGW32__)
|
||||
|
||||
static void PrintAbout()
|
||||
{
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
#ifndef _COMMON_H_
|
||||
#define _COMMON_H_
|
||||
|
||||
#include <SDL_platform.h>
|
||||
|
||||
#ifndef _USE_MATH_DEFINES
|
||||
#define _USE_MATH_DEFINES
|
||||
#endif
|
||||
@@ -52,7 +50,7 @@ typedef uint64_t uint64;
|
||||
typedef char utf8;
|
||||
typedef utf8* utf8string;
|
||||
typedef const utf8* const_utf8string;
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
typedef wchar_t utf16;
|
||||
typedef utf16* utf16string;
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#elif defined(__WINDOWS__)
|
||||
#elif defined(_WIN32)
|
||||
extern "C" {
|
||||
// Windows needs this for widechar <-> utf8 conversion utils
|
||||
#include "../localisation/language.h"
|
||||
@@ -227,7 +227,7 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
|
||||
class FileScannerWindows final : public FileScannerBase
|
||||
{
|
||||
@@ -286,7 +286,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __WINDOWS__
|
||||
#endif // _WIN32
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
|
||||
@@ -362,7 +362,7 @@ private:
|
||||
|
||||
IFileScanner * Path::ScanDirectory(const std::string &pattern, bool recurse)
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
return new FileScannerWindows(pattern, recurse);
|
||||
#elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
return new FileScannerUnix(pattern, recurse);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef GetMessage
|
||||
@@ -50,14 +50,14 @@ namespace Guard
|
||||
|
||||
// The default behaviour when an assertion is raised.
|
||||
static ASSERT_BEHAVIOUR _assertBehaviour =
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
ASSERT_BEHAVIOUR::MESSAGE_BOX
|
||||
#else
|
||||
ASSERT_BEHAVIOUR::CASSERT
|
||||
#endif
|
||||
;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
static void GetAssertMessage(char * buffer, size_t bufferSize, const char * formattedMessage);
|
||||
static void ForceCrash();
|
||||
#endif
|
||||
@@ -107,7 +107,7 @@ namespace Guard
|
||||
case ASSERT_BEHAVIOUR::CASSERT:
|
||||
assert(false);
|
||||
break;
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
case ASSERT_BEHAVIOUR::MESSAGE_BOX:
|
||||
{
|
||||
// Show message box if we are not building for testing
|
||||
@@ -137,7 +137,7 @@ namespace Guard
|
||||
Assert_VA(false, message, args);
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
static void GetAssertMessage(char * buffer, size_t bufferSize, const char * formattedMessage)
|
||||
{
|
||||
String::Set(buffer, bufferSize, ASSERTION_MESSAGE);
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Path
|
||||
{
|
||||
lastPathSeperator = ch;
|
||||
}
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
// Windows also allows forward slashes in paths
|
||||
else if (*ch == '/')
|
||||
{
|
||||
@@ -174,7 +174,7 @@ namespace Path
|
||||
|
||||
utf8 * GetAbsolute(utf8 *buffer, size_t bufferSize, const utf8 * relativePath)
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
wchar_t * relativePathW = utf8_to_widechar(relativePath);
|
||||
wchar_t absolutePathW[MAX_PATH];
|
||||
DWORD length = GetFullPathNameW(relativePathW, (DWORD)Util::CountOf(absolutePathW), absolutePathW, NULL);
|
||||
@@ -213,7 +213,7 @@ namespace Path
|
||||
bool Equals(const utf8 * a, const utf8 * b)
|
||||
{
|
||||
bool ignoreCase = false;
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
ignoreCase = true;
|
||||
#endif
|
||||
return String::Equals(a, b, ignoreCase);
|
||||
|
||||
@@ -62,7 +62,7 @@ extern "C"
|
||||
// Linux requires a restart. This could be improved in the future by recreating the window,
|
||||
// https://github.com/OpenRCT2/OpenRCT2/issues/2015
|
||||
bool requiresRestart = true;
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
if (dstEngine != DRAWING_ENGINE_OPENGL)
|
||||
{
|
||||
// Windows is apparently able to switch to hardware rendering on the fly although
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <iconv.h>
|
||||
#include <errno.h>
|
||||
#endif // __WINDOWS__
|
||||
#endif // _WIN32
|
||||
|
||||
#include "../config/Config.h"
|
||||
#include "../game.h"
|
||||
@@ -1328,7 +1328,7 @@ utf8 *win1252_to_utf8_alloc(const char *src, size_t srcMaxSize)
|
||||
|
||||
sint32 win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t maxBufferLength)
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
utf16 stackBuffer[256];
|
||||
utf16 *heapBuffer = NULL;
|
||||
utf16 *intermediateBuffer = stackBuffer;
|
||||
@@ -1396,7 +1396,7 @@ sint32 win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t
|
||||
//log_warning("converted %s of size %d, %d", dst, byte_diff, strlen(dst));
|
||||
sint32 result = byte_diff;
|
||||
free(buffer_orig);
|
||||
#endif // __WINDOWS__
|
||||
#endif // _WIN32
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
#define LAST_SOCKET_ERROR() errno
|
||||
#define closesocket close
|
||||
#define ioctlsocket ioctl
|
||||
#if defined(__LINUX__)
|
||||
#if defined(__linux__)
|
||||
#define FLAG_NO_PIPE MSG_NOSIGNAL
|
||||
#else
|
||||
#define FLAG_NO_PIPE 0
|
||||
@@ -457,7 +457,7 @@ private:
|
||||
|
||||
static bool SetNonBlocking(SOCKET socket, bool on)
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
u_long nonBlocking = on;
|
||||
return ioctlsocket(socket, FIONBIO, &nonBlocking) == 0;
|
||||
#else
|
||||
@@ -479,7 +479,7 @@ ITcpSocket * CreateTcpSocket()
|
||||
|
||||
bool InitialiseWSA()
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
if (!_wsaInitialised)
|
||||
{
|
||||
log_verbose("Initialising WSA");
|
||||
@@ -499,7 +499,7 @@ bool InitialiseWSA()
|
||||
|
||||
void DisposeWSA()
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
if (_wsaInitialised)
|
||||
{
|
||||
WSACleanup();
|
||||
|
||||
@@ -33,7 +33,7 @@ void http_dispose() { }
|
||||
#include "../core/String.hpp"
|
||||
#include "../Version.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
// cURL includes windows.h, but we don't need all of it.
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
@@ -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__)
|
||||
#if defined(__linux__) || defined(__FREEBSD__)
|
||||
|
||||
#ifdef __FREEBSD__
|
||||
#include <sys/sysctl.h>
|
||||
@@ -42,7 +42,7 @@
|
||||
void platform_get_exe_path(utf8 *outPath, size_t outSize)
|
||||
{
|
||||
char exePath[MAX_PATH];
|
||||
#ifdef __LINUX__
|
||||
#ifdef __linux__
|
||||
ssize_t bytesRead;
|
||||
bytesRead = readlink("/proc/self/exe", exePath, MAX_PATH);
|
||||
if (bytesRead == -1) {
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef struct rct2_install_info rct2_install_info;
|
||||
#define MAX_PATH 260
|
||||
#endif
|
||||
|
||||
#ifdef __MACOSX__
|
||||
#ifdef __APPLE__
|
||||
#define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI
|
||||
#else
|
||||
#define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL
|
||||
@@ -36,7 +36,7 @@ typedef struct rct2_install_info rct2_install_info;
|
||||
|
||||
#define TOUCH_DOUBLE_TIMEOUT 300
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
#define PATH_SEPARATOR "\\"
|
||||
#define PLATFORM_NEWLINE "\r\n"
|
||||
#else
|
||||
@@ -48,7 +48,7 @@ typedef struct rct2_install_info rct2_install_info;
|
||||
#define CTRL 0x200
|
||||
#define ALT 0x400
|
||||
#define CMD 0x800
|
||||
#ifdef __MACOSX__
|
||||
#ifdef __APPLE__
|
||||
#define PLATFORM_MODIFIER CMD
|
||||
#else
|
||||
#define PLATFORM_MODIFIER CTRL
|
||||
@@ -155,7 +155,7 @@ datetime64 platform_get_datetime_now_utc();
|
||||
void core_init();
|
||||
|
||||
// Windows specific definitions
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
@@ -169,14 +169,14 @@ void core_init();
|
||||
// This function cannot be marked as 'static', even though it may seem to be,
|
||||
// as it requires external linkage, which 'static' prevents
|
||||
__declspec(dllexport) sint32 StartOpenRCT(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, sint32 nCmdShow);
|
||||
#endif // __WINDOWS__
|
||||
#endif // _WIN32
|
||||
|
||||
#if defined(__LINUX__) || defined(__MACOSX__) || defined(__FREEBSD__)
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD__)
|
||||
void platform_posix_sub_user_data_path(char *buffer, size_t size, const char *homedir);
|
||||
void platform_posix_sub_resolve_openrct_data_path(utf8 *out, size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef __MACOSX__
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
void macos_disallow_automatic_window_tabbing();
|
||||
utf8* macos_str_decomp_to_precomp();
|
||||
#endif
|
||||
|
||||
@@ -374,7 +374,7 @@ sint32 platform_enumerate_files_begin(const utf8 *pattern)
|
||||
// macOS uses decomposed Unicode strings (e.g. an 'e' and a combining accent) in filenames
|
||||
// This causes problems with the sprite font, as the font only contains precomposed characters
|
||||
// The block below converts all filename strings to their precomposed form, preventing mojibake
|
||||
#ifdef __MACOSX__
|
||||
#ifdef __APPLE__
|
||||
utf8* precomp_path = macos_str_decomp_to_precomp(paths[idx]);
|
||||
size_t precomp_len = sizeof(utf8) * min(MAX_PATH, strnlen(precomp_path, MAX_PATH) + 2);
|
||||
paths[idx] = malloc(precomp_len);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
#include <lmcons.h>
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
#ifndef NO_RCT2
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/mman.h>
|
||||
#endif // __WINDOWS__
|
||||
#endif // _WIN32
|
||||
|
||||
#include "../platform/platform.h"
|
||||
#include "hook.h"
|
||||
@@ -154,19 +154,19 @@ static void hookfunc(uintptr_t address, uintptr_t hookAddress, sint32 stacksize)
|
||||
|
||||
data[i++] = 0xC3; // retn
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
||||
#else
|
||||
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
||||
memcpy((void *)address, data, i);
|
||||
#endif // __WINDOWS__
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
void addhook(uintptr_t address, hook_function *function)
|
||||
{
|
||||
if (!_hookTableAddress) {
|
||||
size_t size = _maxHooks * HOOK_BYTE_COUNT;
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
_hookTableAddress = VirtualAllocEx(GetCurrentProcess(), NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
#else
|
||||
_hookTableAddress = mmap(NULL, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
@@ -175,7 +175,7 @@ void addhook(uintptr_t address, hook_function *function)
|
||||
perror("mmap");
|
||||
exit(1);
|
||||
}
|
||||
#endif // __WINDOWS__
|
||||
#endif // _WIN32
|
||||
}
|
||||
if (_hookTableOffset > _maxHooks) {
|
||||
return;
|
||||
@@ -189,7 +189,7 @@ void addhook(uintptr_t address, hook_function *function)
|
||||
i += 4;
|
||||
|
||||
data[i++] = 0xC3; // retn
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef _WIN32
|
||||
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
||||
#else
|
||||
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
||||
@@ -206,7 +206,7 @@ void addhook(uintptr_t address, hook_function *function)
|
||||
{
|
||||
perror("mprotect");
|
||||
}
|
||||
#endif // __WINDOWS__
|
||||
#endif // _WIN32
|
||||
hookfunc(hookaddress, (uintptr_t)function, 0);
|
||||
_hookTableOffset++;
|
||||
}
|
||||
|
||||
@@ -18,19 +18,19 @@
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) || defined(__MACOSX__)
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif // defined(__unix__) || defined(__MACOSX__)
|
||||
#endif // defined(__unix__) || defined(__APPLE__)
|
||||
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../util/sawyercoding.h"
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "hook.h"
|
||||
#include "interop.h"
|
||||
|
||||
#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) && !defined(NO_RCT2)
|
||||
#if defined(USE_MMAP) && (defined(__unix__) || defined(__APPLE__)) && !defined(NO_RCT2)
|
||||
static sint32 fdData = -1;
|
||||
#endif
|
||||
#if !defined(NO_RCT2)
|
||||
@@ -68,7 +68,7 @@ bool rct2_interop_setup_segment()
|
||||
#if !defined(NO_RCT2)
|
||||
UNUSED(segments);
|
||||
#endif
|
||||
#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) && !defined(NO_RCT2)
|
||||
#if defined(USE_MMAP) && (defined(__unix__) || defined(__APPLE__)) && !defined(NO_RCT2)
|
||||
#define RDATA_OFFSET 0x004A4000
|
||||
#define DATASEG_OFFSET 0x005E2000
|
||||
|
||||
@@ -116,7 +116,7 @@ bool rct2_interop_setup_segment()
|
||||
perror("mmap");
|
||||
return false;
|
||||
}
|
||||
#endif // defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__))
|
||||
#endif // defined(USE_MMAP) && (defined(__unix__) || defined(__APPLE__))
|
||||
|
||||
#if defined(__unix__) && !defined(NO_RCT2)
|
||||
sint32 pageSize = getpagesize();
|
||||
@@ -128,7 +128,7 @@ bool rct2_interop_setup_segment()
|
||||
if (err != 0)
|
||||
{
|
||||
err = errno;
|
||||
#ifdef __LINUX__
|
||||
#ifdef __linux__
|
||||
// On Linux ENOMEM means all requested range is unmapped
|
||||
if (err != ENOMEM)
|
||||
{
|
||||
@@ -138,7 +138,7 @@ bool rct2_interop_setup_segment()
|
||||
#else
|
||||
pagesMissing = true;
|
||||
perror("mincore");
|
||||
#endif // __LINUX__
|
||||
#endif // __linux__
|
||||
} else {
|
||||
for (sint32 i = 0; i < numPages; i++)
|
||||
{
|
||||
@@ -172,7 +172,7 @@ bool rct2_interop_setup_segment()
|
||||
}
|
||||
#endif // defined(__unix__)
|
||||
|
||||
#if defined(USE_MMAP) && defined(__WINDOWS__)
|
||||
#if defined(USE_MMAP) && defined(_WIN32)
|
||||
segments = VirtualAlloc((void *)(GOOD_PLACE_FOR_DATA_SEGMENT), len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
if ((uintptr_t)segments != GOOD_PLACE_FOR_DATA_SEGMENT) {
|
||||
log_error("VirtualAlloc, segments = %p, GetLastError = 0x%x", segments, GetLastError());
|
||||
@@ -195,7 +195,7 @@ bool rct2_interop_setup_segment()
|
||||
return false;
|
||||
}
|
||||
fclose(file);
|
||||
#endif // defined(USE_MMAP) && defined(__WINDOWS__)
|
||||
#endif // defined(USE_MMAP) && defined(_WIN32)
|
||||
|
||||
#if !defined(NO_RCT2) && defined(USE_MMAP)
|
||||
// Check that the expected data is at various addresses.
|
||||
@@ -224,7 +224,7 @@ void rct2_interop_setup_hooks()
|
||||
|
||||
void rct2_interop_dispose()
|
||||
{
|
||||
#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) && !defined(NO_RCT2)
|
||||
#if defined(USE_MMAP) && (defined(__unix__) || defined(__APPLE__)) && !defined(NO_RCT2)
|
||||
munmap(segments, 12079104);
|
||||
close(fdData);
|
||||
#endif
|
||||
|
||||
@@ -1884,11 +1884,11 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
audioDeviceStringId = STR_SOUND_NONE;
|
||||
} else {
|
||||
audioDeviceStringId = STR_STRING;
|
||||
#ifndef __LINUX__
|
||||
#ifndef __linux__
|
||||
if (gAudioCurrentDevice == 0) {
|
||||
audioDeviceStringId = STR_OPTIONS_SOUND_VALUE_DEFAULT;
|
||||
}
|
||||
#endif // __LINUX__
|
||||
#endif // __linux__
|
||||
if (audioDeviceStringId == STR_STRING) {
|
||||
audioDeviceName = gAudioDevices[gAudioCurrentDevice].name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user