L L4D2node

SendTable_Init

0x00156520 · 511 bytes · __cdecl

_Z14SendTable_InitPP9SendTablei

Decompiled

undefined (2 params)

/* SendTable_Init(SendTable**, int) */

undefined4 SendTable_Init(SendTable **param_1,int param_2)

{
  SendTable *pSVar1;
  int iVar2;
  CSendTablePrecalc *this;
  undefined4 uVar3;
  int *piVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  
  if (DAT_0039f6e8 != 0) {
    Error("SendTable_Init: called twice.");
  }
  if (0 < param_2) {
    iVar6 = 0;
    do {
      pSVar1 = param_1[iVar6];
      if (*(int *)(pSVar1 + 0xc) == 0) {
        this = operator_new(0x118);
                    /* try { // try from 00156571 to 00156575 has its CatchHandler @ 00156751 */
        CSendTablePrecalc::CSendTablePrecalc(this);
        *(SendTable **)(this + 0x8c) = pSVar1;
        *(CSendTablePrecalc **)(pSVar1 + 0xc) = this;
        SendTable_CalcNextVectorElems(pSVar1);
        uVar3 = ServerDTI_HookTable(pSVar1);
        *(undefined4 *)(this + 0x90) = uVar3;
        uVar3 = CSendTablePrecalc::SetupFlatPropertyArray(this);
        if ((char)uVar3 == '\0') {
          return uVar3;
        }
        iVar8 = 0;
        piVar4 = *(int **)(this + 0x8c);
        iVar5 = piVar4[1];
        if (0 < iVar5) {
          do {
            while( true ) {
              iVar7 = iVar8 * 0x54 + *piVar4;
              iVar2 = *(int *)(iVar7 + 0x18);
              if (iVar2 == 0) {
                if (*(int *)(iVar7 + 0x20) != 1) {
                  Error("Prop %s/%s has an invalid element count for a non-array.",piVar4[2],
                        *(undefined4 *)(iVar7 + 0x30));
                }
              }
              else if (*(int *)(iVar2 + 8) == 6) {
                Error("Invalid property: %s/%s (array of datatables) [on prop %d of %d (%s)].",
                      piVar4[2],*(undefined4 *)(iVar7 + 0x30),iVar8,iVar5,
                      *(undefined4 *)(iVar2 + 0x30));
              }
              if ((*(int *)(iVar7 + 0xc) != 1) || ((*(byte *)(iVar7 + 0x3c) & 1) != 0)) break;
              iVar8 = iVar8 + 1;
              DataTable_Warning("SendTable prop %s::%s is a 1-bit signed property. Use SPROP_UNSIGNED or the client will never receive a value.\n"
                                ,piVar4[2],*(undefined4 *)(iVar7 + 0x30));
              iVar5 = piVar4[1];
              if (iVar5 <= iVar8) goto LAB_00156695;
            }
            iVar5 = piVar4[1];
            iVar8 = iVar8 + 1;
          } while (iVar8 < iVar5);
        }
LAB_00156695:
        if (0 < *(int *)(this + 0x38)) {
          if ((*(byte *)(**(int **)(this + 0x2c) + 0x3e) & 8) == 0) {
            iVar5 = 0;
            do {
              iVar5 = iVar5 + 1;
              if (iVar5 == *(int *)(this + 0x38)) goto LAB_00156548;
            } while ((*(byte *)((*(int **)(this + 0x2c))[iVar5] + 0x3e) & 8) == 0);
          }
          *(byte *)(piVar4 + 4) = *(byte *)(piVar4 + 4) | 4;
        }
      }
LAB_00156548:
      iVar6 = iVar6 + 1;
    } while (iVar6 != param_2);
  }
  CUtlVector<SendTable*,CUtlMemory<SendTable*,int>>::CopyArray
            ((CUtlVector<SendTable*,CUtlMemory<SendTable*,int>> *)&g_SendTables,param_1,param_2);
  g_SendTableCRC = SendTable_ComputeCRC();
  piVar4 = (int *)CommandLine_Tier0();
  iVar6 = (**(code **)(*piVar4 + 0x28))(piVar4,&DAT_002ad780);
  if (iVar6 == 0) {
    return 1;
  }
  SendTable_PrintStats();
  return 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)