L L4D2node

CEventQueue::ServiceEvents

0x0063c970 · 1969 bytes · __thiscall

_ZN11CEventQueue13ServiceEventsEv

Decompiled

undefined (1 param)

/* CEventQueue::ServiceEvents() */

void __thiscall CEventQueue::ServiceEvents(CEventQueue *this)

{
  float *pfVar1;
  int *piVar2;
  void *pvVar3;
  int iVar4;
  bool bVar5;
  int *piVar6;
  void *pvVar7;
  char cVar8;
  undefined1 *puVar9;
  float fVar10;
  undefined1 *puVar11;
  char *pcVar12;
  undefined1 *puVar13;
  CBaseEntity *pCVar14;
  undefined *puVar15;
  undefined4 uVar16;
  int in_GS_OFFSET;
  longdouble lVar17;
  float local_160;
  CBaseEntity *local_154;
  CBaseEntity *local_14c;
  CBaseEntity *local_148;
  undefined4 local_144;
  float local_134;
  float local_130;
  float local_12c;
  float local_128;
  float local_124;
  char local_120 [256];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if ((CBaseEntity::m_bDebugPause != '\0') && (CBaseEntity::m_nDebugSteps < 1)) {
LAB_0063ce14:
    if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
      __stack_chk_fail();
    }
    return;
  }
  pfVar1 = *(float **)(this + 0x30);
  lVar17 = (longdouble)Plat_FloatTime();
  local_160 = (float)lVar17;
  piVar6 = mdlcache;
  do {
    mdlcache = piVar6;
    if ((pfVar1 == (float *)0x0) || (*(float *)(gpGlobals + 0xc) < *pfVar1)) goto LAB_0063ce14;
    (**(code **)(*piVar6 + 0x68))(piVar6);
    pcVar12 = (char *)pfVar1[1];
    if (pcVar12 == (char *)0x0) {
      bVar5 = false;
    }
    else {
      local_154 = (CBaseEntity *)0x0;
      fVar10 = pfVar1[4];
      if (((fVar10 != -NAN) &&
          (puVar15 = g_pEntityList + ((uint)fVar10 & 0xfff) * 0x10,
          puVar15 != (undefined *)0xfffffffc)) && (*(uint *)(puVar15 + 8) == (uint)fVar10 >> 0xc)) {
        local_154 = *(CBaseEntity **)(puVar15 + 4);
      }
      pCVar14 = (CBaseEntity *)0x0;
      bVar5 = false;
      while( true ) {
        local_148 = (CBaseEntity *)0x0;
        if (((fVar10 != -NAN) &&
            (puVar15 = g_pEntityList + ((uint)fVar10 & 0xfff) * 0x10,
            puVar15 != (undefined *)0xfffffffc)) && (*(uint *)(puVar15 + 8) == (uint)fVar10 >> 0xc))
        {
          local_148 = *(CBaseEntity **)(puVar15 + 4);
        }
        local_14c = (CBaseEntity *)0x0;
        fVar10 = pfVar1[3];
        if (((fVar10 != -NAN) &&
            (puVar15 = g_pEntityList + ((uint)fVar10 & 0xfff) * 0x10,
            puVar15 != (undefined *)0xfffffffc)) && (*(uint *)(puVar15 + 8) == (uint)fVar10 >> 0xc))
        {
          local_14c = *(CBaseEntity **)(puVar15 + 4);
        }
        if (pcVar12 == (char *)0x0) {
          pcVar12 = "";
        }
                    /* try { // try from 0063cae5 to 0063cdf4 has its CatchHandler @ 0063d137 */
        pCVar14 = (CBaseEntity *)
                  CGlobalEntityList::FindEntityByName
                            ((CGlobalEntityList *)gEntList,pCVar14,pcVar12,local_154,local_14c,
                             local_148,(IEntityFindFilter *)0x0);
        if (pCVar14 == (CBaseEntity *)0x0) break;
        local_144 = 0;
        local_134 = pfVar1[7];
        local_130 = pfVar1[8];
        local_12c = pfVar1[9];
        local_128 = pfVar1[10];
        local_124 = pfVar1[0xb];
        fVar10 = pfVar1[4];
        if (((fVar10 != -NAN) &&
            (puVar15 = g_pEntityList + ((uint)fVar10 & 0xfff) * 0x10,
            puVar15 != (undefined *)0xfffffffc)) && (*(uint *)(puVar15 + 8) == (uint)fVar10 >> 0xc))
        {
          local_144 = *(undefined4 *)(puVar15 + 4);
        }
        fVar10 = pfVar1[3];
        uVar16 = 0;
        if (((fVar10 != -NAN) &&
            (puVar15 = g_pEntityList + ((uint)fVar10 & 0xfff) * 0x10,
            puVar15 != (undefined *)0xfffffffc)) && (*(uint *)(puVar15 + 8) == (uint)fVar10 >> 0xc))
        {
          uVar16 = *(undefined4 *)(puVar15 + 4);
        }
        puVar9 = (undefined1 *)pfVar1[2];
        if (puVar9 == (undefined1 *)0x0) {
          puVar9 = &DAT_00d539c2;
        }
        (**(code **)(*(int *)pCVar14 + 0xb4))(pCVar14,puVar9,uVar16,local_144,&local_134,pfVar1[5]);
        bVar5 = true;
        pcVar12 = (char *)pfVar1[1];
        fVar10 = pfVar1[4];
      }
    }
    fVar10 = pfVar1[6];
    if ((((fVar10 == -NAN) ||
         (puVar15 = g_pEntityList + ((uint)fVar10 & 0xfff) * 0x10,
         puVar15 == (undefined *)0xfffffffc)) || (*(uint *)(puVar15 + 8) != (uint)fVar10 >> 0xc)) ||
       (piVar2 = *(int **)(puVar15 + 4), piVar2 == (int *)0x0)) {
      if (!bVar5) {
        pcVar12 = (char *)pfVar1[1];
        pCVar14 = (CBaseEntity *)0x0;
        if (pcVar12 != (char *)0x0) {
          while (pCVar14 = (CBaseEntity *)
                           CGlobalEntityList::FindEntityByClassname
                                     ((CGlobalEntityList *)gEntList,pCVar14,pcVar12),
                pCVar14 != (CBaseEntity *)0x0) {
            local_144 = 0;
            local_134 = pfVar1[7];
            local_130 = pfVar1[8];
            local_12c = pfVar1[9];
            local_128 = pfVar1[10];
            local_124 = pfVar1[0xb];
            fVar10 = pfVar1[4];
            if (((fVar10 != -NAN) &&
                (puVar15 = g_pEntityList + ((uint)fVar10 & 0xfff) * 0x10,
                puVar15 != (undefined *)0xfffffffc)) &&
               (*(uint *)(puVar15 + 8) == (uint)fVar10 >> 0xc)) {
              local_144 = *(undefined4 *)(puVar15 + 4);
            }
            fVar10 = pfVar1[3];
            uVar16 = 0;
            if (((fVar10 != -NAN) &&
                (puVar15 = g_pEntityList + ((uint)fVar10 & 0xfff) * 0x10,
                puVar15 != (undefined *)0xfffffffc)) &&
               (*(uint *)(puVar15 + 8) == (uint)fVar10 >> 0xc)) {
              uVar16 = *(undefined4 *)(puVar15 + 4);
            }
            puVar9 = (undefined1 *)pfVar1[2];
            if (puVar9 == (undefined1 *)0x0) {
              puVar9 = &DAT_00d539c2;
            }
                    /* try { // try from 0063cf16 to 0063cfec has its CatchHandler @ 0063d137 */
            (**(code **)(*(int *)pCVar14 + 0xb4))
                      (pCVar14,puVar9,uVar16,local_144,&local_134,pfVar1[5]);
            pcVar12 = (char *)pfVar1[1];
            bVar5 = true;
            if (pcVar12 == (char *)0x0) {
              pcVar12 = "";
            }
          }
          if (bVar5) goto LAB_0063cd22;
          pCVar14 = (CBaseEntity *)pfVar1[1];
        }
        fVar10 = pfVar1[4];
        if ((((fVar10 == -NAN) ||
             (puVar15 = g_pEntityList + ((uint)fVar10 & 0xfff) * 0x10,
             puVar15 == (undefined *)0xfffffffc)) || (*(uint *)(puVar15 + 8) != (uint)fVar10 >> 0xc)
            ) || (iVar4 = *(int *)(puVar15 + 4), iVar4 == 0)) {
          puVar11 = &DAT_00d539c2;
          puVar9 = &DAT_00d539c2;
        }
        else {
          puVar9 = *(undefined1 **)(iVar4 + 0x7c);
          puVar11 = *(undefined1 **)(iVar4 + 0x154);
          if (puVar9 == (undefined1 *)0x0) {
            puVar9 = &DAT_00d539c2;
          }
          if (puVar11 == (undefined1 *)0x0) {
            puVar11 = &DAT_00d539c2;
          }
        }
        if (pCVar14 == (CBaseEntity *)0x0) {
          pCVar14 = (CBaseEntity *)&DAT_00d539c2;
        }
        puVar13 = &DAT_00d539c2;
        if ((undefined1 *)pfVar1[2] != (undefined1 *)0x0) {
          puVar13 = (undefined1 *)pfVar1[2];
        }
                    /* try { // try from 0063d0b0 to 0063d0cc has its CatchHandler @ 0063d137 */
        V_snprintf(local_120,0x100,
                   "unhandled input: (%s) -> (%s), from (%s,%s); target entity not found\n",puVar13,
                   pCVar14,puVar9,puVar11);
        DevMsg(2,"%s",local_120);
      }
    }
    else {
      local_144 = 0;
      local_134 = pfVar1[7];
      local_130 = pfVar1[8];
      local_12c = pfVar1[9];
      local_128 = pfVar1[10];
      local_124 = pfVar1[0xb];
      fVar10 = pfVar1[4];
      if (((fVar10 != -NAN) &&
          (puVar15 = g_pEntityList + ((uint)fVar10 & 0xfff) * 0x10,
          puVar15 != (undefined *)0xfffffffc)) && (*(uint *)(puVar15 + 8) == (uint)fVar10 >> 0xc)) {
        local_144 = *(undefined4 *)(puVar15 + 4);
      }
      fVar10 = pfVar1[3];
      uVar16 = 0;
      if (((fVar10 != -NAN) &&
          (puVar15 = g_pEntityList + ((uint)fVar10 & 0xfff) * 0x10,
          puVar15 != (undefined *)0xfffffffc)) && (*(uint *)(puVar15 + 8) == (uint)fVar10 >> 0xc)) {
        uVar16 = *(undefined4 *)(puVar15 + 4);
      }
      puVar9 = &DAT_00d539c2;
      if ((undefined1 *)pfVar1[2] != (undefined1 *)0x0) {
        puVar9 = (undefined1 *)pfVar1[2];
      }
      (**(code **)(*piVar2 + 0xb4))(piVar2,puVar9,uVar16,local_144,&local_134,pfVar1[5]);
    }
LAB_0063cd22:
    *(float *)((int)pfVar1[0xd] + 0x30) = pfVar1[0xc];
    if (pfVar1[0xc] != 0.0) {
      *(float *)((int)pfVar1[0xc] + 0x34) = pfVar1[0xd];
    }
    CUtlMemoryPool::Free((CUtlMemoryPool *)EventQueuePrioritizedEvent_t::s_Allocator,pfVar1);
    if ((CBaseEntity::m_bDebugPause != '\0') &&
       ((CBaseEntity::m_nDebugSteps < 1 ||
        (CBaseEntity::m_nDebugSteps = CBaseEntity::m_nDebugSteps + -1,
        CBaseEntity::m_nDebugSteps == 0)))) {
      (**(code **)(*piVar6 + 0x6c))(piVar6);
      goto LAB_0063ce14;
    }
    lVar17 = (longdouble)Plat_FloatTime();
    if (2.0 < (float)lVar17 - local_160) {
      Msg("Possible entity I/O race condition!\n");
      cVar8 = Plat_IsInDebugSession(0);
      if (cVar8 == '\0') {
        Warning("Entity I/O took to long! Aborting!\n");
        pvVar7 = *(void **)(this + 0x30);
        while (pvVar7 != (void *)0x0) {
          pvVar3 = *(void **)((int)pvVar7 + 0x30);
          CUtlMemoryPool::Free((CUtlMemoryPool *)EventQueuePrioritizedEvent_t::s_Allocator,pvVar7);
          pvVar7 = pvVar3;
        }
        *(undefined4 *)(this + 0x30) = 0;
        (**(code **)(*piVar6 + 0x6c))(piVar6);
        goto LAB_0063ce14;
      }
      lVar17 = (longdouble)Plat_FloatTime();
      local_160 = (float)lVar17;
    }
    pfVar1 = *(float **)(this + 0x30);
    (**(code **)(*piVar6 + 0x6c))(piVar6);
    piVar6 = mdlcache;
  } while( true );
}

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)