L L4D2node

foundry_select_entity

0x006aa840 · 577 bytes · __cdecl

_ZL21foundry_select_entityRK8CCommand

Decompiled

undefined (1 param)

/* foundry_select_entity(CCommand const&) */

void foundry_select_entity(CCommand *param_1)

{
  undefined4 uVar1;
  int iVar2;
  size_t __size;
  int *piVar3;
  int iVar4;
  int iVar5;
  int **ppiVar6;
  int iVar7;
  int *local_80;
  int local_44 [5];
  void *local_30;
  int local_2c;
  int local_28;
  int local_24;
  void *local_20;
  
  ppiVar6 = (int **)&stack0xffffff84;
  local_80 = (int *)0x6aa84e;
  iVar2 = CheckInFoundryMode();
  if (iVar2 == 0) {
    return;
  }
  local_44[0] = 0;
  local_44[1] = 0;
  local_44[2] = 0;
  local_44[3] = 0;
  local_44[4] = 0;
                    /* try { // try from 006aa886 to 006aa88a has its CatchHandler @ 006aaae7 */
  local_80 = (int *)0x6aa88b;
  GetCrosshairOrNamedEntities(param_1,(CUtlVector *)local_44);
  local_30 = (void *)0x0;
  local_2c = 0;
  local_28 = 0;
  local_24 = 0;
  local_20 = (void *)0x0;
  if (0 < local_44[3]) {
    iVar2 = 0;
    do {
      iVar5 = local_24;
      iVar4 = local_24 + 1;
      uVar1 = *(undefined4 *)(*(int *)(local_44[0] + iVar2 * 4) + 0x88);
      if ((local_2c < iVar4) && (-1 < local_28)) {
        if (local_28 == 0) {
          if (local_2c == 0) {
            if (iVar4 < 9) {
              local_2c = 8;
              goto LAB_006aa93f;
            }
            local_2c = 8;
          }
          do {
            iVar7 = local_2c;
            local_2c = iVar7 * 2;
          } while (local_2c < iVar4);
          __size = iVar7 << 3;
        }
        else {
          for (local_2c = (local_24 / local_28 + 1) * local_28; local_2c < iVar4;
              local_2c = (local_2c + iVar4) / 2) {
          }
LAB_006aa93f:
          __size = local_2c << 2;
        }
        if (local_30 == (void *)0x0) {
          local_80 = (int *)0x6aa9b8;
          local_30 = malloc(__size);
        }
        else {
          local_80 = (int *)0x6aa955;
          local_30 = realloc(local_30,__size);
          iVar4 = local_24 + 1;
        }
      }
      iVar7 = iVar5 * 4;
      iVar5 = (iVar4 - iVar5) + -1;
      local_24 = iVar4;
      local_20 = local_30;
      if (0 < iVar5) {
                    /* try { // try from 006aa97d to 006aaa8a has its CatchHandler @ 006aaa9a */
        local_80 = (int *)0x6aa982;
        _V_memmove((void *)((int)local_30 + iVar7 + 4),(void *)((int)local_30 + iVar7),iVar5 * 4);
      }
      if ((undefined4 *)(iVar7 + (int)local_30) != (undefined4 *)0x0) {
        *(undefined4 *)(iVar7 + (int)local_30) = uVar1;
      }
      iVar2 = iVar2 + 1;
    } while (iVar2 < local_44[3]);
    if (local_24 != 0) {
      local_80 = (int *)0x6aa9e8;
      (**(code **)(*serverfoundry + 0x20))();
      ppiVar6 = (int **)&stack0xffffff84;
      goto LAB_006aa9e8;
    }
  }
  local_80 = (int *)0x6aaa3d;
  piVar3 = (int *)CheckInFoundryMode();
  if (piVar3 != (int *)0x0) {
    local_80 = (int *)0x6aaa55;
    (**(code **)(*piVar3 + 0x234))();
    ppiVar6 = &local_80;
    local_80 = serverfoundry;
    (**(code **)(*serverfoundry + 0x24))();
  }
LAB_006aa9e8:
  local_24 = 0;
  *ppiVar6 = (int *)&local_30;
  ppiVar6[-1] = (int *)0x6aa9fa;
  CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)*ppiVar6);
  *ppiVar6 = (int *)&local_30;
  local_20 = local_30;
  ppiVar6[-1] = (int *)0x6aaa08;
  CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)*ppiVar6);
  local_44[3] = 0;
  *ppiVar6 = local_44;
  ppiVar6[-1] = (int *)0x6aaa1a;
  CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)*ppiVar6);
  local_44[4] = local_44[0];
  *ppiVar6 = local_44;
  ppiVar6[-1] = (int *)0x6aaa2b;
  CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)*ppiVar6);
  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)