Added mac support to CDetour.

This commit is contained in:
Asher Baker 2011-07-19 18:48:39 +01:00
parent 4e27d991b5
commit 491c995393

View File

@ -32,7 +32,7 @@
#ifndef _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
#define _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
#if defined PLATFORM_LINUX
#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