L L4D2node

CBitRead::ReadString

0x00b76320 · 394 bytes · __thiscall

_ZN8CBitRead10ReadStringEPcibPi

Decompiled

undefined (5 params)

/* CBitRead::ReadString(char*, int, bool, int*) */

byte __thiscall
CBitRead::ReadString(CBitRead *this,char *param_1,int param_2,bool param_3,int *param_4)

{
  int iVar1;
  undefined4 uVar2;
  uint *puVar3;
  undefined4 *puVar4;
  uint uVar5;
  uint uVar6;
  byte bVar7;
  int iVar8;
  byte local_20;
  byte local_11;
  
  iVar8 = 0;
  local_11 = 0;
  do {
    iVar1 = *(int *)(this + 0x14);
    if (iVar1 < 8) {
      uVar2 = *(undefined4 *)(this + 0x10);
      puVar3 = *(uint **)(this + 0x18);
      if (puVar3 == *(uint **)(this + 0x1c)) {
        *(undefined4 *)(this + 0x14) = 1;
        *(undefined4 *)(this + 0x10) = 0;
        *(uint **)(this + 0x18) = puVar3 + 1;
        this[4] = (CBitRead)0x1;
LAB_00b763b7:
        param_1[iVar8] = '\0';
        if (param_4 != (int *)0x0) {
          *param_4 = iVar8;
        }
        bVar7 = 0;
        if (this[4] == (CBitRead)0x0) {
          bVar7 = local_11 ^ 1;
        }
        return bVar7;
      }
      if (*(uint **)(this + 0x1c) < puVar3) {
        this[4] = (CBitRead)0x1;
        *(undefined4 *)(this + 0x10) = 0;
        goto LAB_00b763b7;
      }
      *(uint **)(this + 0x18) = puVar3 + 1;
      uVar5 = *puVar3;
      *(uint *)(this + 0x10) = uVar5;
      if (this[4] != (CBitRead)0x0) goto LAB_00b763b7;
      uVar6 = *(uint *)(CBitBuffer::s_nMaskTable + (8 - iVar1) * 4);
      *(int *)(this + 0x14) = iVar1 + 0x18;
      local_20 = (byte)(8 - iVar1);
      bVar7 = (byte)((uVar6 & uVar5) << ((byte)iVar1 & 0x1f)) | (byte)uVar2;
      *(uint *)(this + 0x10) = uVar5 >> (local_20 & 0x1f);
    }
    else {
      *(int *)(this + 0x14) = iVar1 + -8;
      bVar7 = (byte)*(uint *)(this + 0x10);
      if (iVar1 + -8 == 0) {
        puVar4 = *(undefined4 **)(this + 0x18);
        *(undefined4 *)(this + 0x14) = 0x20;
        if (puVar4 == *(undefined4 **)(this + 0x1c)) {
          *(undefined4 *)(this + 0x14) = 1;
          *(undefined4 *)(this + 0x10) = 0;
          *(undefined4 **)(this + 0x18) = puVar4 + 1;
        }
        else if (*(undefined4 **)(this + 0x1c) < puVar4) {
          this[4] = (CBitRead)0x1;
          *(undefined4 *)(this + 0x10) = 0;
        }
        else {
          *(undefined4 **)(this + 0x18) = puVar4 + 1;
          *(undefined4 *)(this + 0x10) = *puVar4;
        }
      }
      else {
        *(uint *)(this + 0x10) = *(uint *)(this + 0x10) >> 8;
      }
    }
    if ((bVar7 == 0) || ((bVar7 == 10 && (param_3)))) goto LAB_00b763b7;
    if (iVar8 < param_2 + -1) {
      param_1[iVar8] = bVar7;
      iVar8 = iVar8 + 1;
    }
    else {
      local_11 = 1;
    }
  } while( true );
}

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)