Skip to content

Commit 4e6d2d7

Browse files
authored
Merge pull request #267 from tmp64/feature/amxx-gamerules-signature
Server: Add Windows signature for g_pGameRules
2 parents b6d9dae + a222b63 commit 4e6d2d7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/game/server/client.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,28 @@ void StartFrame(void)
848848
g_ulFrameCount++;
849849
}
850850

851+
#ifdef PLATFORM_WINDOWS
852+
853+
// Signature for g_pGameRules in AMXX
854+
// Exported so the function is not removed by the linker
855+
DLL_EXPORT __declspec(naked) void BHL_Signature_g_pGameRules()
856+
{
857+
// AMXX signature
858+
// "windows" "\x8B\x2A\x2A\x2A\x2A\x2A\x85\x2A\x74\x2A\x8B\x2A\xFF\x2A\x2A\xA1" // StartFrame()
859+
__asm
860+
{
861+
mov ecx, g_pGameRules // 8B xx xx xx xx xx
862+
test ecx,ecx // 85 xx
863+
jz short jump_label // 74 xx
864+
mov eax, [ecx] // 8B xx
865+
call dword ptr [eax+4] // FF xx xx
866+
jump_label:
867+
_emit 0xA1 // A1
868+
}
869+
}
870+
871+
#endif
872+
851873
void ClientPrecache(void)
852874
{
853875
// setup precaches always needed

0 commit comments

Comments
 (0)