Skip to content

Commit a222b63

Browse files
committed
Server: Add Windows signature for g_pGameRules
1 parent 2268b5d commit a222b63

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
@@ -843,6 +843,28 @@ void StartFrame(void)
843843
g_ulFrameCount++;
844844
}
845845

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

0 commit comments

Comments
 (0)