Added mac support to CDetour.
This commit is contained in:
parent
4e27d991b5
commit
491c995393
@ -32,7 +32,7 @@
|
|||||||
#ifndef _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
#ifndef _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
||||||
#define _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
#define _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
||||||
|
|
||||||
#if defined PLATFORM_LINUX
|
#if defined PLATFORM_POSIX
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#define PAGE_SIZE 4096
|
#define PAGE_SIZE 4096
|
||||||
#define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
|
#define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
|
||||||
@ -52,7 +52,7 @@ struct patch_t
|
|||||||
|
|
||||||
inline void ProtectMemory(void *addr, int length, int prot)
|
inline void ProtectMemory(void *addr, int length, int prot)
|
||||||
{
|
{
|
||||||
#if defined PLATFORM_LINUX
|
#if defined PLATFORM_POSIX
|
||||||
void *addr2 = (void *)ALIGN(addr);
|
void *addr2 = (void *)ALIGN(addr);
|
||||||
mprotect(addr2, sysconf(_SC_PAGESIZE), prot);
|
mprotect(addr2, sysconf(_SC_PAGESIZE), prot);
|
||||||
#elif defined PLATFORM_WINDOWS
|
#elif defined PLATFORM_WINDOWS
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user