L L4D2node

CFrameSnapshotManager::CreatePackedEntity

0x001f23c0 · 377 bytes · __thiscall

_ZN21CFrameSnapshotManager18CreatePackedEntityEP14CFrameSnapshoti

Decompiled

undefined (3 params)

/* CFrameSnapshotManager::CreatePackedEntity(CFrameSnapshot*, int) */

PackedEntity * __thiscall
CFrameSnapshotManager::CreatePackedEntity
          (CFrameSnapshotManager *this,CFrameSnapshot *param_1,int param_2)

{
  CFrameSnapshotManager *pCVar1;
  uint uVar2;
  int iVar3;
  uint uVar4;
  PackedEntity *this_00;
  undefined4 *puVar5;
  
  pCVar1 = this + 0x409c;
  uVar4 = ThreadGetCurrentId();
  if (uVar4 != *(uint *)(this + 0x409c)) {
    LOCK();
    uVar2 = *(uint *)pCVar1;
    if (uVar2 == 0) {
      *(uint *)pCVar1 = uVar4;
    }
    UNLOCK();
    if (uVar2 != 0) {
      CThreadFastMutex::Lock((uint)pCVar1,uVar4);
      goto LAB_001f2403;
    }
  }
  *(int *)(this + 0x40a0) = *(int *)(this + 0x40a0) + 1;
LAB_001f2403:
  this_00 = (PackedEntity *)CUtlMemoryPool::Alloc((CUtlMemoryPool *)(this + 0x28));
  if (this_00 != (PackedEntity *)0x0) {
    PackedEntity::PackedEntity(this_00);
  }
  puVar5 = (undefined4 *)
           CUtlLinkedList<PackedEntity*,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<PackedEntity*,int>>>
           ::AllocInternal((CUtlLinkedList<PackedEntity*,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<PackedEntity*,int>>>
                            *)(this + 0x58),false);
  if (puVar5 != (undefined4 *)0x0) {
    CUtlLinkedList<PackedEntity*,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<PackedEntity*,int>>>
    ::Unlink((CUtlLinkedList<PackedEntity*,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<PackedEntity*,int>>>
              *)(this + 0x58),(int)puVar5);
    puVar5[2] = 0;
    iVar3 = *(int *)(this + 0x68);
    puVar5[1] = iVar3;
    *(undefined4 **)(this + 0x68) = puVar5;
    if (iVar3 == 0) {
      *(undefined4 **)(this + 100) = puVar5;
    }
    else {
      *(undefined4 **)(iVar3 + 8) = puVar5;
    }
    *(int *)(this + 0x70) = *(int *)(this + 0x70) + 1;
    *puVar5 = this_00;
  }
  *(int *)(this + 0x40a0) = *(int *)(this + 0x40a0) + -1;
  if (*(int *)(this + 0x40a0) == 0) {
    LOCK();
    *(uint *)pCVar1 = 0;
    UNLOCK();
  }
  LOCK();
  *(undefined4 *)(this_00 + 0xc) = 2;
  UNLOCK();
  *(int *)(this_00 + 8) = param_2;
  *(undefined4 **)(*(int *)(param_1 + 8) + 8 + param_2 * 0xc) = puVar5;
  if (*(int *)(this + param_2 * 4 + 0x9c) != 0) {
    RemoveEntityReference(this,*(int *)(this + param_2 * 4 + 0x9c));
  }
  *(undefined4 **)(this + param_2 * 4 + 0x9c) = puVar5;
  *(undefined4 *)(this + param_2 * 4 + 0x209c) =
       *(undefined4 *)(*(int *)(param_1 + 8) + 4 + param_2 * 0xc);
  *(uint *)(this_00 + 0x30) =
       *(uint *)(this_00 + 0x30) & 0x80000000 | *(uint *)(param_1 + 4) & 0x7fffffff;
  return this_00;
}

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)