L L4D2node

bf_write::WriteBitLong

0x00098140 · 180 bytes · __thiscall

_ZN8bf_write12WriteBitLongEjib

Decompiled

undefined (4 params)

/* bf_write::WriteBitLong(unsigned int, int, bool) */

void __thiscall bf_write::WriteBitLong(bf_write *this,uint param_1,int param_2,bool param_3)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  uint *puVar4;
  sbyte local_14;
  
  if (param_3) {
    WriteSBitLong(this,param_1,param_2);
    return;
  }
  uVar3 = *(uint *)(this + 0xc);
  if ((int)(param_2 + uVar3) <= *(int *)(this + 8)) {
    iVar1 = ((int)uVar3 >> 5) * 4;
    uVar3 = uVar3 & 0x1f;
    puVar4 = (uint *)(iVar1 + *(int *)this);
    local_14 = (sbyte)uVar3;
    *puVar4 = param_1 << local_14 | *puVar4 & (&g_BitWriteMasks)[uVar3 * 0x21 + param_2];
    iVar2 = 0x20 - uVar3;
    if (iVar2 < param_2) {
      puVar4 = (uint *)(*(int *)this + 4 + iVar1);
      *puVar4 = (&g_BitWriteMasks)[param_2 - iVar2] & *puVar4 | param_1 >> ((byte)iVar2 & 0x1f);
    }
    *(int *)(this + 0xc) = *(int *)(this + 0xc) + param_2;
    return;
  }
  *(int *)(this + 0xc) = *(int *)(this + 8);
  this[0x10] = (bf_write)0x1;
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)