AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Coding MM:S Plugins & SM Extensions (https://forums.alliedmods.net/forumdisplay.php?f=75)
-   -   pointer offset (https://forums.alliedmods.net/showthread.php?t=76477)

AltPluzF4 08-25-2008 08:55

pointer offset
 
A lot of things make use of g_pGameRules, by getting it's offset of CreateGameRulesObject.

I understand how the signature for CreateGameRulesObject is found, but how does one go about getting the offset for g_pGameRules?

Thanks for any info on this.

teame06 08-25-2008 10:13

Re: pointer offset
 
Look at sdktools ext from sourcemod. It make use of getting g_pGameRules.

AltPluzF4 08-25-2008 10:34

Re: pointer offset
 
Yes, that is what I was referring to. They have the offset for g_pGameRules set to 2 in the gamedata text file.

What I'm asking, is how did they come up with that offset of 2?

Thanks for the response though.

DS 08-25-2008 15:38

Re: pointer offset
 
Code:

.text:22188970 8B 0D 84 7A 57 22                      mov    ecx, dword_22577A84
.text:22188976 85 C9                                  test    ecx, ecx
.text:22188978 74 07                                  jz      short loc_22188981
.text:2218897A 8B 01                                  mov    eax, [ecx]
.text:2218897C 6A 01                                  push    1
.text:2218897E FF 50 2C                                call    dword ptr [eax+2Ch]

The above is the beginning of the disassembly for CreateGameRulesObject.

And for quick reference, this is the signature used by SDKTools:
Code:

\x8B\x0D\x2A\x2A\x2A\x2A\x85\xC9\x74\x2A\x8B\x01\x6A\x01\xFF\x50
Two bytes into the signature is a wildcard of four bytes (\x2A). That is intended to be the address of the variable that holds g_pGameRules. That would be dword_22577A84 in the disassembly above.

AltPluzF4 08-25-2008 16:29

Re: pointer offset
 
Alright, I believe I understand now. Thank you.


All times are GMT -4. The time now is 20:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.