bf_write::WriteSBitLong
0x00097ca0 · 381 bytes · __thiscall
_ZN8bf_write13WriteSBitLongEii
Decompiled
undefined (3 params)
/* bf_write::WriteSBitLong(int, int) */
void __thiscall bf_write::WriteSBitLong(bf_write *this,int param_1,int param_2)
{
int iVar1;
uint uVar2;
uint uVar3;
int iVar4;
int iVar5;
byte *pbVar6;
uint *puVar7;
iVar4 = param_2 + -1;
uVar2 = *(uint *)(this + 0xc);
iVar1 = *(int *)(this + 8);
if (param_1 < 0) {
if ((int)(iVar4 + uVar2) <= iVar1) {
uVar3 = uVar2 & 0x1f;
iVar1 = ((int)uVar2 >> 5) * 4;
puVar7 = (uint *)(iVar1 + *(int *)this);
iVar5 = 0x20 - uVar3;
*puVar7 = param_1 + 0x80000000U << (sbyte)uVar3 |
(&g_BitWriteMasks)[uVar3 * 0x21 + iVar4] & *puVar7;
if (iVar5 < iVar4) {
puVar7 = (uint *)(*(int *)this + 4 + iVar1);
*puVar7 = (&g_BitWriteMasks)[iVar4 - iVar5] & *puVar7 |
param_1 + 0x80000000U >> ((byte)iVar5 & 0x1f);
}
iVar4 = iVar4 + *(int *)(this + 0xc);
*(int *)(this + 0xc) = iVar4;
if (iVar4 < *(int *)(this + 8)) {
if (this[0x10] == (bf_write)0x0) {
pbVar6 = (byte *)((iVar4 >> 3) + *(int *)this);
*pbVar6 = *pbVar6 | (byte)(1 << ((byte)iVar4 & 7));
*(int *)(this + 0xc) = *(int *)(this + 0xc) + 1;
}
return;
}
goto LAB_00097d73;
}
}
else if ((int)(iVar4 + uVar2) <= iVar1) {
iVar1 = ((int)uVar2 >> 5) * 4;
uVar2 = uVar2 & 0x1f;
puVar7 = (uint *)(*(int *)this + iVar1);
iVar5 = 0x20 - uVar2;
*puVar7 = param_1 << (sbyte)uVar2 | (&g_BitWriteMasks)[uVar2 * 0x21 + iVar4] & *puVar7;
if (iVar5 < iVar4) {
puVar7 = (uint *)(*(int *)this + 4 + iVar1);
*puVar7 = (&g_BitWriteMasks)[iVar4 - iVar5] & *puVar7 | (uint)param_1 >> ((byte)iVar5 & 0x1f);
}
iVar4 = iVar4 + *(int *)(this + 0xc);
*(int *)(this + 0xc) = iVar4;
if (iVar4 < *(int *)(this + 8)) {
if (this[0x10] != (bf_write)0x0) {
return;
}
pbVar6 = (byte *)((iVar4 >> 3) + *(int *)this);
*pbVar6 = *pbVar6 & ~(byte)(1 << ((byte)iVar4 & 7));
*(int *)(this + 0xc) = *(int *)(this + 0xc) + 1;
return;
}
goto LAB_00097d73;
}
*(int *)(this + 0xc) = iVar1;
LAB_00097d73:
this[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.