From d786e57914655924cfb1d8ec2a6797f353e3d9ad Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 17 Sep 2016 23:12:25 +0100 Subject: [PATCH] Move registers struct to common.h So that it can still be used in x64 builds --- src/addresses.h | 53 ------------------------------------------------- src/common.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 34133a555a..a75e36283a 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -647,59 +647,6 @@ static int RCT2_CALLPROC_EBPSAFE(int address) */ int RCT2_CALLFUNC_X(int address, int *_eax, int *_ebx, int *_ecx, int *_edx, int *_esi, int *_edi, int *_ebp); -#pragma pack(push, 1) - -typedef struct registers { - union { - int eax; - short ax; - struct { - char al; - char ah; - }; - }; - union { - int ebx; - short bx; - struct { - char bl; - char bh; - }; - }; - union { - int ecx; - short cx; - struct { - char cl; - char ch; - }; - }; - union { - int edx; - short dx; - struct { - char dl; - char dh; - }; - }; - union { - int esi; - short si; - }; - union { - int edi; - short di; - }; - union { - int ebp; - short bp; - }; -} registers; - -assert_struct_size(registers, 7 * 4); - -#pragma pack(pop) - static int RCT2_CALLFUNC_Y(int address, registers *inOut) { return RCT2_CALLFUNC_X(address, &inOut->eax, &inOut->ebx, &inOut->ecx, &inOut->edx, &inOut->esi, &inOut->edi, &inOut->ebp); diff --git a/src/common.h b/src/common.h index 2c3fb763a7..3b69933f3a 100644 --- a/src/common.h +++ b/src/common.h @@ -89,4 +89,57 @@ #define FASTCALL #endif // PLATFORM_X86 +/** + * x86 register structure, only used for easy interop to RCT2 code. + */ +#pragma pack(push, 1) +typedef struct registers { + union { + int eax; + short ax; + struct { + char al; + char ah; + }; + }; + union { + int ebx; + short bx; + struct { + char bl; + char bh; + }; + }; + union { + int ecx; + short cx; + struct { + char cl; + char ch; + }; + }; + union { + int edx; + short dx; + struct { + char dl; + char dh; + }; + }; + union { + int esi; + short si; + }; + union { + int edi; + short di; + }; + union { + int ebp; + short bp; + }; +} registers; +assert_struct_size(registers, 7 * 4); +#pragma pack(pop) + #endif