L L4D2node

CBitWrite::WriteString

0x0009bf40 · 362 bytes · __thiscall

_ZN9CBitWrite11WriteStringEPKc

Decompiled

undefined (2 params)

/* CBitWrite::WriteString(char const*) */

byte __thiscall CBitWrite::WriteString(CBitWrite *this,char *param_1)

{
  uint *puVar1;
  byte bVar2;
  byte bVar3;
  uint uVar4;
  int iVar5;
  
  iVar5 = *(int *)(this + 0x14);
  uVar4 = *(uint *)(this + 0x10);
  if (param_1 != (char *)0x0) {
LAB_0009bf60:
    bVar3 = *param_1;
    if (bVar3 != 0) {
      while( true ) {
        param_1 = param_1 + 1;
        bVar2 = (byte)iVar5;
        if (iVar5 < 8) break;
        iVar5 = iVar5 + -8;
        *(int *)(this + 0x14) = iVar5;
        uVar4 = (uint)bVar3 << (0x20 - bVar2 & 0x1f) | uVar4;
        *(uint *)(this + 0x10) = uVar4;
        if (iVar5 != 0) goto LAB_0009bf60;
        puVar1 = *(uint **)(this + 0x18);
        if (puVar1 == *(uint **)(this + 0x1c)) {
          this[4] = (CBitWrite)0x1;
        }
        else {
          *(uint **)(this + 0x18) = puVar1 + 1;
          *puVar1 = uVar4;
        }
        *(undefined4 *)(this + 0x10) = 0;
        uVar4 = 0;
        iVar5 = 0x20;
        *(undefined4 *)(this + 0x14) = 0x20;
        bVar3 = *param_1;
        if (bVar3 == 0) {
          uVar4 = 0;
          goto LAB_0009bfc8;
        }
      }
      puVar1 = *(uint **)(this + 0x18);
      uVar4 = ((int)(char)bVar3 & (&CBitBuffer::s_nMaskTable)[iVar5]) << (0x20 - bVar2 & 0x1f) |
              uVar4;
      *(uint *)(this + 0x10) = uVar4;
      if (puVar1 == *(uint **)(this + 0x1c)) {
        this[4] = (CBitWrite)0x1;
      }
      else {
        *(uint **)(this + 0x18) = puVar1 + 1;
        *puVar1 = uVar4;
      }
      iVar5 = iVar5 + 0x18;
      *(int *)(this + 0x14) = iVar5;
      uVar4 = (uint)(int)(char)bVar3 >> (bVar2 & 0x1f);
      *(uint *)(this + 0x10) = uVar4;
      goto LAB_0009bf60;
    }
  }
LAB_0009bfc8:
  if (iVar5 < 8) {
    puVar1 = *(uint **)(this + 0x18);
    if (puVar1 == *(uint **)(this + 0x1c)) {
      this[4] = (CBitWrite)0x1;
      bVar3 = 0;
    }
    else {
      *(uint **)(this + 0x18) = puVar1 + 1;
      *puVar1 = uVar4;
      bVar3 = (byte)this[4] ^ 1;
    }
    *(undefined4 *)(this + 0x10) = 0;
    *(int *)(this + 0x14) = iVar5 + 0x18;
    return bVar3;
  }
  *(int *)(this + 0x14) = iVar5 + -8;
  if (iVar5 + -8 != 0) {
    return (byte)this[4] ^ 1;
  }
  puVar1 = *(uint **)(this + 0x18);
  if (puVar1 == *(uint **)(this + 0x1c)) {
    this[4] = (CBitWrite)0x1;
    bVar3 = 0;
  }
  else {
    *(uint **)(this + 0x18) = puVar1 + 1;
    *puVar1 = uVar4;
    bVar3 = (byte)this[4] ^ 1;
  }
  *(undefined4 *)(this + 0x10) = 0;
  *(undefined4 *)(this + 0x14) = 0x20;
  return bVar3;
}

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)