L L4D2node

SendTable_Encode

0x00154bc0 · 1269 bytes · __cdecl

_Z16SendTable_EncodePK9SendTablePKvP8bf_writeiP10CUtlMemoryI20CSendProxyRecipientsiEb

Decompiled

undefined (6 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* SendTable_Encode(SendTable const*, void const*, bf_write*, int, CUtlMemory<CSendProxyRecipients,
   int>*, bool) */

byte SendTable_Encode(SendTable *param_1,void *param_2,bf_write *param_3,int param_4,
                     CUtlMemory *param_5,bool param_6)

{
  bf_write bVar1;
  CSendTablePrecalc *pCVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  undefined8 uVar6;
  char cVar7;
  int iVar8;
  bool bVar9;
  undefined4 local_1ac;
  undefined4 local_1a8;
  undefined4 local_1a0;
  undefined4 local_19c;
  int local_198;
  CDeltaBitsWriter local_194 [12];
  SendTable *local_188;
  undefined4 local_184;
  uint local_180;
  int local_17c;
  undefined1 local_178 [12];
  undefined4 local_16c;
  undefined1 local_168 [12];
  undefined4 local_15c;
  undefined **local_158;
  int local_154;
  int aiStack_150 [65];
  int local_4c;
  undefined4 local_48;
  CSendTablePrecalc *local_3c;
  CUtlMemory *local_38;
  bf_write *local_34;
  int local_2c;
  undefined4 local_28;
  int local_24;
  CDeltaBitsWriter *local_20;
  
  pCVar2 = *(CSendTablePrecalc **)(param_1 + 0xc);
  if (pCVar2 == (CSendTablePrecalc *)0x0) {
    Error("SendTable_Encode: Missing m_pPrecalc for SendTable %s.",*(undefined4 *)(param_1 + 8));
  }
  if ((param_5 != (CUtlMemory *)0x0) && (*(int *)(param_5 + 4) < *(int *)(pCVar2 + 0xf8))) {
    Error("SendTable_Encode: pRecipients array too small.");
  }
  local_1ac = 0;
  local_1a8 = 0;
  if (_exit == 0) {
    local_198 = 0;
  }
  else {
    (**(code **)(_exit + 0x50))
              (_exit,&local_1ac,0,0,0,0,"/data/src/engine/./dt_send_eng.cpp",0x287,
               &SendTable_Encode(SendTable_const*,void_const*,bf_write*,int,CUtlMemory<CSendProxyRecipients,int>*,bool)
                ::tm_fmt,"(%s)%s","Unaccounted","SendTable_Encode");
    local_198 = _exit;
  }
  iVar3 = _DAT_0040b9d4;
  local_1a0 = local_1ac;
  local_19c = local_1a8;
                    /* try { // try from 00154fee to 0015503c has its CatchHandler @ 001550f8 */
  if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
     (iVar8 = ThreadGetCurrentId(), iVar3 == iVar8)) {
    if ((char *)*_DAT_0040b030 != "SendTable_Encode") {
      _DAT_0040b030 =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2ae332,&DAT_00000001,0x2a054b);
    }
    CVProfNode::EnterScope();
    DAT_0040b02c = '\0';
  }
  local_180 = 0;
  local_17c = 0;
  if (g_bServerDTIEnabled != '\0') {
    local_184 = 1;
    local_188 = param_1;
    uVar6 = rdtsc();
    local_17c = (int)((ulonglong)uVar6 >> 0x20);
    local_180 = (uint)uVar6;
  }
                    /* try { // try from 00154d08 to 00154d0c has its CatchHandler @ 001550c6 */
  CDeltaBitsWriter::CDeltaBitsWriter(local_194,param_3);
                    /* try { // try from 00154d28 to 00154f05 has its CatchHandler @ 001550fc */
  CDatatableStack::CDatatableStack((CDatatableStack *)&local_158,pCVar2,param_2,param_4);
  local_158 = &PTR_RecurseAndCallProxies_002ae580;
  local_34 = param_3;
  local_24 = 0;
  local_28 = 0;
  local_38 = param_5;
  local_2c = param_4;
  local_20 = local_194;
  local_3c = pCVar2;
  CDatatableStack::Init((CDatatableStack *)&local_158,false);
  iVar3 = *(int *)(pCVar2 + 0x38);
  iVar8 = 0;
  if (0 < iVar3) {
    do {
      while (aiStack_150[*(byte *)(*(int *)(local_154 + 0x40) + iVar8)] == 0) {
LAB_00154e48:
        iVar8 = iVar8 + 1;
        if (iVar8 == iVar3) goto LAB_00154f20;
      }
      local_4c = iVar8;
      local_48 = *(undefined4 *)(*(int *)(local_154 + 0x2c) + iVar8 * 4);
      if (!param_6) {
LAB_00154d88:
        CDeltaBitsWriter::WritePropIndex(local_20,iVar8);
        iVar5 = *(int *)(*(int *)(local_3c + 0x2c) + local_4c * 4);
        local_15c = 1;
        (**(code **)(iVar5 + 0x40))
                  (iVar5,aiStack_150[*(byte *)(*(int *)(local_154 + 0x40) + local_4c)],
                   *(int *)(iVar5 + 0x4c) +
                   aiStack_150[*(byte *)(*(int *)(local_154 + 0x40) + local_4c)],local_168,0,
                   local_2c);
        iVar4 = *(int *)(local_34 + 0xc);
        (**(code **)(g_PropTypeFns + *(int *)(iVar5 + 8) * 0x24))
                  (aiStack_150[*(byte *)(*(int *)(local_154 + 0x40) + local_4c)],local_168,iVar5,
                   local_34,local_2c);
        local_24 = local_24 + (*(int *)(local_34 + 0xc) - iVar4);
        goto LAB_00154e48;
      }
      iVar5 = *(int *)(*(int *)(local_3c + 0x2c) + iVar8 * 4);
      local_16c = 1;
      (**(code **)(iVar5 + 0x40))
                (iVar5,aiStack_150[*(byte *)(*(int *)(local_154 + 0x40) + iVar8)],
                 *(int *)(iVar5 + 0x4c) + aiStack_150[*(byte *)(*(int *)(local_154 + 0x40) + iVar8)]
                 ,local_178,0,local_2c);
      cVar7 = (**(code **)(g_PropTypeFns + *(int *)(iVar5 + 8) * 0x24 + 0x14))
                        (aiStack_150[*(byte *)(*(int *)(local_154 + 0x40) + local_4c)],local_178,
                         iVar5);
      if (cVar7 == '\0') goto LAB_00154d88;
      iVar8 = iVar8 + 1;
    } while (iVar8 != iVar3);
  }
LAB_00154f20:
  bVar1 = param_3[0x10];
  CDeltaBitsWriter::~CDeltaBitsWriter(local_194);
  if ((g_bServerDTIEnabled != '\0') && (local_188 != (SendTable *)0x0)) {
    uVar6 = rdtsc();
    bVar9 = (uint)uVar6 < local_180;
    local_180 = (uint)uVar6 - local_180;
    local_17c = ((int)((ulonglong)uVar6 >> 0x20) - local_17c) - (uint)bVar9;
    _ServerDTI_HookTimer(local_188,local_184,&local_180);
  }
  iVar3 = _DAT_0040b9d4;
  if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
     (iVar8 = ThreadGetCurrentId(), iVar3 == iVar8)) {
    cVar7 = CVProfNode::ExitScope();
    if (cVar7 != '\0') {
      _DAT_0040b030 = (int *)_DAT_0040b030[0x19];
    }
    DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
  }
  if (local_198 != 0) {
    (**(code **)(local_198 + 0x54))(local_198,local_1a0,local_19c,0,0,0);
  }
  return (byte)bVar1 ^ 1;
}

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)