Move Safetyhook mess into a mirror repo (#2163)
* Bring in safetyhook mirror repo * Add proper submodule * Update submodule for linux fixes * Update submodule again * Change the method of compiling safetyhook (#2167) Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com> * Update submodule * Update submodule for -fPIC --------- Co-authored-by: Benoist <14257866+Kenzzer@users.noreply.github.com> Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
This commit is contained in:
parent
11d3cf94f7
commit
d42a8c7c1e
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -9,3 +9,6 @@
|
||||
[submodule "hl2sdk-manifests"]
|
||||
path = hl2sdk-manifests
|
||||
url = https://github.com/alliedmodders/hl2sdk-manifests.git
|
||||
[submodule "public/safetyhook"]
|
||||
path = public/safetyhook
|
||||
url = https://github.com/alliedmodders/safetyhook
|
||||
|
@ -55,6 +55,7 @@ class SMConfig(object):
|
||||
self.target_archs = set()
|
||||
self.enable_asan = getattr(builder.options, 'enable_asan', False)
|
||||
self.asan_libs = {}
|
||||
self.libsafetyhook = {}
|
||||
|
||||
if builder.options.targets:
|
||||
target_archs = builder.options.targets.split(',')
|
||||
@ -522,13 +523,14 @@ class SMConfig(object):
|
||||
|
||||
def AddCDetour(self, binary):
|
||||
public_path = os.path.join(builder.sourcePath, 'public')
|
||||
binary.sources += [
|
||||
os.path.join(public_path, 'CDetour', 'detours.cpp'),
|
||||
os.path.join(public_path, 'safetyhook', 'safetyhook.cpp'),
|
||||
os.path.join(public_path, 'safetyhook', 'Zydis.c')
|
||||
]
|
||||
binary.compiler.cxxincludes += [ os.path.join(public_path, 'safetyhook') ]
|
||||
binary.compiler.includes += [ os.path.join(public_path, 'safetyhook') ]
|
||||
binary.sources += [ os.path.join(public_path, 'CDetour', 'detours.cpp') ]
|
||||
binary.compiler.cxxincludes += [ os.path.join(public_path, 'safetyhook', 'include') ]
|
||||
|
||||
for task in self.libsafetyhook:
|
||||
if task.target.arch == binary.compiler.target.arch:
|
||||
binary.compiler.linkflags += [task.binary]
|
||||
return
|
||||
raise Exception('No suitable build of safetyhook was found.')
|
||||
|
||||
def HL2Library(self, context, compiler, name, sdk):
|
||||
binary = self.Library(context, compiler, name)
|
||||
@ -578,6 +580,16 @@ if SM.use_auto_versioning():
|
||||
{ 'SM': SM }
|
||||
)
|
||||
|
||||
class SafetyHookShim(object):
|
||||
def __init__(self):
|
||||
self.all_targets = {}
|
||||
self.libsafetyhook = {}
|
||||
|
||||
SafetyHook = SafetyHookShim()
|
||||
SafetyHook.all_targets = SM.all_targets
|
||||
builder.Build('public/safetyhook/AMBuilder', {'SafetyHook': SafetyHook })
|
||||
SM.libsafetyhook = SafetyHook.libsafetyhook
|
||||
|
||||
class SPRoot(object):
|
||||
def __init__(self):
|
||||
self.generated_headers = SM.generated_headers
|
||||
|
@ -32,7 +32,7 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_DETOURS_H_
|
||||
#define _INCLUDE_SOURCEMOD_DETOURS_H_
|
||||
|
||||
#include "../safetyhook/safetyhook.hpp"
|
||||
#include "safetyhook.hpp"
|
||||
#include <smsdk_ext.h>
|
||||
|
||||
#define DETOUR_MEMBER_CALL(name) (this->*name##_Actual)
|
||||
|
1
public/safetyhook
Submodule
1
public/safetyhook
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 29d1c73cfae68f8cb7d297205d87579a23bd902a
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user