[HL2DM] UTIL_ImpactTrace
Posted: Wed Apr 22, 2020 5:02 am
While working on Painkiller's request, I tried to hook UTIL_ImpactTrace, but I'm not getting anywhere.
Nothing's being printed with the signature (I'm running this on Windows). So I tried hooking the virtual function instead:
And.. still nothing. Any idea what's going on?
Syntax: Select all
# ../util_impact/util_impact.py
# Source.Python
import core
import memory
from memory import Convention, DataType
from memory.hooks import PreHook
server = memory.find_binary('server')
if core.PLATFORM == 'windows':
identifier = b'\x55\x8B\xEC\x8B\x55\x08\x8B\x4A\x4C'
else:
identifier = '_Z16UTIL_ImpactTraceP10CGameTraceiPKc'
# void UTIL_ImpactTrace(
# trace_t *pTrace, int iDamageType, const char *pCustomImpactName = NULL);
UTIL_ImpactTrace = server[identifier].make_function(
Convention.CDECL,
(DataType.POINTER, DataType.INT, DataType.STRING),
DataType.VOID
)
@PreHook(UTIL_ImpactTrace)
def impact_trace_pre(stack_data):
print(stack_data)
Nothing's being printed with the signature (I'm running this on Windows). So I tried hooking the virtual function instead:
Syntax: Select all
# CBaseEntity::ImpactTrace(CGameTrace*, int, char const*)
[[impact_trace]]
offset_linux = 78
offset_windows = 77
arguments = POINTER, INT, STRING