L L4D2node

CNetworkStringTableDictionaryManager::ProcessBuffer

0x001a80a0 · 607 bytes · __thiscall

_ZN36CNetworkStringTableDictionaryManager13ProcessBufferER10CUtlBuffer

Decompiled

undefined (2 params)

/* CNetworkStringTableDictionaryManager::ProcessBuffer(CUtlBuffer&) */

void __thiscall
CNetworkStringTableDictionaryManager::ProcessBuffer
          (CNetworkStringTableDictionaryManager *this,CUtlBuffer *param_1)

{
  int iVar1;
  char *pcVar2;
  int iVar3;
  int iVar4;
  size_t __size;
  void *pvVar5;
  int iVar6;
  int in_GS_OFFSET;
  undefined4 local_13c;
  int local_138;
  ulong local_134 [4];
  char local_124 [260];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  Clear(this);
  iVar3 = *(int *)(param_1 + 0x1c);
  pvVar5 = *(void **)param_1;
  CRC32_Init(local_134);
  CRC32_ProcessBuffer(local_134,pvVar5,iVar3);
  CRC32_Final(local_134);
  *(ulong *)(this + 0x44) = local_134[0];
  while (*(int *)(param_1 + 0x1c) != *(int *)(param_1 + 0xc) &&
         -1 < *(int *)(param_1 + 0x1c) - *(int *)(param_1 + 0xc)) {
    while (CUtlBuffer::GetString(param_1,local_124,0x104), local_124[0] != '\0') {
      CUtlString::CUtlString((CUtlString *)local_134);
                    /* try { // try from 001a816a to 001a81f6 has its CatchHandler @ 001a830f */
      CUtlString::operator=((CUtlString *)local_134,local_124);
      iVar1 = *(int *)(this + 0x20);
      iVar3 = iVar1 + 1;
      iVar6 = *(int *)(this + 0x18);
      if (iVar6 < iVar3) {
        iVar4 = *(int *)(this + 0x1c);
        if (iVar4 < 0) goto LAB_001a8186;
        if (iVar4 == 0) {
          if (iVar6 == 0) {
            if (iVar3 < 3) {
              iVar4 = 2;
              goto LAB_001a829f;
            }
            iVar6 = 2;
          }
          do {
            iVar4 = iVar6;
            iVar6 = iVar4 * 2;
          } while (iVar6 < iVar3);
          pvVar5 = *(void **)(this + 0x14);
          *(int *)(this + 0x18) = iVar6;
          __size = iVar4 << 5;
          if (pvVar5 != (void *)0x0) goto LAB_001a82ac;
LAB_001a82f3:
          pvVar5 = malloc(__size);
          *(void **)(this + 0x14) = pvVar5;
        }
        else {
          for (iVar4 = (iVar1 / iVar4 + 1) * iVar4; iVar4 < iVar3; iVar4 = (iVar4 + iVar3) / 2) {
          }
LAB_001a829f:
          pvVar5 = *(void **)(this + 0x14);
          *(int *)(this + 0x18) = iVar4;
          __size = iVar4 << 4;
          if (pvVar5 == (void *)0x0) goto LAB_001a82f3;
LAB_001a82ac:
          pvVar5 = realloc(pvVar5,__size);
          *(void **)(this + 0x14) = pvVar5;
          iVar3 = *(int *)(this + 0x20) + 1;
        }
      }
      else {
LAB_001a8186:
        pvVar5 = *(void **)(this + 0x14);
      }
      *(int *)(this + 0x20) = iVar3;
      *(void **)(this + 0x24) = pvVar5;
      iVar3 = (iVar3 - iVar1) + -1;
      if (iVar3 < 1) {
        iVar6 = iVar1 << 4;
      }
      else {
        iVar6 = iVar1 * 0x10;
                    /* try { // try from 001a825e to 001a8262 has its CatchHandler @ 001a830f */
        _V_memmove((void *)((int)pvVar5 + iVar6 + 0x10),(void *)((int)pvVar5 + iVar6),iVar3 * 0x10);
        pvVar5 = *(void **)(this + 0x14);
      }
      if ((CUtlString *)(iVar6 + (int)pvVar5) != (CUtlString *)0x0) {
        CUtlString::CUtlString((CUtlString *)(iVar6 + (int)pvVar5),(CUtlString *)local_134);
      }
      pcVar2 = CUtlString::operator_cast_to_char_((CUtlString *)local_134);
      local_13c = HashStringCaselessIgnoreSlashes(pcVar2);
      local_138 = iVar1;
      CUtlRBTree<CUtlMap<unsigned_long,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_long,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_long,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
      ::Insert((CUtlRBTree<CUtlMap<unsigned_long,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_long,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_long,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                *)(this + 0x28),(Node_t *)&local_13c);
      CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_134);
      if (*(int *)(param_1 + 0x1c) == *(int *)(param_1 + 0xc) ||
          *(int *)(param_1 + 0x1c) - *(int *)(param_1 + 0xc) < 0) goto LAB_001a8213;
    }
  }
LAB_001a8213:
  iVar3 = Q_log2(*(uint *)(this + 0x20));
  *(int *)(this + 0x48) = iVar3 + 1;
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
}

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)