L L4D2node

CGameEventManager::RemoveListener

0x00164120 · 816 bytes · __thiscall

_ZN17CGameEventManager14RemoveListenerEP19IGameEventListener2

Decompiled

undefined (2 params)

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

uint __thiscall
CGameEventManager::RemoveListener(CGameEventManager *this,IGameEventListener2 *param_1)

{
  CGameEventManager *pCVar1;
  uint uVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  CGameEventCallback **local_30;
  CGameEventCallback *local_28;
  CGameEventManager *local_24;
  char *local_20;
  
  local_20 = "CGameEventManager";
  pCVar1 = this + 0x9c;
  local_24 = pCVar1;
  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_001641de;
    }
    (**(code **)(_SetSeed + 0x60))
              (_SetSeed,0,0,0,"/data/src/public/tier0/vprof_telemetry.h",0x3eb,local_24,
               &CTelemetryLock::CTelemetryLock(void*,char_const*)::tm_fmt,&DAT_002c48a3,local_20);
  }
LAB_001641de:
                    /* try { // try from 001641de to 001641e2 has its CatchHandler @ 00164469 */
  uVar3 = ThreadGetCurrentId();
  if (uVar3 != *(uint *)(this + 0x9c)) {
    LOCK();
    uVar2 = *(uint *)pCVar1;
    if (uVar2 == 0) {
      *(uint *)pCVar1 = uVar3;
    }
    UNLOCK();
    if (uVar2 != 0) {
                    /* try { // try from 0016435c to 00164360 has its CatchHandler @ 00164469 */
      CThreadFastMutex::Lock((uint)pCVar1,uVar3);
      goto LAB_0016420d;
    }
  }
  *(int *)(this + 0xa0) = *(int *)(this + 0xa0) + 1;
LAB_0016420d:
                    /* try { // try from 00164254 to 0016429b has its CatchHandler @ 0016447e */
  if ((_SetSeed != 0) &&
     ((**(code **)(_SetSeed + 100))
                (_SetSeed,0,0,"/data/src/public/tier0/vprof_telemetry.h",0x3f3,
                 &CTelemetryLock::Locked()::tm_fmt,local_24,0), _SetSeed != 0)) {
    (**(code **)(_SetSeed + 0x6c))
              (_SetSeed,local_24,2,"/data/src/public/tier0/vprof_telemetry.h",0x3f4,
               &CTelemetryLock::Locked()::tm_fmt,"%s Locked",local_20);
  }
  if (*(int *)(this + 0x24) < 1) {
LAB_001642ca:
    local_28 = (CGameEventCallback *)0x0;
    *(int *)(this + 0xa0) = *(int *)(this + 0xa0) + -1;
    uVar3 = *(uint *)(this + 0xa0);
    if (uVar3 == 0) {
      LOCK();
      uVar3 = *(uint *)pCVar1;
      *(uint *)pCVar1 = 0;
      UNLOCK();
    }
    if ((local_24 != (CGameEventManager *)0x0) && (uVar3 = 0, _SetSeed != 0)) {
      uVar3 = (**(code **)(_SetSeed + 0x6c))
                        (_SetSeed,local_24,1,"/data/src/public/tier0/vprof_telemetry.h",0x3fa,
                         &CTelemetryLock::Unlocked()::tm_fmt,"%s Released",local_20);
    }
  }
  else {
    local_28 = (CGameEventCallback *)**(undefined4 **)(this + 0x18);
    if (param_1 != *(IGameEventListener2 **)local_28) {
      iVar4 = 0;
      do {
        iVar4 = iVar4 + 1;
        if (iVar4 == *(int *)(this + 0x24)) goto LAB_001642ca;
        local_28 = (CGameEventCallback *)(*(undefined4 **)(this + 0x18))[iVar4];
      } while (param_1 != *(IGameEventListener2 **)local_28);
    }
    if (0 < *(int *)(this + 0x10)) {
      iVar4 = 0;
      iVar5 = 0;
      do {
                    /* try { // try from 001643a2 to 001643c3 has its CatchHandler @ 0016447e */
        CUtlVector<CGameEventCallback*,CUtlMemory<CGameEventCallback*,int>>::FindAndRemove
                  ((CUtlVector<CGameEventCallback*,CUtlMemory<CGameEventCallback*,int>> *)
                   (*(int *)(this + 4) + iVar5 + 0xc),&local_28);
        iVar4 = iVar4 + 1;
        iVar5 = iVar5 + 0x34;
      } while (iVar4 < *(int *)(this + 0x10));
    }
    local_30 = &local_28;
    CUtlVector<CGameEventCallback*,CUtlMemory<CGameEventCallback*,int>>::FindAndRemove
              ((CUtlVector<CGameEventCallback*,CUtlMemory<CGameEventCallback*,int>> *)(this + 0x18),
               local_30);
    if (*(int *)(local_28 + 4) == 1) {
      this[0xa4] = (CGameEventManager)0x1;
    }
    operator_delete(local_28);
    *(int *)(this + 0xa0) = *(int *)(this + 0xa0) + -1;
    uVar3 = *(uint *)(this + 0xa0);
    if (uVar3 == 0) {
      LOCK();
      uVar3 = *(uint *)pCVar1;
      *(uint *)pCVar1 = 0;
      UNLOCK();
    }
    if ((local_24 != (CGameEventManager *)0x0) && (uVar3 = 0, _SetSeed != 0)) {
      uVar3 = (**(code **)(_SetSeed + 0x6c))
                        (_SetSeed,local_24,1,"/data/src/public/tier0/vprof_telemetry.h",0x3fa,
                         &CTelemetryLock::Unlocked()::tm_fmt,"%s Released",local_20);
    }
  }
  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)