PackEntities_Normal
0x002064f0 · 2473 bytes · __cdecl
_Z19PackEntities_NormaliPP11CGameClientP14CFrameSnapshot
Decompiled
undefined (3 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* PackEntities_Normal(int, CGameClient**, CFrameSnapshot*) */
void PackEntities_Normal(int param_1,CGameClient **param_2,CFrameSnapshot *param_3)
{
edict_t *peVar1;
ushort uVar2;
CFrameSnapshot *pCVar3;
ServerClass *pSVar4;
CBaseEdict *this;
SendTable *pSVar5;
int iVar6;
char cVar7;
uint uVar8;
int iVar9;
int iVar10;
PackedEntity *pPVar11;
undefined1 *puVar12;
int *piVar13;
undefined4 uVar14;
int iVar15;
int in_GS_OFFSET;
uint local_e11c;
PackWork_t *local_e118;
uint local_e110;
int local_e100;
int local_e0f0;
undefined4 local_e0ec;
undefined4 local_e0e8;
undefined4 local_e0e4;
undefined4 local_e0e0;
undefined4 local_e0dc;
undefined4 local_e0d8;
int local_e0d4;
undefined4 local_e0d0;
undefined4 local_e0cc;
int local_e0c8;
undefined1 *local_e0c4;
undefined4 local_e0c0;
undefined4 local_e0bc;
undefined4 local_e0b8 [3];
int local_e0ac;
code *local_e0a0 [5];
char *local_e08c;
PackWork_t local_a0a0 [4];
undefined4 local_a09c [6143];
undefined1 local_40a0 [128];
undefined1 local_4020 [16384];
int local_20;
local_e0ec = 0;
local_e0e8 = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (_g_Telemetry == 0) {
local_e0d4 = 0;
}
else {
(**(code **)(_g_Telemetry + 0x50))
(_g_Telemetry,&local_e0ec,0,0x32,0,0,"/data/src/engine/./sv_packedentities.cpp",0x166,
&PackEntities_Normal(int,CGameClient**,CFrameSnapshot*)::tm_fmt,"%s %d",
"PackEntities_Normal",*(undefined4 *)(param_3 + 0x14));
local_e0d4 = _g_Telemetry;
}
local_e0dc = local_e0ec;
local_e0d8 = local_e0e8;
if (*(int *)(param_3 + 0x14) < 1) {
if (*(int *)(sv_parallel_packentities._28_4_ + 0x30) == 0) goto LAB_00206c08;
local_e110 = 0;
}
else {
local_e100 = 0;
local_e110 = 0;
do {
uVar2 = *(ushort *)(*(int *)(param_3 + 0x10) + local_e100 * 2);
peVar1 = (edict_t *)((uint)uVar2 * 0x10 + DAT_003b8174);
/* try { // try from 00206632 to 00206792 has its CatchHandler @ 00206eb9 */
SV_FillHLTVData(param_3,peVar1,local_e100);
if (0 < param_1) {
uVar8 = 1 << ((byte)uVar2 & 0x1f);
iVar15 = (uint)(uVar2 >> 5) * 4;
if ((*(uint *)(*(int *)(*param_2 + 0x1d76c) + 0xc + iVar15) & uVar8) == 0) {
iVar9 = 0;
do {
iVar9 = iVar9 + 1;
if (iVar9 == param_1) goto LAB_0020668a;
} while ((*(uint *)(*(int *)(param_2[iVar9] + 0x1d76c) + 0xc + iVar15) & uVar8) == 0);
}
*(uint *)(local_a0a0 + local_e110 * 0xc) = (uint)uVar2;
local_a09c[local_e110 * 3] = peVar1;
local_a09c[local_e110 * 3 + 1] = param_3;
local_e110 = local_e110 + 1;
}
LAB_0020668a:
local_e100 = local_e100 + 1;
} while (local_e100 < *(int *)(param_3 + 0x14));
if (*(int *)(sv_parallel_packentities._28_4_ + 0x30) == 0) {
local_e11c = 0;
local_e118 = local_a0a0;
if (local_e110 != 0) {
do {
pCVar3 = *(CFrameSnapshot **)(local_e118 + 8);
iVar15 = *(int *)local_e118;
pSVar4 = *(ServerClass **)(*(int *)(pCVar3 + 8) + iVar15 * 0xc);
local_e0e4 = 0;
local_e0e0 = 0;
this = *(CBaseEdict **)(local_e118 + 4);
if (_g_Telemetry == 0) {
local_e0c8 = 0;
}
else {
(**(code **)(_g_Telemetry + 0x50))
(_g_Telemetry,&local_e0e4,0,0x32,0,0,
"/data/src/engine/./sv_packedentities.cpp",99,
&SV_PackEntity(int,edict_t*,ServerClass*,CFrameSnapshot*)::tm_fmt,
&DAT_002c48a3,"SV_PackEntity");
local_e0c8 = _g_Telemetry;
}
iVar9 = *(int *)(*(int *)(pCVar3 + 8) + 4 + iVar15 * 0xc);
local_e0d0 = local_e0e4;
local_e0cc = local_e0e0;
/* try { // try from 00206c9e to 00206cce has its CatchHandler @ 00206ef1 */
if (((((byte)*this & 1) == 0) &&
(cVar7 = CFrameSnapshotManager::UsePreviouslySentPacket
((CFrameSnapshotManager *)framesnapshotmanager,pCVar3,iVar15,iVar9)
, cVar7 != '\0')) && (*(int *)(sv_debugmanualmode._28_4_ + 0x30) == 0)) {
*(uint *)this = *(uint *)this & 0xfffffefe;
iVar15 = CBaseEdict::GetChangeAccessor(this);
*(undefined2 *)(iVar15 + 2) = 0;
LAB_00206cd5:
if (local_e0c8 != 0) {
(**(code **)(local_e0c8 + 0x54))(local_e0c8,local_e0d0,local_e0cc,0,0,0);
}
}
else {
/* try { // try from 00206804 to 00206808 has its CatchHandler @ 00206ef1 */
bf_write::bf_write((bf_write *)local_e0b8,"SV_PackEntity->writeBuf",local_4020,0x4000,-1
);
local_e0c4 = local_40a0;
pSVar5 = *(SendTable **)(pSVar4 + 4);
local_e0bc = 0xffffffff;
local_e0c0 = *(undefined4 *)(*(int *)(pSVar5 + 0xc) + 0xf8);
/* try { // try from 00206867 to 00206b97 has its CatchHandler @ 00206ed1 */
cVar7 = SendTable_Encode(pSVar5,*(void **)(this + 0xc),(bf_write *)local_e0b8,iVar15,
(CUtlMemory *)&local_e0c4,false);
if (cVar7 == '\0') {
Host_Error("SV_PackEntity: SendTable_Encode returned false (ent %d).\n",iVar15);
}
if (*(int *)(vcr_verbose._28_4_ + 0x30) == 0) {
LAB_002068b3:
iVar10 = local_e0ac + 7 >> 3;
}
else {
iVar10 = local_e0ac + 7 >> 3;
if (0 < iVar10) {
(**(code **)(_g_pVCR + 0x90))("writebuf",local_e0b8[0],iVar10 + -1);
goto LAB_002068b3;
}
}
SV_EnsureInstanceBaseline(pSVar4,iVar15,local_4020,iVar10);
iVar10 = SendTable_GetNumFlatProps(pSVar5);
pPVar11 = (PackedEntity *)
CFrameSnapshotManager::GetPreviouslySentPacket
((CFrameSnapshotManager *)framesnapshotmanager,iVar15,
*(int *)(*(int *)(pCVar3 + 8) + 4 + iVar15 * 0xc));
if (pPVar11 == (PackedEntity *)0x0) {
piVar13 = (int *)AllocChangeFrameList(iVar10,*(int *)(pCVar3 + 4));
}
else {
local_e0f0 = SendTable_CalcDelta(pSVar5,*(void **)(pPVar11 + 0x24),
*(uint *)(pPVar11 + 0x28) & 0x7fffffff,local_4020,
local_e0ac,(int *)local_e0a0,0x1000,iVar15);
if (*(int *)(vcr_verbose._28_4_ + 0x30) != 0) {
(**(code **)(_g_pVCR + 0x90))("nChanges",&local_e0f0,4);
}
if (local_e0f0 == 0) {
cVar7 = PackedEntity::CompareRecipients(pPVar11,(CUtlMemory *)&local_e0c4);
if ((cVar7 != '\0') &&
(cVar7 = CFrameSnapshotManager::UsePreviouslySentPacket
((CFrameSnapshotManager *)framesnapshotmanager,pCVar3,iVar15,
iVar9), cVar7 != '\0')) {
*(uint *)this = *(uint *)this & 0xfffffefe;
iVar15 = CBaseEdict::GetChangeAccessor(this);
*(undefined2 *)(iVar15 + 2) = 0;
CUtlMemory<CSendProxyRecipients,int>::Purge
((CUtlMemory<CSendProxyRecipients,int> *)&local_e0c4);
goto LAB_00206cd5;
}
}
else if ((((byte)*this & 1) == 0) && (0 < local_e0f0)) {
iVar9 = 0;
do {
iVar6 = *(int *)(*(int *)(*(int *)(pSVar5 + 0xc) + 0x2c) +
(int)local_e0a0[iVar9] * 4);
if ((*(uint *)(iVar6 + 0x3c) & 0x180000) == 0) {
uVar14 = *(undefined4 *)(iVar6 + 0x30);
if (*(int *)(this + 0xc) == 0) {
puVar12 = &DAT_002c79d4;
}
else {
puVar12 = (undefined1 *)
(**(code **)(**(int **)(this + 8) + 0xc))(*(int **)(this + 8));
}
Msg("Entity %d (class \'%s\') reported ENTITY_CHANGE_NONE but \'%s\' changed.\n"
,iVar15,puVar12,uVar14);
}
iVar9 = iVar9 + 1;
} while (iVar9 < local_e0f0);
}
if ((hltv == 0) ||
(cVar7 = (**(code **)(*(int *)(hltv + 4) + 0x58))(hltv + 4), cVar7 == '\0')) {
piVar13 = *(int **)(pPVar11 + 0x2c);
*(undefined4 *)(pPVar11 + 0x2c) = 0;
}
else {
piVar13 = (int *)(**(code **)(**(int **)(pPVar11 + 0x2c) + 0x10))
(*(int **)(pPVar11 + 0x2c));
}
if (piVar13 == (int *)0x0) {
/* try { // try from 00206d3f to 00206e11 has its CatchHandler @ 00206ed1 */
Error("SV_PackEntity: SnagChangeFrameList returned null");
}
iVar9 = (**(code **)(*piVar13 + 4))(piVar13);
if (iVar10 != iVar9) {
uVar14 = (**(code **)(*piVar13 + 4))(piVar13);
Error("SV_PackEntity: SnagChangeFrameList mismatched number of props[%d vs %d]",
iVar10,uVar14);
}
(**(code **)(*piVar13 + 8))(piVar13,local_e0a0,local_e0f0,*(undefined4 *)(pCVar3 + 4))
;
}
pPVar11 = (PackedEntity *)
CFrameSnapshotManager::CreatePackedEntity
((CFrameSnapshotManager *)framesnapshotmanager,pCVar3,iVar15);
*(int **)(pPVar11 + 0x2c) = piVar13;
PackedEntity::SetServerAndClientClass(pPVar11,pSVar4,(ClientClass *)0x0);
PackedEntity::AllocAndCopyPadded(pPVar11,local_4020,local_e0ac + 7 >> 3);
PackedEntity::SetRecipients(pPVar11,(CUtlMemory *)&local_e0c4);
*(uint *)this = *(uint *)this & 0xfffffefe;
iVar15 = CBaseEdict::GetChangeAccessor(this);
*(undefined2 *)(iVar15 + 2) = 0;
CUtlMemory<CSendProxyRecipients,int>::Purge
((CUtlMemory<CSendProxyRecipients,int> *)&local_e0c4);
if (local_e0c8 != 0) {
(**(code **)(local_e0c8 + 0x54))(local_e0c8,local_e0d0,local_e0cc,0,0,0);
}
}
local_e11c = local_e11c + 1;
local_e118 = local_e118 + 0xc;
} while (local_e110 != local_e11c);
}
goto LAB_00206c08;
}
}
local_e0a0[4] = (code *)0x0;
LOCK();
local_e0a0[3] = (code *)0x0;
UNLOCK();
local_e08c = "PackWork_t::Process";
local_e0a0[0] = PackWork_t::Process;
local_e0a0[1] = (code *)0x0;
local_e0a0[2] = (code *)0x0;
/* try { // try from 00206ea4 to 00206ea8 has its CatchHandler @ 00206eb9 */
CParallelProcessor<PackWork_t,CFuncJobItemProcessor<PackWork_t>,1>::Run
((CParallelProcessor<PackWork_t,CFuncJobItemProcessor<PackWork_t>,1> *)local_e0a0,
local_a0a0,local_e110,0x7fffffff,(IThreadPool *)0x0);
LAB_00206c08:
/* try { // try from 00206c08 to 00206c0c has its CatchHandler @ 00206eb9 */
InvalidateSharedEdictChangeInfos();
if (local_e0d4 != 0) {
(**(code **)(local_e0d4 + 0x54))(local_e0d4,local_e0dc,local_e0d8,0,0,0);
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.