Skip to content

Commit

Permalink
Use null instead of INVALID_FUNCTION (SM1.12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alienmario committed Nov 2, 2024
1 parent 6225dd7 commit a8b5839
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripting/include/srccoop/utils.inc
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ stock Address GetInterface(GameData pGameConfig, const char[] szLibrary, const c
// DHooks utils
//------------------------------------------------------
#if defined _dhooks_included
stock void LoadDHookDetour(GameData pGameConfig, DynamicDetour& pHandle, const char[] szFuncName, DHookCallback pCallbackPre = INVALID_FUNCTION, DHookCallback pCallbackPost = INVALID_FUNCTION)
stock void LoadDHookDetour(GameData pGameConfig, DynamicDetour& pHandle, const char[] szFuncName, DHookCallback pCallbackPre = null, DHookCallback pCallbackPost = null)
{
pHandle = DynamicDetour.FromConf(pGameConfig, szFuncName);
if (pHandle == null)
if (!pHandle)
SetFailState("Couldn't create hook %s", szFuncName);
if (pCallbackPre != INVALID_FUNCTION && !pHandle.Enable(Hook_Pre, pCallbackPre))
if (pCallbackPre && !pHandle.Enable(Hook_Pre, pCallbackPre))
SetFailState("Couldn't enable pre detour hook %s", szFuncName);
if (pCallbackPost != INVALID_FUNCTION && !pHandle.Enable(Hook_Post, pCallbackPost))
if (pCallbackPost && !pHandle.Enable(Hook_Post, pCallbackPost))
SetFailState("Couldn't enable post detour hook %s", szFuncName);
}

Expand Down

0 comments on commit a8b5839

Please sign in to comment.