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:
parent
9a35085ac3
commit
e518605d69
@ -51,7 +51,7 @@
|
||||
#include "ConCommandBaseIterator.h"
|
||||
#include "ShareSys.h"
|
||||
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_POSIX
|
||||
# include <dlfcn.h>
|
||||
# include <sys/mman.h>
|
||||
# include <stdint.h>
|
||||
|
@ -153,7 +153,7 @@ void CHalfLife2::OnSourceModAllInitialized_Post()
|
||||
return;
|
||||
}
|
||||
g_EntList = *reinterpret_cast<void **>(addr + offset);
|
||||
#elif defined PLATFORM_LINUX
|
||||
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
/* gEntList and/or g_pEntityList */
|
||||
if (!g_pGameConf->GetMemSig("gEntList", (void **)&addr))
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ bool LibrarySystem::IsPathDirectory(const char *path)
|
||||
return true;
|
||||
}
|
||||
|
||||
#elif defined PLATFORM_LINUX
|
||||
#elif defined PLATFORM_POSIX
|
||||
struct stat s;
|
||||
|
||||
if (stat(path, &s) != 0)
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "sm_crc32.h"
|
||||
#include "MemoryUtils.h"
|
||||
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_POSIX
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
@ -523,7 +523,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
s_TempSig.library,
|
||||
m_CurFile);
|
||||
} else {
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_POSIX
|
||||
if (s_TempSig.sig[0] == '@')
|
||||
{
|
||||
Dl_info info;
|
||||
@ -570,7 +570,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_POSIX
|
||||
skip_find:
|
||||
#endif
|
||||
m_Sigs.replace(m_offset, final_addr);
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
#if defined PLATFORM_WINDOWS
|
||||
#include <windows.h>
|
||||
#elif defined PLATFORM_LINUX
|
||||
#elif defined PLATFORM_POSIX
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/times.h>
|
||||
@ -407,7 +407,7 @@ static cell_t GetSysTickCount(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
#if defined PLATFORM_WINDOWS
|
||||
return (cell_t)GetTickCount();
|
||||
#elif defined PLATFORM_LINUX
|
||||
#elif defined PLATFORM_POSIX
|
||||
tms tm;
|
||||
clock_t ticks = times(&tm);
|
||||
long ticks_per_sec = sysconf(_SC_CLK_TCK);
|
||||
@ -419,9 +419,6 @@ static cell_t GetSysTickCount(IPluginContext *pContext, const cell_t *params)
|
||||
fticks -= r;
|
||||
}
|
||||
return (cell_t)fticks;
|
||||
#elif defined PLATFORM_APPLE
|
||||
assert(false);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
//Note: Do not add this to Linux yet, i haven't done the HPET timing research (if even available)
|
||||
//nonetheless we need accurate counting
|
||||
#if !defined PLATFORM_LINUX
|
||||
#if !defined PLATFORM_LINUX && !defined PLATFORM_APPLE
|
||||
|
||||
struct Profiler
|
||||
{
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user