mirror of https://github.com/OpenRCT2/OpenRCT2.git
Apply clang-format changes to tests
This commit is contained in:
parent
d787872cbe
commit
7eafeaa971
|
@ -10,13 +10,13 @@
|
|||
#include "Addresses.h"
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#ifdef __clang__
|
||||
#define DISABLE_OPT __attribute__((noinline, optnone))
|
||||
# ifdef __clang__
|
||||
# define DISABLE_OPT __attribute__((noinline, optnone))
|
||||
# else
|
||||
# define DISABLE_OPT __attribute__((noinline, optimize("O0")))
|
||||
# endif // __clang__
|
||||
#else
|
||||
#define DISABLE_OPT __attribute__((noinline, optimize("O0")))
|
||||
#endif // __clang__
|
||||
#else
|
||||
#define DISABLE_OPT
|
||||
# define DISABLE_OPT
|
||||
#endif // defined(__GNUC__)
|
||||
|
||||
// This variable serves a purpose of identifying a crash if it has happened inside original code.
|
||||
|
@ -29,7 +29,7 @@ int32_t DISABLE_OPT RCT2_CALLPROC_X(
|
|||
int32_t result = 0;
|
||||
_originalAddress = address;
|
||||
#if defined(PLATFORM_X86) && !defined(NO_RCT2)
|
||||
#ifdef _MSC_VER
|
||||
# ifdef _MSC_VER
|
||||
__asm {
|
||||
push ebp
|
||||
push address
|
||||
|
@ -47,7 +47,7 @@ int32_t DISABLE_OPT RCT2_CALLPROC_X(
|
|||
/* Load result with flags */
|
||||
mov result, eax
|
||||
}
|
||||
#else
|
||||
# else
|
||||
// clang-format off
|
||||
__asm__ volatile("\
|
||||
\n\
|
||||
|
@ -72,8 +72,8 @@ int32_t DISABLE_OPT RCT2_CALLPROC_X(
|
|||
:
|
||||
: "eax","ecx","edx","esi","edi","memory");
|
||||
// clang-format on
|
||||
#endif // _MSC_VER
|
||||
#endif // PLATFORM_X86
|
||||
# endif // _MSC_VER
|
||||
#endif // PLATFORM_X86
|
||||
_originalAddress = 0;
|
||||
// lahf only modifies ah, zero out the rest
|
||||
return result & 0xFF00;
|
||||
|
|
|
@ -13,15 +13,15 @@
|
|||
#include <openrct2/common.h>
|
||||
|
||||
#ifdef USE_MMAP
|
||||
#if defined(PLATFORM_64BIT)
|
||||
#define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x200000000)
|
||||
#elif defined(PLATFORM_32BIT)
|
||||
#define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x09000000)
|
||||
# if defined(PLATFORM_64BIT)
|
||||
# define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x200000000)
|
||||
# elif defined(PLATFORM_32BIT)
|
||||
# define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x09000000)
|
||||
# else
|
||||
# error "Unknown platform"
|
||||
# endif
|
||||
#else
|
||||
#error "Unknown platform"
|
||||
#endif
|
||||
#else
|
||||
#define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x8a4000)
|
||||
# define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x8a4000)
|
||||
#endif
|
||||
|
||||
#define RCT2_ADDRESS(address, type) ((type*)(GOOD_PLACE_FOR_DATA_SEGMENT - 0x8a4000 + (address)))
|
||||
|
|
|
@ -14,28 +14,28 @@
|
|||
|
||||
#ifndef NO_RCT2
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/mman.h>
|
||||
#endif // _WIN32
|
||||
# ifdef _WIN32
|
||||
# include <windows.h>
|
||||
# else
|
||||
# include <sys/mman.h>
|
||||
# endif // _WIN32
|
||||
|
||||
#include "Hook.h"
|
||||
# include "Hook.h"
|
||||
|
||||
void* _hookTableAddress = 0;
|
||||
int32_t _hookTableOffset = 0;
|
||||
int32_t _maxHooks = 1000;
|
||||
#define HOOK_BYTE_COUNT (140)
|
||||
# define HOOK_BYTE_COUNT (140)
|
||||
|
||||
registers gHookRegisters = {};
|
||||
|
||||
// This macro writes a little-endian 4-byte long value into *data
|
||||
// It is used to avoid type punning.
|
||||
#define write_address_strictalias(data, addr) \
|
||||
*(data + 0) = ((addr)&0x000000ff) >> 0; \
|
||||
*(data + 1) = ((addr)&0x0000ff00) >> 8; \
|
||||
*(data + 2) = ((addr)&0x00ff0000) >> 16; \
|
||||
*(data + 3) = ((addr)&0xff000000) >> 24;
|
||||
# define write_address_strictalias(data, addr) \
|
||||
*(data + 0) = ((addr)&0x000000ff) >> 0; \
|
||||
*(data + 1) = ((addr)&0x0000ff00) >> 8; \
|
||||
*(data + 2) = ((addr)&0x00ff0000) >> 16; \
|
||||
*(data + 3) = ((addr)&0xff000000) >> 24;
|
||||
|
||||
static void hookfunc(uintptr_t address, uintptr_t hookAddress, int32_t stacksize)
|
||||
{
|
||||
|
@ -148,12 +148,12 @@ static void hookfunc(uintptr_t address, uintptr_t hookAddress, int32_t stacksize
|
|||
|
||||
data[i++] = 0xC3; // retn
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN32
|
||||
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
||||
#else
|
||||
# else
|
||||
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
||||
memcpy((void*)address, data, i);
|
||||
#endif // _WIN32
|
||||
# endif // _WIN32
|
||||
}
|
||||
|
||||
void addhook(uintptr_t address, hook_function function)
|
||||
|
@ -161,16 +161,16 @@ void addhook(uintptr_t address, hook_function function)
|
|||
if (!_hookTableAddress)
|
||||
{
|
||||
size_t size = _maxHooks * HOOK_BYTE_COUNT;
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN32
|
||||
_hookTableAddress = VirtualAllocEx(GetCurrentProcess(), NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
#else
|
||||
# else
|
||||
_hookTableAddress = mmap(NULL, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
if (_hookTableAddress == MAP_FAILED)
|
||||
{
|
||||
perror("mmap");
|
||||
exit(1);
|
||||
}
|
||||
#endif // _WIN32
|
||||
# endif // _WIN32
|
||||
}
|
||||
if (_hookTableOffset > _maxHooks)
|
||||
{
|
||||
|
@ -185,9 +185,9 @@ void addhook(uintptr_t address, hook_function function)
|
|||
i += 4;
|
||||
|
||||
data[i++] = 0xC3; // retn
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN32
|
||||
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
||||
#else
|
||||
# else
|
||||
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
||||
int32_t err = mprotect((void*)0x401000, 0x8a4000 - 0x401000, PROT_READ | PROT_WRITE);
|
||||
if (err != 0)
|
||||
|
@ -202,7 +202,7 @@ void addhook(uintptr_t address, hook_function function)
|
|||
{
|
||||
perror("mprotect");
|
||||
}
|
||||
#endif // _WIN32
|
||||
# endif // _WIN32
|
||||
hookfunc(hookaddress, (uintptr_t)function, 0);
|
||||
_hookTableOffset++;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#ifndef NO_RCT2
|
||||
|
||||
#include <openrct2/common.h>
|
||||
# include <openrct2/common.h>
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -39,20 +39,10 @@ namespace PaintIntercept
|
|||
static uint8_t InterceptPaintFull(uint8_t function, registers* regs);
|
||||
|
||||
bool PaintMetalSupports(
|
||||
uint8_t function,
|
||||
int supportType,
|
||||
uint8_t segment,
|
||||
int special,
|
||||
int height,
|
||||
uint32_t imageColourFlags,
|
||||
uint8_t function, int supportType, uint8_t segment, int special, int height, uint32_t imageColourFlags,
|
||||
const support_height* supportSegments);
|
||||
bool PaintWoodenSupports(
|
||||
uint8_t function,
|
||||
int supportType,
|
||||
int special,
|
||||
int height,
|
||||
uint32_t imageColourFlags,
|
||||
bool* underground,
|
||||
uint8_t function, int supportType, int special, int height, uint32_t imageColourFlags, bool* underground,
|
||||
const paint_struct* prependTo);
|
||||
static void CheckSegmentSupportHeight(const support_height* supportSegments);
|
||||
|
||||
|
@ -86,12 +76,7 @@ namespace PaintIntercept
|
|||
}
|
||||
|
||||
bool PaintWoodenSupports(
|
||||
uint8_t function,
|
||||
int supportType,
|
||||
int special,
|
||||
int height,
|
||||
uint32_t imageColourFlags,
|
||||
bool* underground,
|
||||
uint8_t function, int supportType, int special, int height, uint32_t imageColourFlags, bool* underground,
|
||||
const paint_struct* prependTo)
|
||||
{
|
||||
function_call* call = &_calls[_callCount];
|
||||
|
@ -120,12 +105,7 @@ namespace PaintIntercept
|
|||
}
|
||||
|
||||
bool PaintMetalSupports(
|
||||
uint8_t function,
|
||||
int supportType,
|
||||
uint8_t segment,
|
||||
int special,
|
||||
int height,
|
||||
uint32_t imageColourFlags,
|
||||
uint8_t function, int supportType, uint8_t segment, int special, int height, uint32_t imageColourFlags,
|
||||
const support_height* supportSegments)
|
||||
{
|
||||
CheckSegmentSupportHeight(supportSegments);
|
||||
|
@ -144,14 +124,8 @@ namespace PaintIntercept
|
|||
}
|
||||
|
||||
static paint_struct* Paint6C(
|
||||
uint32_t imageID,
|
||||
int8_t xOffset,
|
||||
int8_t yOffset,
|
||||
int16_t boundBoxLengthX,
|
||||
int16_t boundBoxLengthY,
|
||||
int8_t boundBoxLengthZ,
|
||||
int16_t zOffset,
|
||||
uint32_t rotation)
|
||||
uint32_t imageID, int8_t xOffset, int8_t yOffset, int16_t boundBoxLengthX, int16_t boundBoxLengthY,
|
||||
int8_t boundBoxLengthZ, int16_t zOffset, uint32_t rotation)
|
||||
{
|
||||
function_call* call = &_calls[_callCount];
|
||||
call->function = PAINT_98196C;
|
||||
|
@ -167,17 +141,8 @@ namespace PaintIntercept
|
|||
}
|
||||
|
||||
static paint_struct* PaintFull(
|
||||
uint8_t function,
|
||||
uint32_t imageID,
|
||||
int8_t xOffset,
|
||||
int8_t yOffset,
|
||||
int16_t boundBoxLengthX,
|
||||
int16_t boundBoxLengthY,
|
||||
int8_t boundBoxLengthZ,
|
||||
int16_t zOffset,
|
||||
int16_t boundBoxOffsetX,
|
||||
int16_t boundBoxOffsetY,
|
||||
int16_t boundBoxOffsetZ,
|
||||
uint8_t function, uint32_t imageID, int8_t xOffset, int8_t yOffset, int16_t boundBoxLengthX, int16_t boundBoxLengthY,
|
||||
int8_t boundBoxLengthZ, int16_t zOffset, int16_t boundBoxOffsetX, int16_t boundBoxOffsetY, int16_t boundBoxOffsetZ,
|
||||
uint32_t rotation)
|
||||
{
|
||||
function_call* call = &_calls[_callCount];
|
||||
|
@ -253,8 +218,8 @@ namespace PaintIntercept
|
|||
static uint8_t InterceptWoodenASupports(registers* regs)
|
||||
{
|
||||
bool cf = false;
|
||||
regs->al
|
||||
= PaintWoodenSupports(SUPPORTS_WOOD_A, regs->edi, regs->ax, regs->dx, regs->ebp, &cf, gWoodenSupportsPrependTo);
|
||||
regs->al = PaintWoodenSupports(
|
||||
SUPPORTS_WOOD_A, regs->edi, regs->ax, regs->dx, regs->ebp, &cf, gWoodenSupportsPrependTo);
|
||||
|
||||
if (cf)
|
||||
{
|
||||
|
@ -267,8 +232,8 @@ namespace PaintIntercept
|
|||
static uint8_t InterceptWoodenBSupports(registers* regs)
|
||||
{
|
||||
bool cf = false;
|
||||
regs->al
|
||||
= PaintWoodenSupports(SUPPORTS_WOOD_B, regs->edi, regs->ax, regs->dx, regs->ebp, &cf, gWoodenSupportsPrependTo);
|
||||
regs->al = PaintWoodenSupports(
|
||||
SUPPORTS_WOOD_B, regs->edi, regs->ax, regs->dx, regs->ebp, &cf, gWoodenSupportsPrependTo);
|
||||
|
||||
if (cf)
|
||||
{
|
||||
|
@ -287,13 +252,7 @@ namespace PaintIntercept
|
|||
}
|
||||
|
||||
paint_struct* out = Paint6C(
|
||||
regs->ebx,
|
||||
(int8_t)regs->al,
|
||||
(int8_t)regs->cl,
|
||||
(int16_t)regs->di,
|
||||
(int16_t)regs->si,
|
||||
(int8_t)regs->ah,
|
||||
regs->dx,
|
||||
regs->ebx, (int8_t)regs->al, (int8_t)regs->cl, (int16_t)regs->di, (int16_t)regs->si, (int8_t)regs->ah, regs->dx,
|
||||
regs->ebp & 0x03);
|
||||
|
||||
if (out == nullptr)
|
||||
|
@ -332,18 +291,8 @@ namespace PaintIntercept
|
|||
LocationXYZ16 boundOffset = { RCT2_PaintBoundBoxOffsetX, RCT2_PaintBoundBoxOffsetY, RCT2_PaintBoundBoxOffsetZ };
|
||||
|
||||
paint_struct* out = PaintFull(
|
||||
function,
|
||||
regs->ebx,
|
||||
(int8_t)regs->al,
|
||||
(int8_t)regs->cl,
|
||||
(int16_t)regs->di,
|
||||
(int16_t)regs->si,
|
||||
(int8_t)regs->ah,
|
||||
regs->dx,
|
||||
boundOffset.x,
|
||||
boundOffset.y,
|
||||
boundOffset.z,
|
||||
regs->ebp & 0x03);
|
||||
function, regs->ebx, (int8_t)regs->al, (int8_t)regs->cl, (int16_t)regs->di, (int16_t)regs->si, (int8_t)regs->ah,
|
||||
regs->dx, boundOffset.x, boundOffset.y, boundOffset.z, regs->ebp & 0x03);
|
||||
|
||||
if (out == nullptr)
|
||||
{
|
||||
|
@ -384,108 +333,42 @@ bool metal_b_supports_paint_setup(
|
|||
}
|
||||
|
||||
paint_struct* sub_98196C(
|
||||
paint_session* session,
|
||||
uint32_t image_id,
|
||||
int8_t x_offset,
|
||||
int8_t y_offset,
|
||||
int16_t bound_box_length_x,
|
||||
int16_t bound_box_length_y,
|
||||
int8_t bound_box_length_z,
|
||||
int16_t z_offset)
|
||||
paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x,
|
||||
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset)
|
||||
{
|
||||
return PaintIntercept::Paint6C(
|
||||
image_id,
|
||||
x_offset,
|
||||
y_offset,
|
||||
bound_box_length_x,
|
||||
bound_box_length_y,
|
||||
bound_box_length_z,
|
||||
z_offset,
|
||||
image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset,
|
||||
session->CurrentRotation);
|
||||
}
|
||||
|
||||
paint_struct* sub_98197C(
|
||||
paint_session* session,
|
||||
uint32_t image_id,
|
||||
int8_t x_offset,
|
||||
int8_t y_offset,
|
||||
int16_t bound_box_length_x,
|
||||
int16_t bound_box_length_y,
|
||||
int8_t bound_box_length_z,
|
||||
int16_t z_offset,
|
||||
int16_t bound_box_offset_x,
|
||||
int16_t bound_box_offset_y,
|
||||
int16_t bound_box_offset_z)
|
||||
paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x,
|
||||
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x,
|
||||
int16_t bound_box_offset_y, int16_t bound_box_offset_z)
|
||||
{
|
||||
return PaintIntercept::PaintFull(
|
||||
PAINT_98197C,
|
||||
image_id,
|
||||
x_offset,
|
||||
y_offset,
|
||||
bound_box_length_x,
|
||||
bound_box_length_y,
|
||||
bound_box_length_z,
|
||||
z_offset,
|
||||
bound_box_offset_x,
|
||||
bound_box_offset_y,
|
||||
bound_box_offset_z,
|
||||
session->CurrentRotation);
|
||||
PAINT_98197C, image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset,
|
||||
bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, session->CurrentRotation);
|
||||
}
|
||||
|
||||
paint_struct* sub_98198C(
|
||||
paint_session* session,
|
||||
uint32_t image_id,
|
||||
int8_t x_offset,
|
||||
int8_t y_offset,
|
||||
int16_t bound_box_length_x,
|
||||
int16_t bound_box_length_y,
|
||||
int8_t bound_box_length_z,
|
||||
int16_t z_offset,
|
||||
int16_t bound_box_offset_x,
|
||||
int16_t bound_box_offset_y,
|
||||
int16_t bound_box_offset_z)
|
||||
paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x,
|
||||
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x,
|
||||
int16_t bound_box_offset_y, int16_t bound_box_offset_z)
|
||||
{
|
||||
return PaintIntercept::PaintFull(
|
||||
PAINT_98198C,
|
||||
image_id,
|
||||
x_offset,
|
||||
y_offset,
|
||||
bound_box_length_x,
|
||||
bound_box_length_y,
|
||||
bound_box_length_z,
|
||||
z_offset,
|
||||
bound_box_offset_x,
|
||||
bound_box_offset_y,
|
||||
bound_box_offset_z,
|
||||
session->CurrentRotation);
|
||||
PAINT_98198C, image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset,
|
||||
bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, session->CurrentRotation);
|
||||
}
|
||||
|
||||
paint_struct* sub_98199C(
|
||||
paint_session* session,
|
||||
uint32_t image_id,
|
||||
int8_t x_offset,
|
||||
int8_t y_offset,
|
||||
int16_t bound_box_length_x,
|
||||
int16_t bound_box_length_y,
|
||||
int8_t bound_box_length_z,
|
||||
int16_t z_offset,
|
||||
int16_t bound_box_offset_x,
|
||||
int16_t bound_box_offset_y,
|
||||
int16_t bound_box_offset_z)
|
||||
paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x,
|
||||
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x,
|
||||
int16_t bound_box_offset_y, int16_t bound_box_offset_z)
|
||||
{
|
||||
return PaintIntercept::PaintFull(
|
||||
PAINT_98199C,
|
||||
image_id,
|
||||
x_offset,
|
||||
y_offset,
|
||||
bound_box_length_x,
|
||||
bound_box_length_y,
|
||||
bound_box_length_z,
|
||||
z_offset,
|
||||
bound_box_offset_x,
|
||||
bound_box_offset_y,
|
||||
bound_box_offset_z,
|
||||
session->CurrentRotation);
|
||||
PAINT_98199C, image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset,
|
||||
bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, session->CurrentRotation);
|
||||
}
|
||||
|
||||
bool paint_attach_to_previous_ps(paint_session* session, uint32_t image_id, uint16_t x, uint16_t y)
|
||||
|
|
|
@ -62,12 +62,8 @@ namespace Printer
|
|||
case SUPPORTS_WOOD_A:
|
||||
case SUPPORTS_WOOD_B:
|
||||
out += String::Format(
|
||||
"%s(%d, %d, %s, %s)",
|
||||
functionName,
|
||||
call.supports.type,
|
||||
call.supports.special,
|
||||
PrintHeightOffset(call.supports.height, baseHeight).c_str(),
|
||||
imageId.c_str());
|
||||
"%s(%d, %d, %s, %s)", functionName, call.supports.type, call.supports.special,
|
||||
PrintHeightOffset(call.supports.height, baseHeight).c_str(), imageId.c_str());
|
||||
if (call.supports.special == 14 || call.supports.special == 15 || call.supports.special == 18
|
||||
|| call.supports.special == 19 || call.supports.special == 22 || call.supports.special == 23)
|
||||
{
|
||||
|
@ -91,13 +87,8 @@ namespace Printer
|
|||
case SUPPORTS_METAL_A:
|
||||
case SUPPORTS_METAL_B:
|
||||
return String::Format(
|
||||
"%s(%d, %d, %d, %s, %s)",
|
||||
functionName,
|
||||
call.supports.type,
|
||||
call.supports.segment,
|
||||
call.supports.special,
|
||||
PrintHeightOffset(call.supports.height, baseHeight).c_str(),
|
||||
imageId.c_str());
|
||||
"%s(%d, %d, %d, %s, %s)", functionName, call.supports.type, call.supports.segment, call.supports.special,
|
||||
PrintHeightOffset(call.supports.height, baseHeight).c_str(), imageId.c_str());
|
||||
|
||||
case SET_SEGMENT_HEIGHT:
|
||||
return "paint_util_set_segment_support_height";
|
||||
|
@ -115,9 +106,7 @@ namespace Printer
|
|||
if (call.function != PAINT_98196C)
|
||||
{
|
||||
s += String::Format(
|
||||
"%d, %d, %s, ",
|
||||
call.paint.bound_box_offset.x,
|
||||
call.paint.bound_box_offset.y,
|
||||
"%d, %d, %s, ", call.paint.bound_box_offset.x, call.paint.bound_box_offset.y,
|
||||
PrintHeightOffset(call.paint.bound_box_offset.z, baseHeight).c_str());
|
||||
}
|
||||
|
||||
|
@ -126,16 +115,10 @@ namespace Printer
|
|||
if (call.function != PAINT_98196C)
|
||||
{
|
||||
s += String::Format(
|
||||
" = { %d, %d, %s }, { %d, %d, %s }, { %d, %d, %d }",
|
||||
call.paint.offset.x,
|
||||
call.paint.offset.y,
|
||||
PrintHeightOffset(call.paint.z_offset, baseHeight).c_str(),
|
||||
call.paint.bound_box_offset.x,
|
||||
call.paint.bound_box_offset.y,
|
||||
PrintHeightOffset(call.paint.bound_box_offset.z, baseHeight).c_str(),
|
||||
call.paint.bound_box_length.x,
|
||||
call.paint.bound_box_length.y,
|
||||
call.paint.bound_box_length.z);
|
||||
" = { %d, %d, %s }, { %d, %d, %s }, { %d, %d, %d }", call.paint.offset.x, call.paint.offset.y,
|
||||
PrintHeightOffset(call.paint.z_offset, baseHeight).c_str(), call.paint.bound_box_offset.x,
|
||||
call.paint.bound_box_offset.y, PrintHeightOffset(call.paint.bound_box_offset.z, baseHeight).c_str(),
|
||||
call.paint.bound_box_length.x, call.paint.bound_box_length.y, call.paint.bound_box_length.z);
|
||||
}
|
||||
|
||||
return s;
|
||||
|
|
|
@ -42,13 +42,8 @@ public:
|
|||
virtual std::string VariantName(uint8_t rideType, uint8_t trackType, int variant) abstract;
|
||||
|
||||
virtual void ApplyTo(
|
||||
uint8_t rideType,
|
||||
uint8_t trackType,
|
||||
int variant,
|
||||
rct_tile_element* tileElement,
|
||||
rct_tile_element* surfaceElement,
|
||||
Ride* ride,
|
||||
rct_ride_entry* rideEntry) abstract;
|
||||
uint8_t rideType, uint8_t trackType, int variant, rct_tile_element* tileElement, rct_tile_element* surfaceElement,
|
||||
Ride* ride, rct_ride_entry* rideEntry) abstract;
|
||||
};
|
||||
|
||||
class CableLiftFilter : public ITestTrackFilter
|
||||
|
@ -70,13 +65,8 @@ public:
|
|||
}
|
||||
|
||||
virtual void ApplyTo(
|
||||
uint8_t rideType,
|
||||
uint8_t trackType,
|
||||
int variant,
|
||||
rct_tile_element* tileElement,
|
||||
rct_tile_element* surfaceElement,
|
||||
Ride* ride,
|
||||
rct_ride_entry* rideEntry) override
|
||||
uint8_t rideType, uint8_t trackType, int variant, rct_tile_element* tileElement, rct_tile_element* surfaceElement,
|
||||
Ride* ride, rct_ride_entry* rideEntry) override
|
||||
{
|
||||
if (variant == 0)
|
||||
{
|
||||
|
@ -108,13 +98,8 @@ public:
|
|||
}
|
||||
|
||||
virtual void ApplyTo(
|
||||
uint8_t rideType,
|
||||
uint8_t trackType,
|
||||
int variant,
|
||||
rct_tile_element* tileElement,
|
||||
rct_tile_element* surfaceElement,
|
||||
Ride* ride,
|
||||
rct_ride_entry* rideEntry) override
|
||||
uint8_t rideType, uint8_t trackType, int variant, rct_tile_element* tileElement, rct_tile_element* surfaceElement,
|
||||
Ride* ride, rct_ride_entry* rideEntry) override
|
||||
{
|
||||
if (variant == 0)
|
||||
{
|
||||
|
@ -152,13 +137,8 @@ public:
|
|||
}
|
||||
|
||||
virtual void ApplyTo(
|
||||
uint8_t rideType,
|
||||
uint8_t trackType,
|
||||
int variant,
|
||||
rct_tile_element* tileElement,
|
||||
rct_tile_element* surfaceElement,
|
||||
Ride* ride,
|
||||
rct_ride_entry* rideEntry) override
|
||||
uint8_t rideType, uint8_t trackType, int variant, rct_tile_element* tileElement, rct_tile_element* surfaceElement,
|
||||
Ride* ride, rct_ride_entry* rideEntry) override
|
||||
{
|
||||
if (variant == 0)
|
||||
{
|
||||
|
@ -196,13 +176,8 @@ public:
|
|||
}
|
||||
|
||||
virtual void ApplyTo(
|
||||
uint8_t rideType,
|
||||
uint8_t trackType,
|
||||
int variant,
|
||||
rct_tile_element* tileElement,
|
||||
rct_tile_element* surfaceElement,
|
||||
Ride* ride,
|
||||
rct_ride_entry* rideEntry) override
|
||||
uint8_t rideType, uint8_t trackType, int variant, rct_tile_element* tileElement, rct_tile_element* surfaceElement,
|
||||
Ride* ride, rct_ride_entry* rideEntry) override
|
||||
{
|
||||
ride->entrance_style = variant;
|
||||
RCT2_Rides[0].entrance_style = variant;
|
||||
|
@ -210,11 +185,7 @@ public:
|
|||
};
|
||||
|
||||
static void CallOriginal(
|
||||
uint8_t rideType,
|
||||
uint8_t trackType,
|
||||
uint8_t direction,
|
||||
uint8_t trackSequence,
|
||||
uint16_t height,
|
||||
uint8_t rideType, uint8_t trackType, uint8_t direction, uint8_t trackSequence, uint16_t height,
|
||||
rct_tile_element* tileElement)
|
||||
{
|
||||
uint32_t* trackDirectionList = (uint32_t*)RideTypeTrackPaintFunctionsOld[rideType][trackType];
|
||||
|
@ -222,22 +193,12 @@ static void CallOriginal(
|
|||
|
||||
// Have to call from this point as it pushes esi and expects callee to pop it
|
||||
RCT2_CALLPROC_X(
|
||||
0x006C4934,
|
||||
rideType,
|
||||
(int)trackDirectionList,
|
||||
direction,
|
||||
height,
|
||||
(int)tileElement,
|
||||
rideIndex * sizeof(Ride),
|
||||
0x006C4934, rideType, (int)trackDirectionList, direction, height, (int)tileElement, rideIndex * sizeof(Ride),
|
||||
trackSequence);
|
||||
}
|
||||
|
||||
static void CallNew(
|
||||
uint8_t rideType,
|
||||
uint8_t trackType,
|
||||
uint8_t direction,
|
||||
uint8_t trackSequence,
|
||||
uint16_t height,
|
||||
uint8_t rideType, uint8_t trackType, uint8_t direction, uint8_t trackSequence, uint16_t height,
|
||||
rct_tile_element* tileElement)
|
||||
{
|
||||
TRACK_PAINT_FUNCTION_GETTER newPaintFunctionGetter = RideTypeTrackPaintFunctions[rideType];
|
||||
|
@ -250,11 +211,11 @@ using TestFunction = uint8_t (*)(uint8_t, uint8_t, uint8_t, std::string*);
|
|||
|
||||
static uint8_t TestTrackElementPaintCalls(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
||||
|
||||
static uint8_t
|
||||
TestTrackElementSegmentSupportHeight(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
||||
static uint8_t TestTrackElementSegmentSupportHeight(
|
||||
uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
||||
|
||||
static uint8_t
|
||||
TestTrackElementGeneralSupportHeight(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
||||
static uint8_t TestTrackElementGeneralSupportHeight(
|
||||
uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
||||
|
||||
static uint8_t TestTrackElementSideTunnels(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
||||
|
||||
|
@ -405,10 +366,7 @@ static uint8_t TestTrackElementPaintCalls(uint8_t rideType, uint8_t trackType, u
|
|||
RCT2_GLOBAL(0x009DE56E, int16_t) = 64; // y
|
||||
|
||||
std::string caseName = String::Format(
|
||||
"%srotation:%d direction:%d trackSequence:%d]",
|
||||
baseCaseName.c_str(),
|
||||
currentRotation,
|
||||
direction,
|
||||
"%srotation:%d direction:%d trackSequence:%d]", baseCaseName.c_str(), currentRotation, direction,
|
||||
trackSequence);
|
||||
|
||||
PaintIntercept::ClearCalls();
|
||||
|
@ -442,9 +400,7 @@ static uint8_t TestTrackElementPaintCalls(uint8_t rideType, uint8_t trackType, u
|
|||
if (oldCalls.size() != newCalls.size())
|
||||
{
|
||||
*error += String::Format(
|
||||
"Call counts don't match (was %d, expected %d). %s\n",
|
||||
newCalls.size(),
|
||||
oldCalls.size(),
|
||||
"Call counts don't match (was %d, expected %d). %s\n", newCalls.size(), oldCalls.size(),
|
||||
caseName.c_str());
|
||||
sucess = false;
|
||||
}
|
||||
|
@ -470,8 +426,8 @@ static uint8_t TestTrackElementPaintCalls(uint8_t rideType, uint8_t trackType, u
|
|||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
TestTrackElementSegmentSupportHeight(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error)
|
||||
static uint8_t TestTrackElementSegmentSupportHeight(
|
||||
uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error)
|
||||
{
|
||||
uint16_t height = 3 * 16;
|
||||
|
||||
|
@ -539,8 +495,8 @@ static uint8_t
|
|||
continue;
|
||||
}
|
||||
|
||||
std::vector<SegmentSupportCall> newCalls
|
||||
= SegmentSupportHeightCall::getSegmentCalls(gPaintSession.SupportSegments, direction);
|
||||
std::vector<SegmentSupportCall> newCalls = SegmentSupportHeightCall::getSegmentCalls(
|
||||
gPaintSession.SupportSegments, direction);
|
||||
if (!SegmentSupportHeightCall::CallsEqual(referenceCalls, newCalls))
|
||||
{
|
||||
*error += String::Format("Segment support heights didn't match. [direction:%d] %s\n", direction, state.c_str());
|
||||
|
@ -556,8 +512,8 @@ static uint8_t
|
|||
return TEST_SUCCESS;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
TestTrackElementGeneralSupportHeight(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error)
|
||||
static uint8_t TestTrackElementGeneralSupportHeight(
|
||||
uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error)
|
||||
{
|
||||
uint16_t height = 3 * 16;
|
||||
|
||||
|
@ -638,10 +594,7 @@ static uint8_t
|
|||
{
|
||||
*error += String::Format(
|
||||
"General support heights didn't match. (expected height + %d, actual: height + %d) [direction:%d] %s\n",
|
||||
referenceCall.height - height,
|
||||
gPaintSession.Support.height - height,
|
||||
direction,
|
||||
state.c_str());
|
||||
referenceCall.height - height, gPaintSession.Support.height - height, direction, state.c_str());
|
||||
return TEST_FAILED;
|
||||
}
|
||||
}
|
||||
|
@ -651,10 +604,7 @@ static uint8_t
|
|||
{
|
||||
*error += String::Format(
|
||||
"General support slopes didn't match. (expected 0x%02X, actual: 0x%02X) [direction:%d] %s\n",
|
||||
referenceCall.slope,
|
||||
gPaintSession.Support.slope,
|
||||
direction,
|
||||
state.c_str());
|
||||
referenceCall.slope, gPaintSession.Support.slope, direction, state.c_str());
|
||||
return TEST_FAILED;
|
||||
}
|
||||
}
|
||||
|
@ -708,11 +658,11 @@ static uint8_t TestTrackElementSideTunnels(uint8_t rideType, uint8_t trackType,
|
|||
}
|
||||
|
||||
bool err = false;
|
||||
tileTunnelCalls[direction][rightIndex]
|
||||
= SideTunnelCall::ExtractTunnelCalls(gRightTunnels, gRightTunnelCount, height, &err);
|
||||
tileTunnelCalls[direction][rightIndex] = SideTunnelCall::ExtractTunnelCalls(
|
||||
gRightTunnels, gRightTunnelCount, height, &err);
|
||||
|
||||
tileTunnelCalls[direction][leftIndex]
|
||||
= SideTunnelCall::ExtractTunnelCalls(gLeftTunnels, gLeftTunnelCount, height, &err);
|
||||
tileTunnelCalls[direction][leftIndex] = SideTunnelCall::ExtractTunnelCalls(
|
||||
gLeftTunnels, gLeftTunnelCount, height, &err);
|
||||
|
||||
if (err)
|
||||
{
|
||||
|
@ -743,10 +693,10 @@ static uint8_t TestTrackElementSideTunnels(uint8_t rideType, uint8_t trackType,
|
|||
}
|
||||
|
||||
bool err = false;
|
||||
newTileTunnelCalls[direction][rightIndex]
|
||||
= SideTunnelCall::ExtractTunnelCalls(gPaintSession.RightTunnels, gPaintSession.RightTunnelCount, height, &err);
|
||||
newTileTunnelCalls[direction][leftIndex]
|
||||
= SideTunnelCall::ExtractTunnelCalls(gPaintSession.LeftTunnels, gPaintSession.LeftTunnelCount, height, &err);
|
||||
newTileTunnelCalls[direction][rightIndex] = SideTunnelCall::ExtractTunnelCalls(
|
||||
gPaintSession.RightTunnels, gPaintSession.RightTunnelCount, height, &err);
|
||||
newTileTunnelCalls[direction][leftIndex] = SideTunnelCall::ExtractTunnelCalls(
|
||||
gPaintSession.LeftTunnels, gPaintSession.LeftTunnelCount, height, &err);
|
||||
if (err)
|
||||
{
|
||||
*error += "Multiple tunnels on one side aren't supported.\n";
|
||||
|
@ -856,17 +806,14 @@ static uint8_t TestTrackElementVerticalTunnels(uint8_t rideType, uint8_t trackTy
|
|||
{
|
||||
*error += String::Format(
|
||||
"Expected no tunnel. Actual: %s [trackSequence:%d]\n",
|
||||
Printer::PrintHeightOffset(testPaintVerticalTunnelHeight, height).c_str(),
|
||||
trackSequence);
|
||||
Printer::PrintHeightOffset(testPaintVerticalTunnelHeight, height).c_str(), trackSequence);
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
*error += String::Format(
|
||||
"Expected vertical tunnel height to be `%s`, was `%s`. [trackSequence:%d direction:%d]\n",
|
||||
Printer::PrintHeightOffset(referenceHeight, height).c_str(),
|
||||
Printer::PrintHeightOffset(testPaintVerticalTunnelHeight, height).c_str(),
|
||||
trackSequence,
|
||||
direction);
|
||||
Printer::PrintHeightOffset(testPaintVerticalTunnelHeight, height).c_str(), trackSequence, direction);
|
||||
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
|
|
@ -121,11 +121,8 @@ private:
|
|||
{
|
||||
const uint32_t* paintFunctionList = RideTypeTrackPaintFunctionsOld[_rideType];
|
||||
WriteLine(
|
||||
0,
|
||||
"/** rct2: 0x%08X, 0x%08X, 0x%08X */",
|
||||
paintFunctionList[TRACK_ELEM_END_STATION],
|
||||
paintFunctionList[TRACK_ELEM_BEGIN_STATION],
|
||||
paintFunctionList[TRACK_ELEM_MIDDLE_STATION]);
|
||||
0, "/** rct2: 0x%08X, 0x%08X, 0x%08X */", paintFunctionList[TRACK_ELEM_END_STATION],
|
||||
paintFunctionList[TRACK_ELEM_BEGIN_STATION], paintFunctionList[TRACK_ELEM_MIDDLE_STATION]);
|
||||
WriteLine(
|
||||
0,
|
||||
"static void " + _rideName
|
||||
|
@ -219,17 +216,13 @@ private:
|
|||
{ 0, TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_25_DEG_DOWN, TRACK_ELEM_25_DEG_UP_TO_RIGHT_BANKED_25_DEG_UP },
|
||||
{ 0, TRACK_ELEM_25_DEG_DOWN_TO_RIGHT_BANKED_25_DEG_DOWN, TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_25_DEG_UP },
|
||||
{ 0, TRACK_ELEM_25_DEG_DOWN_TO_LEFT_BANKED_25_DEG_DOWN, TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_25_DEG_UP },
|
||||
{ 0,
|
||||
TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_RIGHT_BANKED_FLAT,
|
||||
{ 0, TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_RIGHT_BANKED_FLAT,
|
||||
TRACK_ELEM_LEFT_BANKED_FLAT_TO_LEFT_BANKED_25_DEG_UP },
|
||||
{ 0,
|
||||
TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_LEFT_BANKED_FLAT,
|
||||
{ 0, TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_LEFT_BANKED_FLAT,
|
||||
TRACK_ELEM_RIGHT_BANKED_FLAT_TO_RIGHT_BANKED_25_DEG_UP },
|
||||
{ 0,
|
||||
TRACK_ELEM_RIGHT_BANKED_FLAT_TO_RIGHT_BANKED_25_DEG_DOWN,
|
||||
{ 0, TRACK_ELEM_RIGHT_BANKED_FLAT_TO_RIGHT_BANKED_25_DEG_DOWN,
|
||||
TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_LEFT_BANKED_FLAT },
|
||||
{ 0,
|
||||
TRACK_ELEM_LEFT_BANKED_FLAT_TO_LEFT_BANKED_25_DEG_DOWN,
|
||||
{ 0, TRACK_ELEM_LEFT_BANKED_FLAT_TO_LEFT_BANKED_25_DEG_DOWN,
|
||||
TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_RIGHT_BANKED_FLAT },
|
||||
{ 0, TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_FLAT, TRACK_ELEM_FLAT_TO_LEFT_BANKED_25_DEG_UP },
|
||||
{ 0, TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_FLAT, TRACK_ELEM_FLAT_TO_RIGHT_BANKED_25_DEG_UP },
|
||||
|
@ -240,24 +233,20 @@ private:
|
|||
{ 1, TRACK_ELEM_BANKED_RIGHT_QUARTER_TURN_5_TILES, TRACK_ELEM_BANKED_LEFT_QUARTER_TURN_5_TILES },
|
||||
{ 1, TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_25_DEG_DOWN, TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_25_DEG_UP },
|
||||
{ 1, TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_COVERED, TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_COVERED },
|
||||
{ 1,
|
||||
TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN,
|
||||
{ 1, TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN,
|
||||
TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_5_TILE_25_DEG_UP },
|
||||
{ 2, TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_25_DEG_DOWN, TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_25_DEG_UP },
|
||||
{ 2,
|
||||
TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN,
|
||||
{ 2, TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN,
|
||||
TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_5_TILE_25_DEG_UP },
|
||||
|
||||
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES },
|
||||
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_BANK, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_BANK },
|
||||
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_25_DEG_DOWN, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_25_DEG_UP },
|
||||
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_COVERED, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_COVERED },
|
||||
{ 3,
|
||||
TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN,
|
||||
{ 3, TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN,
|
||||
TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_3_TILE_25_DEG_UP },
|
||||
{ 4, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_25_DEG_DOWN, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_25_DEG_UP },
|
||||
{ 4,
|
||||
TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN,
|
||||
{ 4, TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN,
|
||||
TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_3_TILE_25_DEG_UP },
|
||||
|
||||
{ 5, TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE, TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE },
|
||||
|
@ -302,62 +291,53 @@ private:
|
|||
{
|
||||
case 0:
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 1:
|
||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 2:
|
||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 3:
|
||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 4:
|
||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 5:
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 6:
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 7:
|
||||
WriteLine(tabs, "trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence];");
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction + 3) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction + 3) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 8:
|
||||
WriteLine(tabs, "trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence];");
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 9:
|
||||
|
@ -367,8 +347,7 @@ private:
|
|||
WriteLine(tabs, "}");
|
||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 10:
|
||||
|
@ -378,8 +357,7 @@ private:
|
|||
WriteLine(tabs, "}");
|
||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 11:
|
||||
|
@ -389,8 +367,7 @@ private:
|
|||
WriteLine(tabs, "}");
|
||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 12:
|
||||
|
@ -400,26 +377,22 @@ private:
|
|||
WriteLine(tabs, "}");
|
||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 13:
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, 3 - trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, 3 - trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 14:
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, 2 - trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, 2 - trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 15:
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, 2 - trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, 2 - trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 16:
|
||||
|
@ -432,8 +405,7 @@ private:
|
|||
break;
|
||||
case 18:
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(rideIndex, 2 - trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||
tabs, "%s(rideIndex, 2 - trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||
destFuncName.c_str());
|
||||
break;
|
||||
case 19:
|
||||
|
@ -683,12 +655,8 @@ private:
|
|||
}
|
||||
|
||||
WriteLine(
|
||||
callTabs,
|
||||
"%s(%d, %d, %d, height%s, %s);",
|
||||
GetFunctionCallName(call.function),
|
||||
call.supports.type,
|
||||
call.supports.segment,
|
||||
call.supports.special,
|
||||
callTabs, "%s(%d, %d, %d, height%s, %s);", GetFunctionCallName(call.function), call.supports.type,
|
||||
call.supports.segment, call.supports.special,
|
||||
GetOffsetExpressionString(call.supports.height - height).c_str(),
|
||||
GetImageIdString(call.supports.colour_flags).c_str());
|
||||
|
||||
|
@ -701,12 +669,8 @@ private:
|
|||
case SUPPORTS_WOOD_A:
|
||||
case SUPPORTS_WOOD_B:
|
||||
WriteLine(
|
||||
tabs,
|
||||
"%s(%d, %d, height%s, %s, NULL);",
|
||||
GetFunctionCallName(call.function),
|
||||
call.supports.type,
|
||||
call.supports.special,
|
||||
GetOffsetExpressionString(call.supports.height - height).c_str(),
|
||||
tabs, "%s(%d, %d, height%s, %s, NULL);", GetFunctionCallName(call.function), call.supports.type,
|
||||
call.supports.special, GetOffsetExpressionString(call.supports.height - height).c_str(),
|
||||
GetImageIdString(call.supports.colour_flags).c_str());
|
||||
break;
|
||||
}
|
||||
|
@ -818,13 +782,8 @@ private:
|
|||
}
|
||||
|
||||
bool GetTunnelCalls(
|
||||
int trackType,
|
||||
int direction,
|
||||
int trackSequence,
|
||||
int height,
|
||||
rct_tile_element* tileElement,
|
||||
TunnelCall tileTunnelCalls[4][4],
|
||||
int16_t verticalTunnelHeights[4])
|
||||
int trackType, int direction, int trackSequence, int height, rct_tile_element* tileElement,
|
||||
TunnelCall tileTunnelCalls[4][4], int16_t verticalTunnelHeights[4])
|
||||
{
|
||||
TestPaint::ResetTunnels();
|
||||
|
||||
|
@ -970,8 +929,7 @@ private:
|
|||
if (tunnelHeight != 0)
|
||||
{
|
||||
WriteLine(
|
||||
tabs,
|
||||
"paint_util_set_vertical_tunnel(session, height%s);",
|
||||
tabs, "paint_util_set_vertical_tunnel(session, height%s);",
|
||||
GetOffsetExpressionString(tunnelHeight).c_str());
|
||||
}
|
||||
}
|
||||
|
@ -983,17 +941,13 @@ private:
|
|||
{
|
||||
case 0:
|
||||
WriteLine(
|
||||
tabs,
|
||||
"paint_util_push_tunnel_left(session, height%s, TUNNEL_%d);",
|
||||
GetOffsetExpressionString(offset).c_str(),
|
||||
type);
|
||||
tabs, "paint_util_push_tunnel_left(session, height%s, TUNNEL_%d);",
|
||||
GetOffsetExpressionString(offset).c_str(), type);
|
||||
break;
|
||||
case 1:
|
||||
WriteLine(
|
||||
tabs,
|
||||
"paint_util_push_tunnel_right(session, height%s, TUNNEL_%d);",
|
||||
GetOffsetExpressionString(offset).c_str(),
|
||||
type);
|
||||
tabs, "paint_util_push_tunnel_right(session, height%s, TUNNEL_%d);",
|
||||
GetOffsetExpressionString(offset).c_str(), type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1001,10 +955,8 @@ private:
|
|||
void GenerateTunnelCall(int tabs, int offset, int type)
|
||||
{
|
||||
WriteLine(
|
||||
tabs,
|
||||
"paint_util_push_tunnel_rotated(session, direction, height%s, TUNNEL_%d);",
|
||||
GetOffsetExpressionString(offset).c_str(),
|
||||
type);
|
||||
tabs, "paint_util_push_tunnel_rotated(session, direction, height%s, TUNNEL_%d);",
|
||||
GetOffsetExpressionString(offset).c_str(), type);
|
||||
}
|
||||
|
||||
void GenerateSegmentSupportCall(int tabs, std::vector<SegmentSupportCall> segmentSupportCalls[4])
|
||||
|
@ -1046,10 +998,8 @@ private:
|
|||
}
|
||||
|
||||
WriteLine(
|
||||
tabs,
|
||||
"paint_util_set_general_support_height(session, height%s, 0x%02X);",
|
||||
GetOffsetExpressionString((int16_t)generalSupports[0].height).c_str(),
|
||||
generalSupports[0].slope);
|
||||
tabs, "paint_util_set_general_support_height(session, height%s, 0x%02X);",
|
||||
GetOffsetExpressionString((int16_t)generalSupports[0].height).c_str(), generalSupports[0].slope);
|
||||
if (!AllMatch(generalSupports, 4))
|
||||
{
|
||||
// WriteLine(tabs, "#error Unsupported: different directional general supports");
|
||||
|
@ -1140,13 +1090,7 @@ private:
|
|||
uint32_t* trackDirectionList = (uint32_t*)RideTypeTrackPaintFunctionsOld[_rideType][trackType];
|
||||
// Have to call from this point as it pushes esi and expects callee to pop it
|
||||
RCT2_CALLPROC_X(
|
||||
0x006C4934,
|
||||
_rideType,
|
||||
(int)trackDirectionList,
|
||||
direction,
|
||||
height,
|
||||
(int)tileElement,
|
||||
0 * sizeof(Ride),
|
||||
0x006C4934, _rideType, (int)trackDirectionList, direction, height, (int)tileElement, 0 * sizeof(Ride),
|
||||
trackSequence);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
#include <vector>
|
||||
|
||||
#if defined(__unix__)
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
# include <sys/mman.h>
|
||||
# include <unistd.h>
|
||||
#endif // defined(__unix__)
|
||||
|
||||
#include "Data.h"
|
||||
|
@ -194,11 +194,11 @@ static void Write(const char* fmt, ...)
|
|||
|
||||
#if defined(__WINDOWS__)
|
||||
|
||||
#include <shellapi.h>
|
||||
# include <shellapi.h>
|
||||
|
||||
int main(int argc, char* argv[]);
|
||||
|
||||
#define OPENRCT2_DLL_MODULE_NAME "openrct2.dll"
|
||||
# define OPENRCT2_DLL_MODULE_NAME "openrct2.dll"
|
||||
|
||||
static HMODULE _dllModule = nullptr;
|
||||
|
||||
|
@ -331,17 +331,17 @@ static bool openrct2_setup_rct2_segment()
|
|||
if (err != 0)
|
||||
{
|
||||
err = errno;
|
||||
#ifdef __LINUX__
|
||||
# ifdef __LINUX__
|
||||
// On Linux ENOMEM means all requested range is unmapped
|
||||
if (err != ENOMEM)
|
||||
{
|
||||
pagesMissing = true;
|
||||
perror("mincore");
|
||||
}
|
||||
#else
|
||||
# else
|
||||
pagesMissing = true;
|
||||
perror("mincore");
|
||||
#endif // __LINUX__
|
||||
# endif // __LINUX__
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -55,10 +55,7 @@ protected:
|
|||
{
|
||||
rating_tuple ratings = ride->ratings;
|
||||
std::string line = String::StdFormat(
|
||||
"%s: (%d, %d, %d)",
|
||||
ride_type_get_enum_name(ride->type),
|
||||
(int)ratings.excitement,
|
||||
(int)ratings.intensity,
|
||||
"%s: (%d, %d, %d)", ride_type_get_enum_name(ride->type), (int)ratings.excitement, (int)ratings.intensity,
|
||||
(int)ratings.nausea);
|
||||
return line;
|
||||
}
|
||||
|
|
|
@ -27,23 +27,14 @@ class StringTest : public testing::TestWithParam<TCase>
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
TrimData,
|
||||
StringTest,
|
||||
TrimData, StringTest,
|
||||
testing::Values(
|
||||
// input after Trim after TrimStart
|
||||
TCase("string", "string", "string"),
|
||||
TCase(" string", "string", "string"),
|
||||
TCase("string ", "string", "string "),
|
||||
TCase(" some string ", "some string", "some string "),
|
||||
TCase(" ", "", ""),
|
||||
TCase(" ストリング", "ストリング", "ストリング"),
|
||||
TCase("ストリング ", "ストリング", "ストリング "),
|
||||
TCase(" ストリング ", "ストリング", "ストリング "),
|
||||
TCase(" ", "", ""),
|
||||
TCase("", "", ""),
|
||||
TCase("\n", "", ""),
|
||||
TCase("\n\n\n\r\n", "", ""),
|
||||
TCase("\n\n\n\r\nstring\n\n", "string", "string\n\n")));
|
||||
TCase("string", "string", "string"), TCase(" string", "string", "string"), TCase("string ", "string", "string "),
|
||||
TCase(" some string ", "some string", "some string "), TCase(" ", "", ""),
|
||||
TCase(" ストリング", "ストリング", "ストリング"), TCase("ストリング ", "ストリング", "ストリング "),
|
||||
TCase(" ストリング ", "ストリング", "ストリング "), TCase(" ", "", ""), TCase("", "", ""),
|
||||
TCase("\n", "", ""), TCase("\n\n\n\r\n", "", ""), TCase("\n\n\n\r\nstring\n\n", "string", "string\n\n")));
|
||||
TEST_P(StringTest, Trim)
|
||||
{
|
||||
auto testCase = GetParam();
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
// directly into the test binary.
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <openrct2/core/Guard.hpp>
|
||||
# include <gtest/gtest.h>
|
||||
# include <openrct2/core/Guard.hpp>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue