L L4D2node

CGameEventManager::FindListener

0x00163b60 · 661 bytes · __thiscall

_ZN17CGameEventManager12FindListenerEP19IGameEventListener2PKc

Decompiled

undefined (3 params)

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

uint __thiscall
CGameEventManager::FindListener(CGameEventManager *this,IGameEventListener2 *param_1,char *param_2)

{
  CGameEventManager *pCVar1;
  uint uVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  int *piVar6;
  
  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_00163c1e;
    }
    (**(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_00163c1e:
                    /* try { // try from 00163c1e to 00163c22 has its CatchHandler @ 00163e15 */
  uVar3 = ThreadGetCurrentId();
  if (uVar3 == *(uint *)(this + 0x9c)) {
LAB_00163c3e:
    *(int *)(this + 0xa0) = *(int *)(this + 0xa0) + 1;
  }
  else {
    LOCK();
    uVar2 = *(uint *)pCVar1;
    if (uVar2 == 0) {
      *(uint *)pCVar1 = uVar3;
    }
    UNLOCK();
    if (uVar2 == 0) goto LAB_00163c3e;
                    /* try { // try from 00163dbc to 00163dc0 has its CatchHandler @ 00163e15 */
    CThreadFastMutex::Lock((uint)pCVar1,uVar3);
  }
                    /* try { // try from 00163c94 to 00163cf2 has its CatchHandler @ 00163e2a */
  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");
  }
  iVar4 = GetEventDescriptor(this,param_2,(int *)0x0);
  if ((iVar4 != 0) && (0 < *(int *)(this + 0x24))) {
    piVar6 = (int *)**(undefined4 **)(this + 0x18);
    if (param_1 != (IGameEventListener2 *)*piVar6) {
      iVar5 = 0;
      do {
        iVar5 = iVar5 + 1;
        if (iVar5 == *(int *)(this + 0x24)) goto LAB_00163d2a;
        piVar6 = (int *)(*(undefined4 **)(this + 0x18))[iVar5];
      } while (param_1 != (IGameEventListener2 *)*piVar6);
    }
    if (0 < (int)*(uint *)(iVar4 + 0x18)) {
      if (piVar6 == (int *)**(undefined4 **)(iVar4 + 0xc)) {
        uVar3 = 1;
      }
      else {
        uVar3 = 0;
        do {
          uVar3 = uVar3 + 1;
          if (uVar3 == *(uint *)(iVar4 + 0x18)) goto LAB_00163d2a;
        } while (piVar6 != (int *)(*(undefined4 **)(iVar4 + 0xc))[uVar3]);
        uVar3 = ~uVar3 >> 0x1f;
      }
      goto LAB_00163d2c;
    }
  }
LAB_00163d2a:
  uVar3 = 0;
LAB_00163d2c:
  *(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 uVar3;
}

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)