L L4D2node

Base_CmdKeyValues::WriteToBuffer

0x000b6600 · 314 bytes · __thiscall

_ZN17Base_CmdKeyValues13WriteToBufferER8bf_write

Decompiled

undefined (2 params)

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

uint __thiscall Base_CmdKeyValues::WriteToBuffer(Base_CmdKeyValues *this,bf_write *param_1)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  uint uVar4;
  uint *puVar5;
  sbyte local_60;
  void *local_54 [7];
  int local_38;
  
  if (*(int *)(this + 0x48) != 0) {
    uVar2 = (**(code **)(*(int *)this + 0x24))(this);
    uVar4 = *(uint *)(param_1 + 0xc);
    if (*(int *)(param_1 + 8) < (int)(uVar4 + 6)) {
      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 8);
      param_1[0x10] = (bf_write)0x1;
    }
    else {
      iVar1 = ((int)uVar4 >> 5) * 4;
      uVar4 = uVar4 & 0x1f;
      puVar5 = (uint *)(iVar1 + *(int *)param_1);
      local_60 = (sbyte)uVar4;
      *puVar5 = uVar2 << local_60 | *puVar5 & *(uint *)(&DAT_003f2db8 + uVar4 * 0x84);
      iVar3 = 0x20 - uVar4;
      if (iVar3 < 6) {
        puVar5 = (uint *)(*(int *)param_1 + 4 + iVar1);
        *puVar5 = uVar2 >> ((byte)iVar3 & 0x1f) | (&g_BitWriteMasks)[6 - iVar3] & *puVar5;
      }
      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 6;
    }
    CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_54,0,0,0);
                    /* try { // try from 000b66ca to 000b6706 has its CatchHandler @ 000b6742 */
    CUtlBuffer::ActivateByteSwapping((CUtlBuffer *)local_54,true);
    uVar4 = KeyValues::WriteAsBinary(*(KeyValues **)(this + 0x48),(CUtlBuffer *)local_54);
    if ((char)uVar4 != '\0') {
      bf_write::WriteLong(param_1,local_38);
      bf_write::WriteBits(param_1,local_54[0],local_38 << 3);
      uVar4 = (byte)param_1[0x10] ^ 1;
    }
    CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_54);
    return uVar4;
  }
  return 0;
}

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)