mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-06 18:08:36 +00:00
Add safetyhook to load logic
This commit is contained in:
parent
ccaf7f2f44
commit
2a1bb88e90
@ -676,6 +676,19 @@ void CoreProviderImpl::InitializeBridge()
|
||||
bool CoreProviderImpl::LoadBridge(char *error, size_t maxlength)
|
||||
{
|
||||
char file[PLATFORM_MAX_PATH];
|
||||
char myerror[255];
|
||||
|
||||
/* Load safetyhook first. The core & extensions might depend on it */
|
||||
g_SMAPI->PathFormat(file,
|
||||
sizeof(file),
|
||||
"%s/bin/" PLATFORM_ARCH_FOLDER "safetyhook." PLATFORM_LIB_EXT,
|
||||
g_SourceMod.GetSourceModPath());
|
||||
|
||||
safetyhook_ = ke::SharedLib::Open(file, myerror, sizeof(myerror));
|
||||
if (!safetyhook_) {
|
||||
ke::SafeSprintf(error, maxlength, "failed to load %s: %s", file, myerror);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Now it's time to load the logic binary */
|
||||
g_SMAPI->PathFormat(file,
|
||||
@ -683,7 +696,6 @@ bool CoreProviderImpl::LoadBridge(char *error, size_t maxlength)
|
||||
"%s/bin/" PLATFORM_ARCH_FOLDER "sourcemod.logic." PLATFORM_LIB_EXT,
|
||||
g_SourceMod.GetSourceModPath());
|
||||
|
||||
char myerror[255];
|
||||
logic_ = ke::SharedLib::Open(file, myerror, sizeof(myerror));
|
||||
if (!logic_) {
|
||||
ke::SafeSprintf(error, maxlength, "failed to load %s: %s", file, myerror);
|
||||
|
||||
@ -76,6 +76,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
ke::RefPtr<ke::SharedLib> safetyhook_;
|
||||
ke::RefPtr<ke::SharedLib> logic_;
|
||||
LogicInitFunction logic_init_;
|
||||
GameHooks hooks_;
|
||||
|
||||
@ -50,6 +50,13 @@ helpers = SM.package_helpers
|
||||
helpers.builder = builder
|
||||
folder_map = helpers.CreateFolders(folder_list)
|
||||
|
||||
# Copy safetyhook
|
||||
for cxx_task in SM.libsafetyhook:
|
||||
if cxx_task.target.arch == 'x86_64' in cxx_task.binary.path:
|
||||
builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/bin/x64'])
|
||||
else:
|
||||
builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/bin'])
|
||||
|
||||
# Copy binaries.
|
||||
for cxx_task in SM.binaries:
|
||||
# mms expects our loader (sourcemod_mm) to exist in /bin/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user