L L4D2node

CTraceListData::EnumElement

0x00159350 · 950 bytes · __thiscall

_ZN14CTraceListData11EnumElementEP13IHandleEntity

Decompiled

undefined (2 params)

/* CTraceListData::EnumElement(IHandleEntity*) */

undefined4 __thiscall CTraceListData::EnumElement(CTraceListData *this,IHandleEntity *param_1)

{
  int iVar1;
  char cVar2;
  uint uVar3;
  int iVar4;
  int *piVar5;
  void *pvVar6;
  int iVar7;
  int iVar8;
  int *local_24;
  undefined4 local_20 [4];
  
  (**(code **)(**(int **)(this + 0x540) + 0x60))(*(int **)(this + 0x540),param_1,&local_24,local_20)
  ;
  uVar3 = (**(code **)(*local_24 + 0x30))(local_24);
  iVar4 = (**(code **)(*local_24 + 0x2c))(local_24);
  if ((iVar4 == 0) || ((uVar3 & 4) != 0)) {
    Msg("%s in solid list (not solid)\n",local_20[0]);
    return 0;
  }
  piVar5 = (int *)StaticPropMgr();
  cVar2 = (**(code **)(*piVar5 + 0x28))(piVar5,param_1);
  if (cVar2 != '\0') {
    iVar1 = *(int *)(this + 0x520);
    iVar7 = *(int *)(this + 0x314);
    iVar4 = iVar1 + 1;
    if (iVar4 <= iVar7) {
      pvVar6 = *(void **)(this + 0x310);
      goto LAB_00159469;
    }
    iVar8 = *(int *)(this + 0x318);
    iVar4 = iVar4 - iVar7;
    if (iVar8 < 0) {
      iVar8 = *(int *)(this + 0x31c);
      *(int *)(this + 0x318) = iVar8;
      if (iVar7 == 0) {
        *(undefined4 *)(this + 0x310) = 0;
        pvVar6 = (void *)0x0;
      }
      else {
        pvVar6 = malloc(iVar7 * 8);
        memcpy(pvVar6,*(void **)(this + 0x310),iVar7 * 8);
        iVar8 = *(int *)(this + 0x318);
        *(void **)(this + 0x310) = pvVar6;
      }
      if (-1 < iVar8) {
        iVar7 = *(int *)(this + 0x314);
        goto LAB_001594d2;
      }
    }
    else {
LAB_001594d2:
      iVar4 = iVar4 + iVar7;
      if (iVar8 == 0) {
        if (iVar7 == 0) {
          iVar7 = 4;
        }
        for (; iVar7 < iVar4; iVar7 = iVar7 * 2) {
        }
      }
      else {
        for (iVar7 = ((iVar4 + -1) / iVar8 + 1) * iVar8; iVar7 < iVar4; iVar7 = (iVar7 + iVar4) / 2)
        {
        }
      }
      *(int *)(this + 0x314) = iVar7;
      if (*(void **)(this + 0x310) != (void *)0x0) {
        pvVar6 = realloc(*(void **)(this + 0x310),iVar7 << 3);
        *(void **)(this + 0x310) = pvVar6;
        iVar4 = *(int *)(this + 0x520) + 1;
        goto LAB_00159469;
      }
      pvVar6 = malloc(iVar7 << 3);
      *(void **)(this + 0x310) = pvVar6;
    }
    iVar4 = *(int *)(this + 0x520) + 1;
LAB_00159469:
    *(int *)(this + 0x520) = iVar4;
    iVar7 = iVar1 * 8;
    iVar4 = (iVar4 - iVar1) + -1;
    *(void **)(this + 0x524) = pvVar6;
    if (0 < iVar4) {
      _V_memmove((void *)((int)pvVar6 + iVar7 + 8),(void *)((int)pvVar6 + iVar7),iVar4 * 8);
      pvVar6 = *(void **)(this + 0x310);
    }
    *(int **)((int)pvVar6 + iVar7 + 4) = local_24;
    *(IHandleEntity **)(*(int *)(this + 0x310) + iVar7) = param_1;
    return 0;
  }
  iVar1 = *(int *)(this + 0x308);
  iVar7 = *(int *)(this + 0xfc);
  iVar4 = iVar1 + 1;
  if (iVar4 <= iVar7) {
    pvVar6 = *(void **)(this + 0xf8);
    goto LAB_001593f5;
  }
  iVar8 = *(int *)(this + 0x100);
  iVar4 = iVar4 - iVar7;
  if (iVar8 < 0) {
    iVar8 = *(int *)(this + 0x104);
    *(int *)(this + 0x100) = iVar8;
    if (iVar7 == 0) {
      *(undefined4 *)(this + 0xf8) = 0;
      pvVar6 = (void *)0x0;
    }
    else {
      pvVar6 = malloc(iVar7 * 8);
      memcpy(pvVar6,*(void **)(this + 0xf8),iVar7 * 8);
      iVar8 = *(int *)(this + 0x100);
      *(void **)(this + 0xf8) = pvVar6;
    }
    if (-1 < iVar8) {
      iVar7 = *(int *)(this + 0xfc);
      goto LAB_00159552;
    }
  }
  else {
LAB_00159552:
    iVar4 = iVar4 + iVar7;
    if (iVar8 == 0) {
      if (iVar7 == 0) {
        iVar7 = 4;
      }
      for (; iVar7 < iVar4; iVar7 = iVar7 * 2) {
      }
    }
    else {
      for (iVar7 = ((iVar4 + -1) / iVar8 + 1) * iVar8; iVar7 < iVar4; iVar7 = (iVar7 + iVar4) / 2) {
      }
    }
    *(int *)(this + 0xfc) = iVar7;
    if (*(void **)(this + 0xf8) != (void *)0x0) {
      pvVar6 = realloc(*(void **)(this + 0xf8),iVar7 << 3);
      *(void **)(this + 0xf8) = pvVar6;
      iVar4 = *(int *)(this + 0x308) + 1;
      goto LAB_001593f5;
    }
    pvVar6 = malloc(iVar7 << 3);
    *(void **)(this + 0xf8) = pvVar6;
  }
  iVar4 = *(int *)(this + 0x308) + 1;
LAB_001593f5:
  *(int *)(this + 0x308) = iVar4;
  iVar7 = iVar1 * 8;
  iVar4 = (iVar4 - iVar1) + -1;
  *(void **)(this + 0x30c) = pvVar6;
  if (0 < iVar4) {
    _V_memmove((void *)((int)pvVar6 + iVar7 + 8),(void *)((int)pvVar6 + iVar7),iVar4 * 8);
    pvVar6 = *(void **)(this + 0xf8);
  }
  *(int **)((int)pvVar6 + iVar7 + 4) = local_24;
  *(IHandleEntity **)(*(int *)(this + 0xf8) + iVar7) = param_1;
  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)