g_pGameRules question
Ok, I've found the game rules via scanning (HL2MP). What am I supposed to do next? I need to hook some functions, and have tried and gotten an error reading that address. Maybe I've scanned for the wrong address, but I want to make sure that I'm thinking right so I can know when I get the right one.
Let's say I want to hook CGameRules:: DeathNotice Assuming I scan for the g_pGameRules correctly, I use the following to hook that function: Code:
SH_ADD_HOOK_MEMFUNC ( CGameRules, DeathNotice, g_pMyGameRules, &gPlugin, &CPlugin::MyDeathNotice, PRE ); And no, I'm not using SDK tools... |
Re: g_pGameRules question
This is how I hook gamerules (in TF2). I basically hook by virtual table index. One of functions I hook in TF2 from CTFGameRules class is FlPlayerFallDamage (returns a float or amount of fall damage taken).
Code:
58 CTFGameRules::FlPlayerFallDamage(CBasePlayer *) Code:
SH_DECL_MANUALHOOK1(GR_FlPlayerFallDamage, 58, 0, 0, float, CBasePlayer*); Code:
//to hook Hope that helps. |
Re: g_pGameRules question
Ok, that makes complete sense to me now. Dumping the vtable for the game rules. And I've gone through the binaries over and over again, and I'm 99.9% certain I have the correct address for the gamerules. When I try to access them in any way I get
Quote:
|
Re: g_pGameRules question
Quote:
Code:
CGameRules *g_pGameRules = NULL; Code:
CGameRules *CSignatures::GetGameRules() |
Re: g_pGameRules question
Ok, I already hook another variable, so I know the code works. It definitely doesn't crash on Linux. I guess my 99.9% was just that ... not a sure thing. I'll look for the sig again tomorrow and see if I can't make some progress in the windows world.
EDIT: While my linux side doesn't crash, none of the hooks are being called either. I'm going back to square one to try and figure this out. |
Re: g_pGameRules question
You don't need a signature to obtain the gamerules fyi.
Find the "tf_gamerules" entity, when it spawns: Code:
ServerClass *pServerClass = SH_MCALL(BaseEntity(), GetServerClass)(); |
Re: g_pGameRules question
ooooooooh, saixy. I'll give that a shot. Thanks!
|
All times are GMT -4. The time now is 16:34. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.