Add platform define for x86

This commit is contained in:
Michał Janiszewski 2016-04-21 22:18:59 +02:00
parent b499a4589f
commit 288d11a196
2 changed files with 14 additions and 2 deletions

View File

@ -12,7 +12,8 @@
int DISABLE_OPT RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _edx, int _esi, int _edi, int _ebp) int DISABLE_OPT RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _edx, int _esi, int _edi, int _ebp)
{ {
int result; int result = 0;
#ifdef PLATFORM_X86
#ifdef _MSC_VER #ifdef _MSC_VER
__asm { __asm {
push ebp push ebp
@ -56,13 +57,15 @@ int DISABLE_OPT RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _
: "eax","ecx","edx","esi","edi","memory" : "eax","ecx","edx","esi","edi","memory"
); );
#endif #endif
#endif // PLATFORM_X86
// lahf only modifies ah, zero out the rest // lahf only modifies ah, zero out the rest
return result & 0xFF00; return result & 0xFF00;
} }
int DISABLE_OPT RCT2_CALLFUNC_X(int address, int *_eax, int *_ebx, int *_ecx, int *_edx, int *_esi, int *_edi, int *_ebp) int DISABLE_OPT RCT2_CALLFUNC_X(int address, int *_eax, int *_ebx, int *_ecx, int *_edx, int *_esi, int *_edi, int *_ebp)
{ {
int result; int result = 0;
#ifdef PLATFORM_X86
#ifdef _MSC_VER #ifdef _MSC_VER
__asm { __asm {
// Store C's base pointer // Store C's base pointer
@ -207,6 +210,7 @@ int DISABLE_OPT RCT2_CALLFUNC_X(int address, int *_eax, int *_ebx, int *_ecx, in
: "eax","ecx","edx","esi","edi","memory" : "eax","ecx","edx","esi","edi","memory"
); );
#endif #endif
#endif // PLATFORM_X86
// lahf only modifies ah, zero out the rest // lahf only modifies ah, zero out the rest
return result & 0xFF00; return result & 0xFF00;
} }

View File

@ -34,6 +34,11 @@
#endif #endif
#define abstract = 0 #define abstract = 0
#if defined(__i386__) || defined(_M_I86)
#define PLATFORM_X86
#endif
#ifdef PLATFORM_X86
#ifdef __GNUC__ #ifdef __GNUC__
#define FASTCALL __attribute__((fastcall)) #define FASTCALL __attribute__((fastcall))
#elif _MSC_VER #elif _MSC_VER
@ -42,5 +47,8 @@
#pragma message "Not using fastcall calling convention, please check your compiler support" #pragma message "Not using fastcall calling convention, please check your compiler support"
#define FASTCALL #define FASTCALL
#endif #endif
#else // PLATFORM_X86
#define FASTCALL
#endif // PLATFORM_X86
#endif #endif