Add x64 Windows support to DHooks (#2154)

* Add x64 Windows support

* undo changes of hook.cpp

* undo changes of hook.h

* undo changes of extension.cpp

* undo changes of listeners.cpp

* undo changes of signatures.cpp

* fix dhooks on x86

* Fix-up dhooks buildscript

---------

Co-authored-by: Kenzzer <[email protected]>
This commit is contained in:
Benoist
2024-09-10 23:26:30 +00:00
committed by GitHub
co-authored by Kenzzer
parent 4e6d66b721
commit 4e15a92984
11 changed files with 283 additions and 100 deletions
+8
View File
@@ -338,6 +338,7 @@ cell_t Native_AddParam(IPluginContext *pContext, const cell_t *params)
// native bool:DHookEnableDetour(Handle:setup, bool:post, DHookCallback:callback);
cell_t Native_EnableDetour(IPluginContext *pContext, const cell_t *params)
{
#if defined( DHOOKS_DYNAMIC_DETOUR )
HookSetup *setup;
if (!GetHandleIfValidOrError(g_HookSetupHandle, (void **)&setup, pContext, params[1]))
@@ -377,11 +378,15 @@ cell_t Native_EnableDetour(IPluginContext *pContext, const cell_t *params)
// Add the plugin callback to the map.
return AddDetourPluginHook(hookType, pDetour, setup, callback);
#else
return pContext->ThrowNativeError("Dynamic detours are not enabled for this mod!");
#endif
}
// native bool:DHookDisableDetour(Handle:setup, bool:post, DHookCallback:callback);
cell_t Native_DisableDetour(IPluginContext *pContext, const cell_t *params)
{
#if defined( DHOOKS_DYNAMIC_DETOUR )
HookSetup *setup;
if (!GetHandleIfValidOrError(g_HookSetupHandle, (void **)&setup, pContext, params[1]))
@@ -414,6 +419,9 @@ cell_t Native_DisableDetour(IPluginContext *pContext, const cell_t *params)
// Remove the callback from the hook.
return RemoveDetourPluginHook(hookType, pDetour, callback);
#else
return pContext->ThrowNativeError("Dynamic detours are not enabled for this mod!");
#endif
}
cell_t HookEntityImpl(IPluginContext *pContext, const cell_t *params, uint32_t callbackIndex, uint32_t removalcbIndex)