L L4D2node

old_bf_read::ReadSBitLong

0x0009a1e0 · 210 bytes · __thiscall

_ZN11old_bf_read12ReadSBitLongEi

Decompiled

undefined (2 params)

/* old_bf_read::ReadSBitLong(int) */

uint __thiscall old_bf_read::ReadSBitLong(old_bf_read *this,int param_1)

{
  uint uVar1;
  uint uVar2;
  byte bVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  uint uVar7;
  
  iVar4 = *(int *)(this + 0xc);
  uVar1 = param_1 - 1;
  iVar5 = *(int *)(this + 8);
  uVar2 = uVar1 + iVar4;
  if (iVar5 < (int)uVar2) {
    *(int *)(this + 0xc) = iVar5;
    uVar7 = 0;
  }
  else {
    iVar6 = iVar4 >> 5;
    uVar7 = *(uint *)(*(int *)this + iVar6 * 4);
    *(uint *)(this + 0xc) = uVar2;
    uVar7 = uVar7 >> ((byte)iVar4 & 0x1f);
    if (iVar6 == (int)(uVar2 - 1) >> 5) {
      if (uVar1 != 0x20) {
        uVar7 = uVar7 & (&g_ExtraMasks)[uVar1];
      }
    }
    else {
      uVar7 = ((&g_ExtraMasks)[uVar2 & 0x1f] & *(uint *)(*(int *)this + 4 + iVar6 * 4)) <<
              ((char)uVar1 - (char)(uVar2 & 0x1f) & 0x1fU) | uVar7;
    }
    if ((int)uVar2 < iVar5) {
      if ((this[0x10] == (old_bf_read)0x0) &&
         (bVar3 = *(byte *)(*(int *)this + ((int)uVar2 >> 3)), *(uint *)(this + 0xc) = uVar2 + 1,
         (bVar3 >> (uVar2 & 7) & 1) != 0)) {
        uVar7 = uVar7 - (&GetBitForBitnum(int)::bitsForBitnum)[uVar1 & 0x1f];
      }
      return uVar7;
    }
  }
  this[0x10] = (old_bf_read)0x1;
  return uVar7;
}

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)