Skip to content

Commit

Permalink
Manaully hook CBaseClient__ActivatePlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
ASpoonPlaysGames committed Sep 8, 2024
1 parent 2e38da5 commit 5d6a747
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions primedev/server/auth/serverauthentication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,8 @@ h_CBaseClient__Connect(CBaseClient* self, char* pName, void* pNetChannel, char b
return true;
}

// clang-format off
AUTOHOOK(CBaseClient__ActivatePlayer, engine.dll + 0x100F80,
void,, (CBaseClient* self))
// clang-format on
static void (*o_pCBaseClient__ActivatePlayer)(CBaseClient* self) = nullptr;
static void h_CBaseClient__ActivatePlayer(CBaseClient* self)
{
// if we're authed, write our persistent data
// RemovePlayerAuthData returns true if it removed successfully, i.e. on first call only, and we only want to write on >= second call
Expand All @@ -309,7 +307,7 @@ void,, (CBaseClient* self))
g_pServerPresence->SetPlayerCount((int)g_pServerAuthentication->m_PlayerAuthenticationData.size());
}

CBaseClient__ActivatePlayer(self);
o_pCBaseClient__ActivatePlayer(self);
}

// clang-format off
Expand Down Expand Up @@ -369,6 +367,9 @@ ON_DLL_LOAD_RELIESON("engine.dll", ServerAuthentication, (ConCommand, ConVar), (
o_pCBaseClient__Connect = module.Offset(0x101740).RCast<decltype(o_pCBaseClient__Connect)>();
HookAttach(&(PVOID&)o_pCBaseClient__Connect, (PVOID)h_CBaseClient__Connect);

o_pCBaseClient__ActivatePlayer = module.Offset(0x100F80).RCast<decltype(o_pCBaseClient__ActivatePlayer)>();
HookAttach(&(PVOID&)o_pCBaseClient__ActivatePlayer, (PVOID)h_CBaseClient__ActivatePlayer);

g_pServerAuthentication = new ServerAuthenticationManager;

g_pServerAuthentication->Cvar_ns_erase_auth_info =
Expand Down

0 comments on commit 5d6a747

Please sign in to comment.