Fixed various areas where code was being compiled for Linux only, but should actually be used on OS X too (bug 4392, r=dvander).
This commit is contained in:
@@ -52,7 +52,7 @@ struct patch_t
|
||||
|
||||
inline void ProtectMemory(void *addr, int length, int prot)
|
||||
{
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_POSIX
|
||||
void *addr2 = (void *)ALIGN(addr);
|
||||
mprotect(addr2, sysconf(_SC_PAGESIZE), prot);
|
||||
#elif defined PLATFORM_WINDOWS
|
||||
|
||||
@@ -124,7 +124,7 @@ bool EntityOutputManager::CreateFireEventDetour()
|
||||
|
||||
IA32_Push_Reg(jit, REG_ECX);
|
||||
|
||||
#elif defined PLATFORM_LINUX
|
||||
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
IA32_Push_Rm_Disp8_ESP(jit, 20);
|
||||
IA32_Push_Rm_Disp8_ESP(jit, 20);
|
||||
IA32_Push_Rm_Disp8_ESP(jit, 20);
|
||||
@@ -136,7 +136,7 @@ bool EntityOutputManager::CreateFireEventDetour()
|
||||
IA32_Write_Jump32_Abs(jit, call, (void *)TempDetour);
|
||||
|
||||
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
IA32_Add_Rm_Imm8(jit, REG_ESP, 4, MOD_REG); //add esp, 4
|
||||
#elif defined PLATFORM_WINDOWS
|
||||
IA32_Pop_Reg(jit, REG_ECX);
|
||||
|
||||
@@ -116,7 +116,7 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p
|
||||
char *sig;
|
||||
pContext->LocalToString(params[2], &sig);
|
||||
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_POSIX
|
||||
if (sig[0] == '@')
|
||||
{
|
||||
Dl_info info;
|
||||
|
||||
@@ -54,7 +54,7 @@ void InitializeValveGlobals()
|
||||
return;
|
||||
}
|
||||
g_pGameRules = *reinterpret_cast<void ***>(addr + offset);
|
||||
#elif defined PLATFORM_LINUX
|
||||
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
/* g_pGameRules */
|
||||
if (!g_pGameConf->GetMemSig("g_pGameRules", (void **)&addr) || !addr)
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ int busy_handler(void *unused1, int unused2)
|
||||
{
|
||||
#if defined PLATFORM_WINDOWS
|
||||
Sleep(100);
|
||||
#elif defined PLATFORM_LINUX
|
||||
#elif defined PLATFORM_POSIX
|
||||
usleep(100000);
|
||||
#endif
|
||||
return 1;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
||||
#define _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
||||
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
#if defined PLATFORM_POSIX
|
||||
#include <sys/mman.h>
|
||||
#define PAGE_SIZE 4096
|
||||
#define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
|
||||
@@ -52,7 +52,7 @@ struct patch_t
|
||||
|
||||
inline void ProtectMemory(void *addr, int length, int prot)
|
||||
{
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_POSIX
|
||||
void *addr2 = (void *)ALIGN(addr);
|
||||
mprotect(addr2, sysconf(_SC_PAGESIZE), prot);
|
||||
#elif defined PLATFORM_WINDOWS
|
||||
|
||||
Reference in New Issue
Block a user