L L4D2node

CBitRead::ReadBitNormal

0x00b78620 · 512 bytes · __thiscall

_ZN8CBitRead13ReadBitNormalEv

Decompiled

undefined (1 param)

/* CBitRead::ReadBitNormal() */

longdouble __thiscall CBitRead::ReadBitNormal(CBitRead *this)

{
  uint uVar1;
  uint *puVar2;
  undefined4 uVar3;
  uint uVar4;
  uint *puVar5;
  uint uVar6;
  int iVar7;
  int iVar8;
  float fVar9;
  uint local_18;
  
  iVar8 = *(int *)(this + 0x14);
  uVar1 = *(uint *)(this + 0x10);
  iVar7 = iVar8 + -1;
  *(int *)(this + 0x14) = iVar7;
  if (iVar7 == 0) {
    puVar2 = *(uint **)(this + 0x18);
    *(undefined4 *)(this + 0x14) = 0x20;
    puVar5 = *(uint **)(this + 0x1c);
    if (puVar2 == puVar5) {
      *(undefined4 *)(this + 0x14) = 1;
      *(uint **)(this + 0x18) = puVar5 + 1;
      iVar7 = 1;
      *(undefined4 *)(this + 0x10) = 0;
      local_18 = 0;
LAB_00b786a4:
      puVar2 = *(uint **)(this + 0x18);
      if (puVar2 == puVar5) {
        *(undefined4 *)(this + 0x14) = 1;
        *(undefined4 *)(this + 0x10) = 0;
        *(uint **)(this + 0x18) = puVar5 + 1;
        this[4] = (CBitRead)0x1;
      }
      else if (puVar5 < puVar2) {
        this[4] = (CBitRead)0x1;
        *(undefined4 *)(this + 0x10) = 0;
      }
      else {
        *(uint **)(this + 0x18) = puVar2 + 1;
        uVar6 = *puVar2;
        *(uint *)(this + 0x10) = uVar6;
        if (this[4] == (CBitRead)0x0) {
          uVar3 = *(undefined4 *)(this + 0x14);
          uVar4 = *(uint *)(CBitBuffer::s_nMaskTable + (0xb - iVar7) * 4);
          *(int *)(this + 0x14) = iVar7 + 0x15;
          local_18 = (uVar6 & uVar4) << ((byte)uVar3 & 0x1f) | local_18;
          *(uint *)(this + 0x10) = uVar6 >> ((byte)(0xb - iVar7) & 0x1f);
          fVar9 = ((float)(local_18 >> 0x10) * 65536.0 + (float)(local_18 & 0xffff)) * 0.0004885198;
          goto LAB_00b786bf;
        }
      }
      fVar9 = 0.0;
      goto LAB_00b786bf;
    }
    if (puVar5 < puVar2) {
      this[4] = (CBitRead)0x1;
      local_18 = 0;
    }
    else {
      *(uint **)(this + 0x18) = puVar2 + 1;
      local_18 = *puVar2;
    }
    *(undefined4 *)(this + 0x14) = 0x15;
    uVar6 = local_18 & 0x7ff;
LAB_00b78671:
    local_18 = local_18 >> 0xb;
  }
  else {
    local_18 = uVar1 >> 1;
    *(uint *)(this + 0x10) = local_18;
    if (iVar7 < 0xb) {
      puVar5 = *(uint **)(this + 0x1c);
      goto LAB_00b786a4;
    }
    iVar8 = iVar8 + -0xc;
    uVar6 = local_18 & 0x7ff;
    *(int *)(this + 0x14) = iVar8;
    if (iVar8 != 0) goto LAB_00b78671;
    puVar5 = *(uint **)(this + 0x18);
    *(undefined4 *)(this + 0x14) = 0x20;
    if (puVar5 == *(uint **)(this + 0x1c)) {
      *(undefined4 *)(this + 0x14) = 1;
      *(undefined4 *)(this + 0x10) = 0;
      *(uint **)(this + 0x18) = puVar5 + 1;
      fVar9 = (float)uVar6 * 0.0004885198;
      goto LAB_00b786bf;
    }
    if (*(uint **)(this + 0x1c) < puVar5) {
      this[4] = (CBitRead)0x1;
      *(undefined4 *)(this + 0x10) = 0;
      fVar9 = (float)uVar6 * 0.0004885198;
      goto LAB_00b786bf;
    }
    *(uint **)(this + 0x18) = puVar5 + 1;
    local_18 = *puVar5;
  }
  *(uint *)(this + 0x10) = local_18;
  fVar9 = (float)uVar6 * 0.0004885198;
LAB_00b786bf:
  if ((uVar1 & 1) != 0) {
    fVar9 = -fVar9;
  }
  return (longdouble)fVar9;
}

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)