CPhysicsHook::Init
0x00778530 · 237 bytes · __thiscall
_ZN12CPhysicsHook4InitEv
Decompiled
undefined (1 param)
/* CPhysicsHook::Init() */
undefined4 __thiscall CPhysicsHook::Init(CPhysicsHook *this)
{
void *pvVar1;
factorylist_t local_18 [4];
code *local_14;
FactoryList_Retrieve(local_18);
if (local_14 == (code *)0x0) {
return 0;
}
physics = (*local_14)("VPhysics031",0);
if (((physics != 0) && (physcollision = (*local_14)("VPhysicsCollision007",0), physcollision != 0)
) && (physprops = (IPhysicsSurfaceProps *)(*local_14)("VPhysicsSurfaceProps001",0),
physprops != (IPhysicsSurfaceProps *)0x0)) {
PhysParseSurfaceData(physprops,filesystem);
this[0x59] = (CPhysicsHook)0x1;
*(undefined4 *)(this + 0x54) = 0;
if ((*(int *)(this + 0x44) < 4) && (-1 < *(int *)(this + 0x48))) {
*(undefined4 *)(this + 0x44) = 4;
if (*(void **)(this + 0x40) == (void *)0x0) {
pvVar1 = malloc(0xe50);
*(void **)(this + 0x40) = pvVar1;
}
else {
pvVar1 = realloc(*(void **)(this + 0x40),0xe50);
*(void **)(this + 0x40) = pvVar1;
}
}
else {
pvVar1 = *(void **)(this + 0x40);
}
*(void **)(this + 0x50) = pvVar1;
return 1;
}
return 0;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.