L L4D2node

IGameSystem::Add

0x00467fc0 · 570 bytes · __cdecl

_ZN11IGameSystem3AddEPS_

Decompiled

undefined (1 param)

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

void IGameSystem::Add(IGameSystem *param_1)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  iVar1 = DAT_00f7cd98;
  iVar2 = DAT_00f7cd98 + 1;
  if ((DAT_00f7cd90 < iVar2) && (-1 < DAT_00f7cd94)) {
    if (DAT_00f7cd94 == 0) {
      iVar3 = DAT_00f7cd90;
      if (DAT_00f7cd90 == 0) {
        if (iVar2 < 9) {
          DAT_00f7cd90 = 8;
          goto LAB_004680e7;
        }
        iVar3 = 8;
      }
      do {
        DAT_00f7cd90 = iVar3 * 2;
        if (iVar2 <= DAT_00f7cd90) break;
        DAT_00f7cd90 = iVar3 * 4;
        iVar3 = DAT_00f7cd90;
      } while (DAT_00f7cd90 < iVar2);
    }
    else {
      for (DAT_00f7cd90 = (DAT_00f7cd98 / DAT_00f7cd94 + 1) * DAT_00f7cd94; DAT_00f7cd90 < iVar2;
          DAT_00f7cd90 = (DAT_00f7cd90 + iVar2) / 2) {
      }
    }
LAB_004680e7:
    if (s_GameSystems == (void *)0x0) {
      s_GameSystems = malloc(DAT_00f7cd90 << 2);
    }
    else {
      s_GameSystems = realloc(s_GameSystems,DAT_00f7cd90 << 2);
      iVar2 = DAT_00f7cd98 + 1;
    }
  }
  iVar3 = iVar1 * 4;
  iVar1 = (iVar2 - iVar1) + -1;
  DAT_00f7cd98 = iVar2;
  _DAT_00f7cd9c = s_GameSystems;
  if (0 < iVar1) {
    _V_memmove((void *)((int)s_GameSystems + iVar3 + 4),(void *)((int)s_GameSystems + iVar3),
               iVar1 * 4);
  }
  if ((undefined4 *)(iVar3 + (int)s_GameSystems) != (undefined4 *)0x0) {
    *(undefined4 *)(iVar3 + (int)s_GameSystems) = param_1;
  }
  if (param_1 == (IGameSystem *)0x0) {
    return;
  }
  iVar1 = __dynamic_cast(param_1,&typeinfo,&IGameSystemPerFrame::typeinfo,0);
  iVar2 = DAT_00f7cd84;
  if (iVar1 == 0) {
    return;
  }
  iVar1 = DAT_00f7cd84 + 1;
  if ((iVar1 <= DAT_00f7cd7c) || (DAT_00f7cd80 < 0)) goto LAB_00468066;
  if (DAT_00f7cd80 == 0) {
    if (DAT_00f7cd7c == 0) {
      if (iVar1 < 9) {
        DAT_00f7cd7c = 8;
        goto LAB_00468157;
      }
      DAT_00f7cd7c = 8;
    }
    do {
      DAT_00f7cd7c = DAT_00f7cd7c * 2;
    } while (DAT_00f7cd7c < iVar1);
  }
  else {
    for (DAT_00f7cd7c = (DAT_00f7cd84 / DAT_00f7cd80 + 1) * DAT_00f7cd80; DAT_00f7cd7c < iVar1;
        DAT_00f7cd7c = (DAT_00f7cd7c + iVar1) / 2) {
    }
  }
LAB_00468157:
  if (s_GameSystemsPerFrame == (void *)0x0) {
    s_GameSystemsPerFrame = malloc(DAT_00f7cd7c << 2);
  }
  else {
    s_GameSystemsPerFrame = realloc(s_GameSystemsPerFrame,DAT_00f7cd7c << 2);
    iVar1 = DAT_00f7cd84 + 1;
  }
LAB_00468066:
  iVar3 = iVar2 * 4;
  iVar2 = (iVar1 - iVar2) + -1;
  DAT_00f7cd84 = iVar1;
  _DAT_00f7cd88 = s_GameSystemsPerFrame;
  if (0 < iVar2) {
    _V_memmove((void *)((int)s_GameSystemsPerFrame + iVar3 + 4),
               (void *)((int)s_GameSystemsPerFrame + iVar3),iVar2 * 4);
  }
  if ((undefined4 *)(iVar3 + (int)s_GameSystemsPerFrame) != (undefined4 *)0x0) {
    *(undefined4 *)(iVar3 + (int)s_GameSystemsPerFrame) = param_1;
  }
  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)