bf_write::WriteBitNormal
0x002424d0 · 278 bytes · __thiscall
_ZN8bf_write14WriteBitNormalEf
Decompiled
undefined (2 params)
/* bf_write::WriteBitNormal(float) */
void __thiscall bf_write::WriteBitNormal(bf_write *this,float param_1)
{
byte *pbVar1;
uint uVar2;
int iVar3;
int iVar4;
byte bVar5;
uint uVar6;
uint uVar7;
uint *puVar8;
uVar2 = *(uint *)(this + 0xc);
iVar4 = *(int *)(this + 8);
if ((int)uVar2 < iVar4) {
if (this[0x10] == (bf_write)0x0) {
bVar5 = (byte)(1 << ((byte)uVar2 & 7));
if (param_1 <= -0.0004885198) {
pbVar1 = (byte *)(*(int *)this + ((int)uVar2 >> 3));
*pbVar1 = *pbVar1 | bVar5;
}
else {
pbVar1 = (byte *)(*(int *)this + ((int)uVar2 >> 3));
*pbVar1 = *pbVar1 & ~bVar5;
}
iVar4 = *(int *)(this + 8);
uVar2 = *(int *)(this + 0xc) + 1;
*(uint *)(this + 0xc) = uVar2;
}
if (iVar4 < (int)(uVar2 + 0xb)) {
LAB_002425b3:
*(int *)(this + 0xc) = iVar4;
this[0x10] = (bf_write)0x1;
return;
}
}
else {
this[0x10] = (bf_write)0x1;
if (iVar4 < (int)(uVar2 + 0xb)) goto LAB_002425b3;
}
uVar6 = (int)(param_1 * 2047.0) >> 0x1f;
uVar6 = ((int)(param_1 * 2047.0) ^ uVar6) - uVar6;
uVar7 = 0x7ff;
if (uVar6 < 0x800) {
uVar7 = uVar6;
}
uVar6 = uVar2 & 0x1f;
iVar4 = ((int)uVar2 >> 5) * 4;
puVar8 = (uint *)(iVar4 + *(int *)this);
iVar3 = 0x20 - uVar6;
*puVar8 = *puVar8 & *(uint *)(&DAT_003f2dcc + uVar6 * 0x84) | uVar7 << (sbyte)uVar6;
if (iVar3 < 0xb) {
puVar8 = (uint *)(*(int *)this + 4 + iVar4);
*puVar8 = (&g_BitWriteMasks)[0xb - iVar3] & *puVar8 | uVar7 >> ((byte)iVar3 & 0x1f);
}
*(int *)(this + 0xc) = *(int *)(this + 0xc) + 0xb;
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.