L L4D2node

ScriptPostSpawn

0x007dfa50 · 817 bytes · __cdecl

_Z15ScriptPostSpawnP13CScriptScopeTI19CDefScriptScopeBaseEPP11CBaseEntityi

Decompiled

undefined (3 params)

/* ScriptPostSpawn(CScriptScopeT<CDefScriptScopeBase>*, CBaseEntity**, int) */

void ScriptPostSpawn(CScriptScopeT *param_1,CBaseEntity **param_2,int param_3)

{
  code *pcVar1;
  void *pvVar2;
  char cVar3;
  int iVar4;
  char *pcVar5;
  undefined1 *puVar6;
  int iVar7;
  int in_GS_OFFSET;
  void **local_148;
  void *local_138 [2];
  short local_130;
  ushort local_12e;
  void *local_12c;
  undefined4 local_128;
  undefined2 local_124;
  ushort local_122;
  char local_120 [256];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if ((*(int *)param_1 != -1) &&
     (iVar4 = (**(code **)(*g_pScriptVM + 0x48))(g_pScriptVM,"PostSpawn",*(int *)param_1,0),
     iVar4 != 0)) {
    local_138[0] = (void *)0x0;
    local_130 = 0;
    local_12e = 0;
    iVar7 = 0;
    if (*(int *)param_1 != -1) {
      iVar7 = *(int *)param_1;
    }
                    /* try { // try from 007dfafe to 007dfb47 has its CatchHandler @ 007dfd88 */
    cVar3 = (**(code **)(*g_pScriptVM + 0x90))(g_pScriptVM,iVar7,"__EntityMakerResult",local_138);
    pvVar2 = local_138[0];
    if (cVar3 != '\0') {
      if (local_130 == 0x20) {
        if (0 < param_3) {
          iVar7 = 0;
          do {
            pcVar5 = *(char **)(param_2[iVar7] + 0x154);
            if (pcVar5 == (char *)0x0) {
              pcVar5 = "";
            }
                    /* try { // try from 007dfbd3 to 007dfbe7 has its CatchHandler @ 007dfd88 */
            V_strncpy(local_120,pcVar5,0x100);
            puVar6 = (undefined1 *)_V_strrchr(local_120,'&');
            if (puVar6 != (undefined1 *)0x0) {
              *puVar6 = 0;
            }
            pcVar1 = *(code **)(*g_pScriptVM + 0x78);
            if (param_2[iVar7] == (CBaseEntity *)0x0) {
              local_12c = (void *)0x0;
            }
            else {
              local_12c = (void *)CBaseEntity::GetScriptInstance(param_2[iVar7]);
            }
            local_124 = 0x20;
            local_122 = 0;
                    /* try { // try from 007dfb90 to 007dfb91 has its CatchHandler @ 007dfda5 */
            (*pcVar1)(g_pScriptVM,pvVar2,local_120,&local_12c);
            if ((local_122 & 1) != 0) {
              free(local_12c);
            }
            iVar7 = iVar7 + 1;
          } while (iVar7 != param_3);
        }
        local_148 = &local_12c;
        local_122 = 0;
        local_128 = 0;
        local_124 = 0x20;
        local_12c = pvVar2;
                    /* try { // try from 007dfc8d to 007dfc8f has its CatchHandler @ 007dfdb7 */
        (**(code **)(*g_pScriptVM + 0x50))(g_pScriptVM,iVar4,local_148,1,0,*(undefined4 *)param_1,1)
        ;
        if ((local_122 & 1) != 0) {
          free(local_12c);
        }
                    /* try { // try from 007dfccd to 007dfd54 has its CatchHandler @ 007dfd88 */
        iVar7 = (**(code **)(*g_pScriptVM + 0x48))
                          (g_pScriptVM,"__FinishSpawn",*(undefined4 *)param_1,0);
        if (iVar7 != 0) {
          (**(code **)(*g_pScriptVM + 0x50))(g_pScriptVM,iVar7,0,0,0,*(undefined4 *)param_1,1);
          (**(code **)(*g_pScriptVM + 0x4c))(g_pScriptVM,iVar7);
        }
      }
      (**(code **)(*g_pScriptVM + 0x9c))(g_pScriptVM,local_138);
    }
    (**(code **)(*g_pScriptVM + 0x4c))(g_pScriptVM,iVar4);
    if ((local_12e & 1) != 0) {
      free(local_138[0]);
    }
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)