L L4D2node

old_bf_read::ExciseBits

0x0009b8d0 · 317 bytes · __thiscall

_ZN11old_bf_read10ExciseBitsEii

Decompiled

undefined (3 params)

/* old_bf_read::ExciseBits(int, int) */

void __thiscall old_bf_read::ExciseBits(old_bf_read *this,int param_1,int param_2)

{
  byte *pbVar1;
  byte bVar2;
  int iVar3;
  int iVar4;
  bool bVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  bool bVar10;
  int local_14;
  
  local_14 = *(int *)(this + 8);
  iVar6 = param_1 + param_2;
  iVar7 = local_14 - iVar6;
  iVar9 = local_14 << 6;
  iVar3 = *(int *)this;
  if ((iVar6 < 0) || (local_14 < iVar6)) {
    this[0x10] = (old_bf_read)0x1;
    *(int *)(this + 0xc) = local_14;
  }
  else {
    *(int *)(this + 0xc) = iVar6;
  }
  if (0 < iVar7) {
    bVar5 = false;
    iVar8 = 0;
    iVar6 = param_1;
    do {
      while (iVar4 = *(int *)(this + 0xc), iVar4 < local_14) {
        if (this[0x10] == (old_bf_read)0x0) {
          bVar2 = *(byte *)(*(int *)this + (iVar4 >> 3));
          *(int *)(this + 0xc) = iVar4 + 1;
          bVar10 = ((uint)bVar2 & 1 << ((byte)iVar4 & 7)) != 0;
        }
        else {
          bVar10 = false;
        }
        if (iVar9 <= iVar6) goto LAB_0009b9a8;
LAB_0009b95f:
        if (!bVar5) {
          if (bVar10) {
            pbVar1 = (byte *)(iVar3 + (iVar6 >> 3));
            *pbVar1 = *pbVar1 | (byte)(1 << ((byte)iVar6 & 7));
          }
          else {
            pbVar1 = (byte *)(iVar3 + (iVar6 >> 3));
            *pbVar1 = *pbVar1 & ~(byte)(1 << ((byte)iVar6 & 7));
          }
          local_14 = *(int *)(this + 8);
          iVar6 = iVar6 + 1;
        }
        iVar8 = iVar8 + 1;
        if (iVar8 == iVar7) goto LAB_0009b9b7;
      }
      bVar10 = false;
      this[0x10] = (old_bf_read)0x1;
      if (iVar6 < iVar9) goto LAB_0009b95f;
LAB_0009b9a8:
      iVar8 = iVar8 + 1;
      bVar5 = true;
    } while (iVar8 != iVar7);
  }
LAB_0009b9b7:
  if ((param_1 < 0) || (local_14 < param_1)) {
    this[0x10] = (old_bf_read)0x1;
    *(int *)(this + 0xc) = local_14;
  }
  else {
    *(int *)(this + 0xc) = param_1;
  }
  *(int *)(this + 8) = local_14 - param_2;
  *(int *)(this + 4) = local_14 - param_2 >> 3;
  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)