NET_GetLong
0x001c6370 · 1082 bytes · __cdecl
_Z11NET_GetLongiP11netpacket_s
Decompiled
undefined (2 params)
/* NET_GetLong(int, netpacket_s*) */
undefined4 NET_GetLong(int param_1,netpacket_s *param_2)
{
int *piVar1;
int iVar2;
int iVar3;
undefined4 uVar4;
int iVar5;
size_t __n;
undefined4 *puVar6;
uint uVar7;
int iVar8;
undefined *puVar9;
uint uVar10;
int local_24;
if (*(uint *)(param_2 + 0x40) < 0xc) {
if (*(int *)(net_showsplit_errors._28_4_ + 0x30) != 0) {
uVar4 = netadr_s::ToString((netadr_s *)param_2,false);
uVar4 = va("Invalid split packet length %i from %s\n",*(undefined4 *)(param_2 + 0x40),uVar4);
PacketErrorMessage(0,uVar4);
return 0;
}
}
else {
iVar5 = NET_FindOrCreateSplitPacketEntry(param_1,(netadr_s *)param_2);
if (iVar5 != 0) {
*(float *)((int)&__DT_REL[0x49fe].r_info + iVar5) = (float)net_time;
iVar2 = *(int *)(param_2 + 0x18);
iVar3 = *(int *)(iVar2 + 4);
uVar10 = (uint)(char)(*(ushort *)(iVar2 + 8) >> 8);
uVar7 = *(ushort *)(iVar2 + 8) & 0xff;
iVar8 = (int)*(short *)(iVar2 + 10);
if ((ushort)(*(short *)(iVar2 + 10) - 0x234U) < 0x271) {
if (uVar10 < 0x194) {
if ((*(int *)(iVar5 + 0x65c) == -1) || (iVar3 != *(int *)(iVar5 + 0x65c))) {
*(int *)(iVar5 + 0x65c) = iVar3;
*(int *)(iVar5 + 0x668) = iVar8;
*(uint *)(iVar5 + 0x660) = uVar7;
local_24 = iVar8;
}
else {
local_24 = *(int *)(iVar5 + 0x668);
if (local_24 != iVar8) {
if (*(int *)(net_showsplit_errors._28_4_ + 0x30) == 0) {
return 0;
}
uVar4 = netadr_s::ToString((netadr_s *)param_2,false);
uVar4 = va("NET_GetLong: Split packet from %s with inconsistent split size (number %i/ count %i) where size %i not equal to initial size of %i\n"
,uVar4,uVar10,uVar7,iVar8,local_24);
PacketErrorMessage(3,uVar4);
return 0;
}
}
__n = *(int *)(param_2 + 0x40) - 0xc;
iVar2 = iVar5 + uVar10 * 4;
if (*(int *)(iVar2 + 0xc) == iVar3) {
if (*(int *)(net_showsplit_errors._28_4_ + 0x30) != 0) {
uVar4 = netadr_s::ToString((netadr_s *)param_2,false);
uVar4 = va("NET_GetLong: Ignoring duplicated split packet %i of %i ( %i bytes ) from %s\n"
,uVar10 + 1,uVar7,__n,uVar4);
PacketErrorMessage(4,uVar4);
}
}
else {
if (uVar7 - 1 == uVar10) {
*(uint *)(iVar5 + 0x664) = local_24 * uVar10 + __n;
}
*(int *)(iVar5 + 0x660) = *(int *)(iVar5 + 0x660) + -1;
*(int *)(iVar2 + 0xc) = iVar3;
if ((*(int *)(net_showsplits._28_4_ + 0x30) != 0) &&
(*(int *)(net_showsplits._28_4_ + 0x30) != 3)) {
uVar4 = netadr_s::ToString((netadr_s *)param_2,false);
if (param_1 == 0) {
puVar9 = &DAT_002bbe1c;
}
else {
puVar6 = (undefined4 *)s_SocketDescMap;
do {
puVar9 = (undefined *)puVar6[2];
if (puVar9 == (undefined *)0x0) {
puVar9 = &DAT_002b558d;
break;
}
piVar1 = puVar6 + 3;
puVar6 = puVar6 + 2;
} while (param_1 != *piVar1);
}
Msg("<-- [%s] Split packet %4i/%4i seq %5i size %4i mtu %4i from %s\n",puVar9,
uVar10 + 1,uVar7,iVar3,__n,iVar8 + 0xc,uVar4);
}
}
memcpy((void *)(iVar5 + 0x66c + uVar10 * local_24),
(void *)(*(int *)(param_2 + 0x18) + 0xc),__n);
if (*(int *)(iVar5 + 0x660) < 1) {
*(undefined4 *)(iVar5 + 0x65c) = 0xffffffff;
if (*(uint *)(iVar5 + 0x664) < 0x37ab1) {
_V_memcpy(*(void **)(param_2 + 0x18),(void *)(iVar5 + 0x66c),*(uint *)(iVar5 + 0x664))
;
*(undefined4 *)(param_2 + 0x40) = *(undefined4 *)(iVar5 + 0x664);
*(undefined4 *)(param_2 + 0x44) = *(undefined4 *)(iVar5 + 0x664);
return 1;
}
if (*(int *)(net_showsplit_errors._28_4_ + 0x30) != 0) {
uVar4 = netadr_s::ToString((netadr_s *)param_2,false);
uVar4 = va("Split packet too large! %d bytes from %s\n",*(undefined4 *)(iVar5 + 0x664)
,uVar4);
PacketErrorMessage(5,uVar4);
}
}
}
else if (*(int *)(net_showsplit_errors._28_4_ + 0x30) != 0) {
uVar4 = netadr_s::ToString((netadr_s *)param_2,false);
uVar4 = va("NET_GetLong: Split packet from %s with too many split parts (number %i/ count %i) where %i is max count allowed\n"
,uVar4,uVar10,uVar7,0x194);
PacketErrorMessage(2,uVar4);
return 0;
}
}
else if (*(int *)(net_showsplit_errors._28_4_ + 0x30) != 0) {
uVar4 = netadr_s::ToString((netadr_s *)param_2,false);
uVar4 = va("NET_GetLong: Split packet from %s with invalid split size (number %i/ count %i) where size %i is out of valid range [%d - %d ]\n"
,uVar4,uVar10,uVar7,iVar8,0x234,0x4a4);
PacketErrorMessage(1,uVar4);
return 0;
}
}
}
return 0;
}
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.