Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Relevant functions for smokes (as an example, other grenades work similarly)
- - Hooking via _ZN13CSmokeGrenade11EmitGrenadeE6Vector6QAngleS0_S0_P11CBasePlayerRK13CCSWeaponInfo
- - Throwing via _ZN23CSmokeGrenadeProjectile6CreateERK6VectorRK6QAngleS2_S2_P20CBaseCombatCharacterRK13CCSWeaponInfo
- - The last WeaponInfo arg can be gotten from calling _Z13GetWeaponInfo10CSWeaponID
- What's the problem? Normally gamedata can just use the debug symbols above, but Valve removed those debug symbols late 2016. Normal sigscanning techniques on IDA with makesig.idc (https://github.com/alliedmodders/sourcemod/blob/master/tools/ida_scripts/makesig.idc) work for the *::Create functions, but not the *::EmitGrenade functions. Why? All the throw functions are similar, and differ mostly in calling another function, so the only difference is an address that has to get wildcarded to not break every update.
- Take a look at the smoke emit function as an example:
- .text:0044DA00 ; CSmokeGrenade::EmitGrenade(Vector, QAngle, Vector, Vector, CBasePlayer *, CCSWeaponInfo const&)
- .text:0044DA00 _ZN13CSmokeGrenade11EmitGrenadeE6Vector6QAngleS0_S0_P11CBasePlayerRK13CCSWeaponInfo proc near
- .text:0044DA00
- .text:0044DA00 arg_4 = byte ptr 0Ch
- .text:0044DA00 arg_10 = byte ptr 18h
- .text:0044DA00 arg_1C = byte ptr 24h
- .text:0044DA00 arg_28 = byte ptr 30h
- .text:0044DA00 arg_34 = dword ptr 3Ch
- .text:0044DA00 arg_38 = dword ptr 40h
- .text:0044DA00
- .text:0044DA00 55 push ebp
- .text:0044DA01 89 E5 mov ebp, esp
- .text:0044DA03 83 EC 28 sub esp, 28h
- .text:0044DA06 8B 45 40 mov eax, [ebp+arg_38]
- .text:0044DA09 89 44 24 14 mov [esp+14h], eax
- .text:0044DA0D 8B 45 3C mov eax, [ebp+arg_34]
- .text:0044DA10 89 44 24 10 mov [esp+10h], eax
- .text:0044DA14 8D 45 30 lea eax, [ebp+arg_28]
- .text:0044DA17 89 44 24 0C mov [esp+0Ch], eax
- .text:0044DA1B 8D 45 24 lea eax, [ebp+arg_1C]
- .text:0044DA1E 89 44 24 08 mov [esp+8], eax
- .text:0044DA22 8D 45 18 lea eax, [ebp+arg_10]
- .text:0044DA25 89 44 24 04 mov [esp+4], eax
- .text:0044DA29 8D 45 0C lea eax, [ebp+arg_4]
- .text:0044DA2C 89 04 24 mov [esp], eax
- .text:0044DA2F E8 FC E1 FD FF call _ZN23CSmokeGrenadeProjectile6CreateERK6VectorRK6QAngleS2_S2_P20CBaseCombatCharacterRK13CCSWeaponInfo ; CSmokeGrenadeProjectile::Create(Vector const&,QAngle const&,Vector const&,Vector const&,CBaseCombatCharacter *,CCSWeaponInfo const&)
- .text:0044DA34 C9 leave
- .text:0044DA35 C3 retn
- The flash emit is identical but with a different address in the call instruction.
- Since this clearly calls the ::Create function, I imagine you could just hook (aka create a detour) on ::Create, but I haven't managed to get that to work, so I detoured ::Emit, but getting gamedata for that isn't feasible anymore.
- FYI, the latest sigs I've gotten are:
- _Z13GetWeaponInfo10CSWeaponID: \x55\x89\xE5\x56\x53\x31\xDB\x83\xEC\x10\x8B\x55\x08\x85\xD2
- _ZN23CSmokeGrenadeProjectile6CreateERK6VectorRK6QAngleS2_S2_P20CBaseCombatCharacterRK13CCSWeaponInfo: \x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\x8B\x45\x0C\xC7\x04\x24\x2A\x2A\x2A\x2A\x8B\x7D\x18
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement