L L4D2node

CFrameSnapshotManager::RemoveEntityReference

0x001f1ff0 · 285 bytes · __thiscall

_ZN21CFrameSnapshotManager21RemoveEntityReferenceEi

Decompiled

undefined (2 params)

/* CFrameSnapshotManager::RemoveEntityReference(int) */

uint __thiscall
CFrameSnapshotManager::RemoveEntityReference(CFrameSnapshotManager *this,int param_1)

{
  PackedEntity *pPVar1;
  CFrameSnapshotManager *pCVar2;
  uint uVar3;
  PackedEntity *this_00;
  uint uVar4;
  int iVar5;
  undefined4 *puVar6;
  
  this_00 = *(PackedEntity **)param_1;
  LOCK();
  pPVar1 = this_00 + 0xc;
  uVar4 = *(uint *)pPVar1;
  *(int *)pPVar1 = *(int *)pPVar1 + -1;
  UNLOCK();
  if (1 < (int)uVar4) {
    return uVar4;
  }
  pCVar2 = this + 0x409c;
  uVar4 = ThreadGetCurrentId();
  if (uVar4 != *(uint *)(this + 0x409c)) {
    LOCK();
    uVar3 = *(uint *)pCVar2;
    if (uVar3 == 0) {
      *(uint *)pCVar2 = uVar4;
    }
    UNLOCK();
    if (uVar3 != 0) {
      CThreadFastMutex::Lock((uint)pCVar2,uVar4);
      goto LAB_001f2058;
    }
  }
  *(int *)(this + 0x40a0) = *(int *)(this + 0x40a0) + 1;
LAB_001f2058:
  CUtlLinkedList<PackedEntity*,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<PackedEntity*,int>>>
  ::Unlink((CUtlLinkedList<PackedEntity*,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<PackedEntity*,int>>>
            *)(this + 0x58),param_1);
  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(this + 0x6c);
  *(int *)(this + 0x6c) = param_1;
  if (this_00 != (PackedEntity *)0x0) {
    PackedEntity::~PackedEntity(this_00);
  }
                    /* try { // try from 001f2086 to 001f208a has its CatchHandler @ 001f211e */
  CUtlMemoryPool::Free((CUtlMemoryPool *)(this + 0x28),this_00);
  if (0 < *(int *)(this + 0x94)) {
    puVar6 = *(undefined4 **)(this + 0x88);
    if ((PackedEntity *)*puVar6 != this_00) {
      iVar5 = 0;
      do {
        puVar6 = puVar6 + 0x1003;
        iVar5 = iVar5 + 1;
        if (iVar5 == *(int *)(this + 0x94)) goto LAB_001f20c6;
      } while ((PackedEntity *)*puVar6 != this_00);
    }
    *puVar6 = 0;
    puVar6[1] = 0;
  }
LAB_001f20c6:
  *(int *)(this + 0x40a0) = *(int *)(this + 0x40a0) + -1;
  uVar4 = *(uint *)(this + 0x40a0);
  if (uVar4 == 0) {
    LOCK();
    uVar4 = *(uint *)pCVar2;
    *(uint *)pCVar2 = 0;
    UNLOCK();
  }
  return uVar4;
}

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)