Int_Encode
0x00149610 · 195 bytes · __cdecl
_Z10Int_EncodePKhP8DVariantPK8SendPropP8bf_writei
Decompiled
undefined (5 params)
/* Int_Encode(unsigned char const*, DVariant*, SendProp const*, bf_write*, int) */
void Int_Encode(uchar *param_1,DVariant *param_2,SendProp *param_3,bf_write *param_4,int param_5)
{
int iVar1;
int iVar2;
uint uVar3;
uint uVar4;
int iVar5;
uint *puVar6;
iVar2 = *(int *)(param_3 + 0xc);
if (((byte)param_3[0x3c] & 1) == 0) {
bf_write::WriteSBitLong(param_4,*(int *)param_2,iVar2);
return;
}
uVar4 = *(uint *)(param_4 + 0xc);
uVar3 = *(uint *)param_2;
if ((int)(iVar2 + uVar4) <= *(int *)(param_4 + 8)) {
iVar1 = ((int)uVar4 >> 5) * 4;
uVar4 = uVar4 & 0x1f;
puVar6 = (uint *)(iVar1 + *(int *)param_4);
*puVar6 = *puVar6 & (&g_BitWriteMasks)[uVar4 * 0x21 + iVar2] | uVar3 << (sbyte)uVar4;
iVar5 = 0x20 - uVar4;
if (iVar5 < iVar2) {
puVar6 = (uint *)(*(int *)param_4 + 4 + iVar1);
*puVar6 = (&g_BitWriteMasks)[iVar2 - iVar5] & *puVar6 | uVar3 >> ((byte)iVar5 & 0x1f);
}
*(int *)(param_4 + 0xc) = *(int *)(param_4 + 0xc) + iVar2;
return;
}
*(int *)(param_4 + 0xc) = *(int *)(param_4 + 8);
param_4[0x10] = (bf_write)0x1;
return;
}
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.