L L4D2node

CGameEventManager::AddListener

0x00164ef0 · 613 bytes · __thiscall

_ZN17CGameEventManager11AddListenerEP19IGameEventListener2PKcb

Decompiled

undefined (4 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CGameEventManager::AddListener(IGameEventListener2*, char const*, bool) */

undefined4 __thiscall
CGameEventManager::AddListener
          (CGameEventManager *this,IGameEventListener2 *param_1,char *param_2,bool param_3)

{
  CGameEventManager *pCVar1;
  uint uVar2;
  uint uVar3;
  CGameEventDescriptor *pCVar4;
  undefined4 uVar5;
  
  _param_3 = (uint)param_3;
  pCVar1 = this + 0x9c;
  if (_SetSeed != 0) {
    if (CTelemetryLock::CTelemetryLock(void*,char_const*)::s_bNameSet == '\0') {
      (**(code **)(_SetSeed + 0x5c))
                (_SetSeed,pCVar1,&CTelemetryLock::CTelemetryLock(void*,char_const*)::tm_fmt,
                 "CGameEventManager");
      CTelemetryLock::CTelemetryLock(void*,char_const*)::s_bNameSet = '\x01';
      if (_SetSeed == 0) goto LAB_00164fad;
    }
    (**(code **)(_SetSeed + 0x60))
              (_SetSeed,0,0,0,"/data/src/public/tier0/vprof_telemetry.h",0x3eb,pCVar1,
               &CTelemetryLock::CTelemetryLock(void*,char_const*)::tm_fmt,&DAT_002c48a3,
               "CGameEventManager");
  }
LAB_00164fad:
                    /* try { // try from 00164fad to 00164fb1 has its CatchHandler @ 001651a7 */
  uVar3 = ThreadGetCurrentId();
  if (uVar3 == *(uint *)(this + 0x9c)) {
LAB_00164fca:
    *(int *)(this + 0xa0) = *(int *)(this + 0xa0) + 1;
  }
  else {
    LOCK();
    uVar2 = *(uint *)pCVar1;
    if (uVar2 == 0) {
      *(uint *)pCVar1 = uVar3;
    }
    UNLOCK();
    if (uVar2 == 0) goto LAB_00164fca;
                    /* try { // try from 00165139 to 0016513d has its CatchHandler @ 001651a7 */
    CThreadFastMutex::Lock((uint)pCVar1,uVar3);
  }
                    /* try { // try from 00165020 to 001650b0 has its CatchHandler @ 00165167 */
  if ((_SetSeed != 0) &&
     ((**(code **)(_SetSeed + 100))
                (_SetSeed,0,0,"/data/src/public/tier0/vprof_telemetry.h",0x3f3,
                 &CTelemetryLock::Locked()::tm_fmt,pCVar1,0), _SetSeed != 0)) {
    (**(code **)(_SetSeed + 0x6c))
              (_SetSeed,pCVar1,2,"/data/src/public/tier0/vprof_telemetry.h",0x3f4,
               &CTelemetryLock::Locked()::tm_fmt,"%s Locked","CGameEventManager");
  }
  if (param_2 != (char *)0x0) {
    pCVar4 = (CGameEventDescriptor *)GetEventDescriptor(this,param_2,(int *)0x0);
    if (pCVar4 != (CGameEventDescriptor *)0x0) {
      uVar5 = AddListener(this,param_1,pCVar4,_param_3 ^ 1);
      goto LAB_001650b1;
    }
                    /* try { // try from 00165156 to 0016515a has its CatchHandler @ 00165167 */
    DevMsg("CGameEventManager::AddListener: event \'%s\' unknown.\n",param_2);
  }
  uVar5 = 0;
LAB_001650b1:
  *(int *)(this + 0xa0) = *(int *)(this + 0xa0) + -1;
  if (*(int *)(this + 0xa0) == 0) {
    LOCK();
    *(uint *)pCVar1 = 0;
    UNLOCK();
  }
  if ((pCVar1 != (CGameEventManager *)0x0) && (_SetSeed != 0)) {
    (**(code **)(_SetSeed + 0x6c))
              (_SetSeed,pCVar1,1,"/data/src/public/tier0/vprof_telemetry.h",0x3fa,
               &CTelemetryLock::Unlocked()::tm_fmt,"%s Released","CGameEventManager");
  }
  return uVar5;
}

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)