L L4D2node

CStaticPropMgr::UnserializeLeafList

0x001e6ae0 · 550 bytes · __thiscall

_ZN14CStaticPropMgr19UnserializeLeafListER10CUtlBuffer

Decompiled

undefined (2 params)

/* CStaticPropMgr::UnserializeLeafList(CUtlBuffer&) */

void __thiscall CStaticPropMgr::UnserializeLeafList(CStaticPropMgr *this,CUtlBuffer *param_1)

{
  int iVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  void *__ptr;
  int *piVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int local_24;
  undefined4 local_20;
  
  if (((byte)param_1[0x15] & 1) == 0) {
    cVar2 = CUtlBuffer::CheckGet(param_1,4);
    if (cVar2 == '\0') {
      *(undefined4 *)(this + 0x40) = 0;
      CUtlMemory<StaticPropLeafLump_t,int>::Purge
                ((CUtlMemory<StaticPropLeafLump_t,int> *)(this + 0x34));
      *(undefined4 *)(this + 0x44) = *(undefined4 *)(this + 0x34);
      return;
    }
    if (((byte)param_1[0x34] & 1) == 0) {
      iVar4 = *(int *)(param_1 + 0xc);
      iVar8 = *(int *)(*(int *)param_1 + (iVar4 - *(int *)(param_1 + 0x20)));
    }
    else {
      piVar5 = (int *)((*(int *)(param_1 + 0xc) - *(int *)(param_1 + 0x20)) + *(int *)param_1);
      if (piVar5 == (int *)0x0) {
        piVar5 = &local_24;
      }
      local_20 = local_24;
      local_20 = CONCAT31((int3)((uint)local_24 >> 8),*(undefined1 *)((int)piVar5 + 3));
      local_20._2_2_ = (undefined2)((uint)local_24 >> 0x10);
      local_20._0_2_ = CONCAT11(*(undefined1 *)((int)piVar5 + 2),*(undefined1 *)((int)piVar5 + 3));
      local_20._3_1_ = (undefined1)((uint)local_24 >> 0x18);
      local_20._0_3_ = CONCAT12(*(undefined1 *)((int)piVar5 + 1),(undefined2)local_20);
      local_20 = CONCAT13((char)*piVar5,(undefined3)local_20);
      _V_memcpy(&local_24,&local_20,4);
      iVar4 = *(int *)(param_1 + 0xc);
      iVar8 = local_24;
    }
    *(int *)(param_1 + 0xc) = iVar4 + 4;
  }
  else {
    local_24 = 0;
    CUtlBuffer::Scanf(param_1,"%d",&local_24);
    iVar8 = local_24;
  }
  *(undefined4 *)(this + 0x40) = 0;
  CUtlMemory<StaticPropLeafLump_t,int>::Purge((CUtlMemory<StaticPropLeafLump_t,int> *)(this + 0x34))
  ;
  __ptr = *(void **)(this + 0x34);
  *(void **)(this + 0x44) = __ptr;
  if (iVar8 < 1) {
    return;
  }
  iVar4 = *(int *)(this + 0x40);
  iVar3 = iVar4 + iVar8;
  iVar7 = *(int *)(this + 0x38);
  iVar6 = iVar3;
  if (iVar3 <= iVar7) goto LAB_001e6b4a;
  iVar1 = *(int *)(this + 0x3c);
  if (iVar1 < 0) goto LAB_001e6b4a;
  if (iVar1 == 0) {
    if (iVar7 == 0) {
      if (iVar3 < 0x11) {
        iVar7 = 0x10;
        goto LAB_001e6c02;
      }
      iVar7 = 0x10;
    }
    do {
      iVar7 = iVar7 * 2;
    } while (iVar7 < iVar3);
  }
  else {
    for (iVar7 = ((iVar3 + -1) / iVar1 + 1) * iVar1; iVar7 < iVar3; iVar7 = (iVar7 + iVar3) / 2) {
    }
  }
LAB_001e6c02:
  *(int *)(this + 0x38) = iVar7;
  if (__ptr == (void *)0x0) {
    __ptr = malloc(iVar7 * 2);
    *(void **)(this + 0x34) = __ptr;
  }
  else {
    __ptr = realloc(__ptr,iVar7 * 2);
    *(void **)(this + 0x34) = __ptr;
    iVar6 = *(int *)(this + 0x40) + iVar8;
  }
LAB_001e6b4a:
  *(int *)(this + 0x40) = iVar6;
  *(void **)(this + 0x44) = __ptr;
  iVar7 = (iVar6 - iVar4) - iVar8;
  if (0 < iVar7) {
    _V_memmove((void *)((int)__ptr + iVar3 * 2),(void *)((int)__ptr + iVar4 * 2),iVar7 * 2);
    __ptr = *(void **)(this + 0x34);
  }
  CUtlBuffer::Get(param_1,__ptr,iVar8 * 2);
  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)