From 2d5de506f46a0efdf06c676f78afa821b4269c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sat, 17 Sep 2016 23:54:42 +0200 Subject: [PATCH] Fix guards for NO_RCT2 builds --- src/openrct2.c | 10 +++++----- src/paint/supports.c | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/openrct2.c b/src/openrct2.c index 85b9e066e3..8c301c6436 100644 --- a/src/openrct2.c +++ b/src/openrct2.c @@ -50,7 +50,7 @@ int gExitCode; -#ifdef USE_MMAP +#if defined(__unix__) && !defined(NO_RCT2) static int fdData; static char * segments = (char *)(GOOD_PLACE_FOR_DATA_SEGMENT); #endif @@ -354,7 +354,7 @@ void openrct2_dispose() #ifndef DISABLE_NETWORK EVP_MD_CTX_destroy(gHashCTX); #endif // DISABLE_NETWORK -#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) +#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) && !defined(NO_RCT2) munmap(segments, 12079104); close(fdData); #endif @@ -506,7 +506,7 @@ bool openrct2_setup_rct2_segment() // necessary. Windows does not need to do this as OpenRCT2 runs as a DLL loaded from the Windows PE. int len = 0x01429000 - 0x8a4000; // 0xB85000, 12079104 bytes or around 11.5MB int err = 0; -#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) +#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) && !defined(NO_RCT2) #define RDATA_OFFSET 0x004A4000 #define DATASEG_OFFSET 0x005E2000 @@ -556,7 +556,7 @@ bool openrct2_setup_rct2_segment() } #endif // defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) -#if defined(__unix__) +#if defined(__unix__) && !defined(NO_RCT2) int pageSize = getpagesize(); int numPages = (len + pageSize - 1) / pageSize; unsigned char *dummy = malloc(numPages); @@ -632,7 +632,7 @@ bool openrct2_setup_rct2_segment() SDL_RWclose(rw); #endif // defined(USE_MMAP) && defined(__WINDOWS__) -#if !defined(NO_RCT2) || defined(USE_MMAP) +#if !defined(NO_RCT2) && defined(USE_MMAP) // Check that the expected data is at various addresses. // Start at 0x9a6000, which is start of .data, to skip the region containing addresses to DLL // calls, which can be changed by windows/wine loader. diff --git a/src/paint/supports.c b/src/paint/supports.c index 1b947de5b5..11d84a0028 100644 --- a/src/paint/supports.c +++ b/src/paint/supports.c @@ -476,9 +476,13 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin */ bool wooden_b_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags) { +#ifdef NO_RCT2 + return 0; +#else int eax = special, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; RCT2_CALLFUNC_X(0x00662D5C, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); return eax & 0xFF; +#endif } /** @@ -673,9 +677,13 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int */ bool metal_b_supports_paint_setup(int supportType, uint8 segment, int special, int height, uint32 imageColourFlags) { +#ifdef NO_RCT2 + return 0; +#else int eax = special, ebx = segment, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; RCT2_CALLFUNC_X(0x00663584, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); return eax & 0xFF; +#endif } /**