Skip to content

Commit

Permalink
fix breakage introduced by recent release of dhooks. shared namespace…
Browse files Browse the repository at this point in the history
… sucks!
  • Loading branch information
ldesgoui committed Oct 17, 2020
1 parent c6b511c commit fce26d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions scripting/tf2-comp-fixes/common.sp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#define HOOK_PRE (false)
#define HOOK_POST (true)

#if !defined INVALID_HOOK_ID
#define INVALID_HOOK_ID (-1)
#endif

#define MAXENTITIES (2048)

Expand Down
8 changes: 4 additions & 4 deletions scripting/tf2-comp-fixes/tournament-end-ignores-whitelist.sp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ static void OnConVarChange(ConVar cvar, const char[] before, const char[] after)

static void EnableHook() {
g_hook_id_pre =
DHookGamerules(g_detour_CTeamplayRoundBasedRules_RestartTournament, HOOK_PRE, _, Hook_Pre);
DHookGamerules(g_detour_CTeamplayRoundBasedRules_RestartTournament, HOOK_PRE, _, Hook_RestartTournament_Pre);

if (g_hook_id_pre == -1) {
SetFailState("Failed to hook CTeamplayRoundBasedRules::RestartTournament");
}

g_hook_id_post = DHookGamerules(g_detour_CTeamplayRoundBasedRules_RestartTournament, HOOK_POST,
_, Hook_Post);
_, Hook_RestartTournament_Post);

if (g_hook_id_post == -1) {
DisableHook();
Expand All @@ -75,13 +75,13 @@ static void DisableHook() {
}
}

static MRESReturn Hook_Pre(Address self) {
static MRESReturn Hook_RestartTournament_Pre(Address self) {
DHookEnableDetour(g_detour_CEconItemSystem_ReloadWhitelist, HOOK_PRE, Detour_Pre);

return MRES_Handled;
}

static MRESReturn Hook_Post(Address self) {
static MRESReturn Hook_RestartTournament_Post(Address self) {
DHookDisableDetour(g_detour_CEconItemSystem_ReloadWhitelist, HOOK_PRE, Detour_Pre);

return MRES_Handled;
Expand Down

0 comments on commit fce26d2

Please sign in to comment.