L L4D2node

CLC_ClientInfo::WriteToBuffer

0x000aa6d0 · 623 bytes · __thiscall

_ZN14CLC_ClientInfo13WriteToBufferER8bf_write

Decompiled

undefined (2 params)

/* CLC_ClientInfo::WriteToBuffer(bf_write&) */

byte __thiscall CLC_ClientInfo::WriteToBuffer(CLC_ClientInfo *this,bf_write *param_1)

{
  uint uVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  byte *pbVar6;
  uint *puVar7;
  uint local_20;
  
  uVar1 = (**(code **)(*(int *)this + 0x24))(this);
  uVar3 = *(uint *)(param_1 + 0xc);
  if (*(int *)(param_1 + 8) < (int)(uVar3 + 6)) {
    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 8);
    param_1[0x10] = (bf_write)0x1;
  }
  else {
    iVar5 = ((int)uVar3 >> 5) * 4;
    uVar3 = uVar3 & 0x1f;
    puVar7 = (uint *)(iVar5 + *(int *)param_1);
    *puVar7 = uVar1 << (sbyte)uVar3 | *puVar7 & *(uint *)(&DAT_003f2db8 + uVar3 * 0x84);
    iVar4 = 0x20 - uVar3;
    if (iVar4 < 6) {
      puVar7 = (uint *)(*(int *)param_1 + 4 + iVar5);
      *puVar7 = uVar1 >> ((byte)iVar4 & 0x1f) | (&g_BitWriteMasks)[6 - iVar4] & *puVar7;
    }
    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 6;
  }
  bf_write::WriteLong(param_1,*(long *)(this + 0x50));
  bf_write::WriteLong(param_1,*(long *)(this + 0x4c));
  iVar5 = *(int *)(param_1 + 0xc);
  if (iVar5 < *(int *)(param_1 + 8)) {
    if (param_1[0x10] == (bf_write)0x0) {
      if (this[0x54] == (CLC_ClientInfo)0x0) {
        pbVar6 = (byte *)(*(int *)param_1 + (iVar5 >> 3));
        *pbVar6 = *pbVar6 & ~(byte)(1 << ((byte)iVar5 & 7));
      }
      else {
        pbVar6 = (byte *)(*(int *)param_1 + (iVar5 >> 3));
        *pbVar6 = *pbVar6 | (byte)(1 << ((byte)iVar5 & 7));
      }
      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;
    }
  }
  else {
    param_1[0x10] = (bf_write)0x1;
  }
  bf_write::WriteLong(param_1,*(long *)(this + 0x58));
  bf_write::WriteString(param_1,(char *)(this + 0x5c));
  iVar5 = 0;
  do {
    if (*(int *)(this + iVar5 * 4 + 0x7c) == 0) {
      iVar4 = *(int *)(param_1 + 0xc);
      if (iVar4 < *(int *)(param_1 + 8)) {
        if (param_1[0x10] == (bf_write)0x0) {
          pbVar6 = (byte *)((iVar4 >> 3) + *(int *)param_1);
          *pbVar6 = *pbVar6 & ~(byte)(1 << ((byte)iVar4 & 7));
          *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;
        }
      }
      else {
        param_1[0x10] = (bf_write)0x1;
      }
    }
    else {
      uVar3 = *(uint *)(param_1 + 0xc);
      iVar4 = *(int *)(param_1 + 8);
      if ((int)uVar3 < iVar4) {
        if (param_1[0x10] == (bf_write)0x0) {
          pbVar6 = (byte *)(((int)uVar3 >> 3) + *(int *)param_1);
          *pbVar6 = *pbVar6 | (byte)(1 << ((byte)uVar3 & 7));
          iVar4 = *(int *)(param_1 + 8);
          uVar3 = *(int *)(param_1 + 0xc) + 1;
          *(uint *)(param_1 + 0xc) = uVar3;
        }
        local_20 = *(uint *)(this + iVar5 * 4 + 0x7c);
        if (iVar4 < (int)(uVar3 + 0x20)) {
LAB_000aa8de:
          *(int *)(param_1 + 0xc) = iVar4;
          param_1[0x10] = (bf_write)0x1;
          goto LAB_000aa879;
        }
      }
      else {
        param_1[0x10] = (bf_write)0x1;
        local_20 = *(uint *)(this + iVar5 * 4 + 0x7c);
        if (iVar4 < (int)(uVar3 + 0x20)) goto LAB_000aa8de;
      }
      uVar1 = uVar3 & 0x1f;
      iVar4 = ((int)uVar3 >> 5) * 4;
      puVar7 = (uint *)(*(int *)param_1 + iVar4);
      *puVar7 = *puVar7 & *(uint *)(&DAT_003f2e20 + uVar1 * 0x84) | local_20 << (sbyte)uVar1;
      iVar2 = 0x20 - uVar1;
      if (iVar2 != 0x20) {
        puVar7 = (uint *)(*(int *)param_1 + 4 + iVar4);
        *puVar7 = (&g_BitWriteMasks)[0x20 - iVar2] & *puVar7 | local_20 >> ((byte)iVar2 & 0x1f);
      }
      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 0x20;
    }
LAB_000aa879:
    iVar5 = iVar5 + 1;
    if (iVar5 == 4) {
      return (byte)param_1[0x10] ^ 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)