L L4D2node

CHLTVClientState::CopyNewEntity

0x0016a370 · 876 bytes · __thiscall

_ZN16CHLTVClientState13CopyNewEntityER15CEntityReadInfoii

Decompiled

undefined (4 params)

/* CHLTVClientState::CopyNewEntity(CEntityReadInfo&, int, int) */

void __thiscall
CHLTVClientState::CopyNewEntity
          (CHLTVClientState *this,CEntityReadInfo *param_1,int param_2,int param_3)

{
  uint *puVar1;
  int iVar2;
  CFrameSnapshot *pCVar3;
  char cVar4;
  ServerClass *pSVar5;
  ClientClass *pCVar6;
  int iVar7;
  PackedEntity *this_00;
  undefined4 uVar8;
  int in_GS_OFFSET;
  int *local_8070;
  void *local_8064;
  uint local_8060;
  bf_write local_805c [12];
  int local_8050;
  char *local_8044;
  undefined1 local_8040;
  undefined4 local_803c;
  undefined4 local_8038;
  int local_8020 [4096];
  char local_4020 [16384];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pSVar5 = (ServerClass *)SV_FindServerClass(param_2);
  pCVar6 = (ClientClass *)CBaseClientState::GetClientClass((CBaseClientState *)this,param_2);
  iVar2 = *(int *)(param_1 + 0x18);
  pCVar3 = *(CFrameSnapshot **)(*(int *)(param_1 + 0xc) + 0x118);
  *(int *)(*(int *)(pCVar3 + 8) + 4 + iVar2 * 0xc) = param_3;
  *(ServerClass **)(*(int *)(pCVar3 + 8) + iVar2 * 0xc) = pSVar5;
  local_8064 = (void *)0x0;
  local_8060 = 0;
  if (param_1[4] != (CEntityReadInfo)0x0) {
    iVar7 = CBaseClientState::GetEntityBaseline
                      ((CBaseClientState *)this,*(int *)(param_1 + 0x38),iVar2);
    if ((iVar7 != 0) && (pCVar6 == *(ClientClass **)(iVar7 + 4))) {
      local_8064 = *(void **)(iVar7 + 0x24);
      local_8060 = *(uint *)(iVar7 + 0x28) & 0x7fffffff;
      goto LAB_0016a437;
    }
  }
  cVar4 = CBaseClientState::GetClassBaseline
                    ((CBaseClientState *)this,param_2,&local_8064,(int *)&local_8060);
  if (cVar4 == '\0') {
    Error("HLTV_CopyNewEntity: GetDynamicBaseline(%d) failed.",param_2);
  }
  local_8060 = local_8060 << 3;
LAB_0016a437:
  iVar7 = SendTable_GetNumFlatProps(*(SendTable **)(pSVar5 + 4));
  local_8070 = (int *)0x0;
  if (this[0x49e4] == (CHLTVClientState)0x0) {
    local_8070 = (int *)AllocChangeFrameList(iVar7,0);
  }
  this_00 = (PackedEntity *)
            CFrameSnapshotManager::CreatePackedEntity
                      ((CFrameSnapshotManager *)framesnapshotmanager,pCVar3,iVar2);
  *(int **)(this_00 + 0x2c) = local_8070;
  PackedEntity::SetServerAndClientClass(this_00,pSVar5,pCVar6);
  local_8040 = 0;
  local_803c = 0xffffffff;
  local_8038 = 0;
  local_8044 = "HLTV_ReadEnterPVS1";
  CBitRead::StartReading((CBitRead *)&local_8044,local_8064,(int)(local_8060 + 7) >> 3,0,local_8060)
  ;
  bf_write::bf_write(local_805c,"HLTV_ReadEnterPVS2",local_4020,0x4000,-1);
  uVar8 = RecvTable_MergeDeltas
                    (*(RecvTable **)(pCVar6 + 0xc),(bf_read *)&local_8044,
                     *(bf_read **)(param_1 + 0x2c),local_805c,-1,local_8020,false);
  if (local_8070 != (int *)0x0) {
    (**(code **)(*local_8070 + 8))(local_8070,local_8020,uVar8,*(undefined4 *)(pCVar3 + 4));
  }
  if (param_1[0x3c] != (CEntityReadInfo)0x0) {
    CBaseClientState::SetEntityBaseline
              ((CBaseClientState *)this,(uint)(*(int *)(param_1 + 0x38) == 0),pCVar6,
               *(int *)(param_1 + 0x18),local_4020,local_8050 + 7 >> 3);
  }
  PackedEntity::AllocAndCopyPadded(this_00,local_4020,local_8050 + 7 >> 3);
  *(int *)(*(int *)(param_1 + 0xc) + 4) = iVar2;
  puVar1 = (uint *)(*(int *)(param_1 + 0xc) + 0xc + (iVar2 >> 5) * 4);
  *puVar1 = *puVar1 | 1 << ((byte)iVar2 & 0x1f);
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)