L L4D2node

AddRestoredEntity

0x006c9f20 · 268 bytes · __cdecl

_Z17AddRestoredEntityP11CBaseEntity

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* AddRestoredEntity(CBaseEntity*) */

void AddRestoredEntity(CBaseEntity *param_1)

{
  undefined4 uVar1;
  undefined4 *puVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  
  if (param_1 == (CBaseEntity *)0x0) {
    return;
  }
  puVar2 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
  iVar4 = DAT_00fe32c0;
  uVar1 = *puVar2;
  iVar3 = DAT_00fe32c0 + 1;
  if ((iVar3 <= DAT_00fe32b8) || (DAT_00fe32bc < 0)) goto LAB_006c9f51;
  if (DAT_00fe32bc == 0) {
    iVar5 = DAT_00fe32b8;
    if (DAT_00fe32b8 == 0) {
      if (iVar3 < 9) {
        DAT_00fe32b8 = 8;
        goto LAB_006c9fc7;
      }
      iVar5 = 8;
    }
    do {
      DAT_00fe32b8 = iVar5 * 2;
      if (iVar3 <= DAT_00fe32b8) break;
      DAT_00fe32b8 = iVar5 * 4;
      iVar5 = DAT_00fe32b8;
    } while (DAT_00fe32b8 < iVar3);
  }
  else {
    for (DAT_00fe32b8 = (DAT_00fe32c0 / DAT_00fe32bc + 1) * DAT_00fe32bc; DAT_00fe32b8 < iVar3;
        DAT_00fe32b8 = (DAT_00fe32b8 + iVar3) / 2) {
    }
  }
LAB_006c9fc7:
  if (g_RestoredEntities == (void *)0x0) {
    g_RestoredEntities = malloc(DAT_00fe32b8 << 2);
  }
  else {
    g_RestoredEntities = realloc(g_RestoredEntities,DAT_00fe32b8 << 2);
    iVar3 = DAT_00fe32c0 + 1;
  }
LAB_006c9f51:
  iVar5 = iVar4 * 4;
  iVar4 = (iVar3 - iVar4) + -1;
  DAT_00fe32c0 = iVar3;
  _DAT_00fe32c4 = g_RestoredEntities;
  if (0 < iVar4) {
    _V_memmove((void *)((int)g_RestoredEntities + iVar5 + 4),
               (void *)((int)g_RestoredEntities + iVar5),iVar4 * 4);
  }
  if ((undefined4 *)(iVar5 + (int)g_RestoredEntities) != (undefined4 *)0x0) {
    *(undefined4 *)(iVar5 + (int)g_RestoredEntities) = uVar1;
  }
  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)