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 <[email protected]>

* Update submodule

* Update submodule for -fPIC

---------

Co-authored-by: Benoist <[email protected]>
Co-authored-by: Kenzzer <[email protected]>
This commit is contained in:
Headline
2024-06-08 20:05:29 +00:00
committed by GitHub
co-authored by Kenzzer Benoist
parent 11d3cf94f7
commit d42a8c7c1e
9 changed files with 24 additions and 71419 deletions
+3
View File
@@ -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
+19 -7
View File
@@ -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
+1 -1
View File
@@ -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
Submodule public/safetyhook added at 29d1c73cfa
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