L L4D2node

CGameEventManager::FireEventIntern

0x00161f50 · 1796 bytes · __thiscall

_ZN17CGameEventManager15FireEventInternEP10IGameEventbb

Decompiled

undefined (4 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CGameEventManager::FireEventIntern(IGameEvent*, bool, bool) */

undefined4 __thiscall
CGameEventManager::FireEventIntern
          (CGameEventManager *this,IGameEvent *param_1,bool param_2,bool param_3)

{
  uint *puVar1;
  uint uVar2;
  undefined4 *puVar3;
  int *piVar4;
  char cVar5;
  CGameEventManager *pCVar6;
  uint uVar7;
  int iVar8;
  int iVar9;
  undefined4 uVar10;
  int iVar11;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  CGameEventManager *local_3c;
  char *local_38;
  undefined4 local_34;
  undefined4 local_30;
  int local_2c;
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  local_38 = "CGameEventManager";
  pCVar6 = this + 0x9c;
  local_3c = pCVar6;
  if (_SetSeed != 0) {
    if (CTelemetryLock::CTelemetryLock(void*,char_const*)::s_bNameSet == '\0') {
      (**(code **)(_SetSeed + 0x5c))
                (_SetSeed,pCVar6,&CTelemetryLock::CTelemetryLock(void*,char_const*)::tm_fmt,
                 "CGameEventManager");
      CTelemetryLock::CTelemetryLock(void*,char_const*)::s_bNameSet = '\x01';
      if (_SetSeed == 0) goto LAB_0016201e;
    }
    (**(code **)(_SetSeed + 0x60))
              (_SetSeed,0,0,0,"/data/src/public/tier0/vprof_telemetry.h",0x3eb,local_3c,
               &CTelemetryLock::CTelemetryLock(void*,char_const*)::tm_fmt,&DAT_002c48a3,local_38);
  }
LAB_0016201e:
                    /* try { // try from 0016201e to 00162022 has its CatchHandler @ 00162680 */
  uVar7 = ThreadGetCurrentId();
  if (uVar7 != *(uint *)(this + 0x9c)) {
    LOCK();
    uVar2 = *(uint *)pCVar6;
    if (uVar2 == 0) {
      *(uint *)pCVar6 = uVar7;
    }
    UNLOCK();
    if (uVar2 != 0) {
                    /* try { // try from 001625dd to 001625e1 has its CatchHandler @ 00162680 */
      CThreadFastMutex::Lock((uint)pCVar6,uVar7);
      goto LAB_00162056;
    }
  }
  *(int *)(this + 0xa0) = *(int *)(this + 0xa0) + 1;
LAB_00162056:
                    /* try { // try from 0016209d to 00162167 has its CatchHandler @ 0016272e */
  if ((_SetSeed != 0) &&
     ((**(code **)(_SetSeed + 100))
                (_SetSeed,0,0,"/data/src/public/tier0/vprof_telemetry.h",0x3f3,
                 &CTelemetryLock::Locked()::tm_fmt,local_3c,0), _SetSeed != 0)) {
    (**(code **)(_SetSeed + 0x6c))
              (_SetSeed,local_3c,2,"/data/src/public/tier0/vprof_telemetry.h",0x3f4,
               &CTelemetryLock::Locked()::tm_fmt,"%s Locked",local_38);
  }
  if (param_1 == (IGameEvent *)0x0) {
    uVar10 = 0;
  }
  else {
    local_4c = 0;
    local_48 = 0;
    if (_exit == 0) {
      local_2c = 0;
    }
    else {
      (**(code **)(_exit + 0x50))
                (_exit,&local_4c,0,0,0,0,"/data/src/engine/./gameeventmanager.cpp",0x1e3,
                 &FireEventIntern(IGameEvent*,bool,bool)::tm_fmt,"(%s)%s","Unaccounted",
                 "CGameEventManager::FireEvent");
      local_2c = _exit;
    }
    iVar8 = _DAT_0040b9d4;
    uVar7 = 1;
    if (!param_3) {
      uVar7 = (-(uint)!param_2 & 2) + 2;
    }
    local_34 = local_4c;
    local_30 = local_48;
                    /* try { // try from 001622b6 to 00162311 has its CatchHandler @ 00162732 */
    if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
       (iVar11 = ThreadGetCurrentId(), iVar8 == iVar11)) {
      if ((char *)*_DAT_0040b030 != "CGameEventManager::FireEvent") {
        _DAT_0040b030 =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2af87a,&DAT_00000001,0x2a054b);
      }
      puVar1 = (uint *)(_DAT_0040b0bc + 4 + _DAT_0040b030[0x1c] * 8);
      *puVar1 = *puVar1 | uVar7;
      CVProfNode::EnterScope();
      DAT_0040b02c = '\0';
    }
    iVar8 = GetEventDescriptor(this,param_1);
    if (iVar8 == 0) {
                    /* try { // try from 00162651 to 00162678 has its CatchHandler @ 00162736 */
      uVar10 = (**(code **)(*(int *)param_1 + 8))(param_1);
      DevMsg("FireEvent: event \'%s\' not registered.\n",uVar10);
      (**(code **)(*(int *)this + 0x2c))(this,param_1);
      uVar10 = 0;
    }
    else {
      local_44 = 0;
      local_40 = 0;
      if (_g_Telemetry == 0) {
        local_20 = 0;
      }
      else {
                    /* try { // try from 00162237 to 00162239 has its CatchHandler @ 00162736 */
        (**(code **)(_g_Telemetry + 0x50))
                  (_g_Telemetry,&local_44,0,0x32,0,0,"/data/src/engine/./gameeventmanager.cpp",0x1ee
                   ,&FireEventIntern(IGameEvent*,bool,bool)::tm_fmt,"%s %d","FireEventIntern",
                   *(undefined4 *)(iVar8 + 0x18));
        local_20 = _g_Telemetry;
      }
      local_28 = local_44;
      local_24 = local_40;
      if ((1 < *(int *)(net_showevents._28_4_ + 0x30)) && (!param_3)) {
                    /* try { // try from 00162623 to 00162639 has its CatchHandler @ 00162695 */
        ConMsg("Server event \"%s\", Tick %i:\n",
               *(undefined4 *)(*(int *)(iVar8 + 4) * 0x18 + *(int *)(this + 0x7c) + 0x10),
               DAT_003b7f6c);
        ConPrintEvent(this,param_1);
      }
      if (0 < *(int *)(iVar8 + 0x18)) {
        iVar11 = 0;
        do {
          puVar3 = *(undefined4 **)(*(int *)(iVar8 + 0xc) + iVar11 * 4);
          iVar9 = puVar3[1];
          if ((iVar9 == 3) || (iVar9 == 0)) {
            if ((!param_3) && ((iVar9 != 1 && (iVar9 != 4)))) {
LAB_0016232f:
              if (iVar9 != 2) goto LAB_00162338;
LAB_0016250a:
              if (((!param_3) && (!param_2)) && (*(char *)(iVar8 + 0x20) == '\0')) {
                piVar4 = (int *)*puVar3;
joined_r0x0016252c:
                if (piVar4 == (int *)0x0) {
                    /* try { // try from 00162543 to 001625c3 has its CatchHandler @ 00162695 */
                  uVar10 = (**(code **)(*(int *)param_1 + 8))(param_1);
                  Warning("Callback for event \"%s\" is NULL!!!\n",uVar10);
                }
                else {
                    /* try { // try from 00162353 to 001623aa has its CatchHandler @ 00162695 */
                  iVar9 = (**(code **)(*piVar4 + 0xc))(piVar4);
                  if (iVar9 == 0x2a) {
                    (**(code **)(*piVar4 + 8))(piVar4,param_1);
                  }
                  else {
                    uVar10 = (**(code **)(*(int *)param_1 + 8))(param_1);
                    Msg("GameEventListener2 callback in list that should NOT be - %s!\n",uVar10);
                  }
                }
              }
            }
          }
          else if ((iVar9 == 4) || (iVar9 == 1)) {
            if (param_3) goto LAB_0016232f;
          }
          else {
            if (iVar9 == 2) goto LAB_0016250a;
LAB_00162338:
            if (1 < iVar9 - 3U) {
              piVar4 = (int *)*puVar3;
              goto joined_r0x0016252c;
            }
            (**(code **)(*(int *)*puVar3 + 8))((int *)*puVar3,*(undefined4 *)(param_1 + 8));
          }
          iVar11 = iVar11 + 1;
        } while (iVar11 < *(int *)(iVar8 + 0x18));
      }
      if (param_3) {
        CGameEventTransmitter::TransmitGameEvent
                  ((CGameEventTransmitter *)s_GameEventTransmitter,param_1);
      }
      (**(code **)(*(int *)this + 0x2c))(this,param_1);
      uVar10 = 1;
      if (local_20 != 0) {
        (**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
      }
    }
    iVar8 = _DAT_0040b9d4;
    if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
       (iVar11 = ThreadGetCurrentId(), iVar8 == iVar11)) {
      cVar5 = CVProfNode::ExitScope();
      if (cVar5 != '\0') {
        _DAT_0040b030 = (int *)_DAT_0040b030[0x19];
      }
      DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
    }
    if (local_2c != 0) {
      (**(code **)(local_2c + 0x54))(local_2c,local_34,local_30,0,0,0);
    }
  }
  *(int *)(this + 0xa0) = *(int *)(this + 0xa0) + -1;
  if (*(int *)(this + 0xa0) == 0) {
    LOCK();
    *(uint *)pCVar6 = 0;
    UNLOCK();
  }
  if ((local_3c != (CGameEventManager *)0x0) && (_SetSeed != 0)) {
    (**(code **)(_SetSeed + 0x6c))
              (_SetSeed,local_3c,1,"/data/src/public/tier0/vprof_telemetry.h",0x3fa,
               &CTelemetryLock::Unlocked()::tm_fmt,"%s Released",local_38);
  }
  return uVar10;
}

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)