NET_SendLoopPacket
0x001c3220 · 549 bytes · __cdecl
_Z18NET_SendLoopPacketiiPKhRK8netadr_s
Decompiled
undefined (4 params)
/* NET_SendLoopPacket(int, int, unsigned char const*, netadr_s const&) */
void NET_SendLoopPacket(int param_1,int param_2,uchar *param_3,netadr_s *param_4)
{
undefined4 *puVar1;
int iVar2;
char cVar3;
int *piVar4;
undefined4 *puVar5;
undefined4 *puVar6;
int *piVar7;
if ((uint)param_1 < 2) {
if (0x37aa0 < param_2) {
DevMsg("NET_SendLoopPacket: packet too big (%i).\n");
return;
}
piVar4 = (int *)CUtlMemoryPool::Alloc((CUtlMemoryPool *)loopback_t::s_Allocator,0x808);
if (param_2 < 0x801) {
piVar7 = piVar4 + 2;
*piVar4 = (int)piVar7;
}
else {
piVar7 = operator_new__(param_2);
*piVar4 = (int)piVar7;
}
_V_memcpy(piVar7,param_3,param_2);
piVar4[1] = param_2;
if (param_1 == 1) {
do {
puVar5 = DAT_003ac118;
if (DAT_003ac118 == (undefined4 *)0x0) {
puVar5 = operator_new(8);
puVar5[1] = piVar4;
goto LAB_001c33bf;
}
cVar3 = ThreadInterlockedAssignIf64
(&DAT_003ac118,*DAT_003ac118,DAT_003ac11c + -1,DAT_003ac118,DAT_003ac11c);
} while (cVar3 == '\0');
puVar5[1] = piVar4;
LAB_001c33bf:
*puVar5 = &s_LoopBacks;
while( true ) {
iVar2 = DAT_003ac10c;
puVar1 = DAT_003ac108;
LOCK();
puVar6 = (undefined4 *)*DAT_003ac108;
if (puVar6 == &s_LoopBacks) {
*DAT_003ac108 = puVar5;
puVar6 = &s_LoopBacks;
}
UNLOCK();
if (puVar6 == &s_LoopBacks) break;
ThreadInterlockedAssignIf64(&DAT_003ac108,*puVar1,iVar2 + 1,puVar1,iVar2);
}
ThreadInterlockedAssignIf64(&DAT_003ac108,puVar5,iVar2 + 1,puVar1,iVar2);
LOCK();
DAT_003ac110 = DAT_003ac110 + 1;
UNLOCK();
}
else {
do {
puVar5 = DAT_003ac138;
if (DAT_003ac138 == (undefined4 *)0x0) {
puVar5 = operator_new(8);
break;
}
cVar3 = ThreadInterlockedAssignIf64
(&DAT_003ac138,*DAT_003ac138,DAT_003ac13c + -1,DAT_003ac138,DAT_003ac13c);
} while (cVar3 == '\0');
puVar5[1] = piVar4;
*puVar5 = &DAT_003ac120;
while( true ) {
iVar2 = DAT_003ac12c;
puVar1 = DAT_003ac128;
LOCK();
puVar6 = (undefined4 *)*DAT_003ac128;
if (puVar6 == &DAT_003ac120) {
*DAT_003ac128 = puVar5;
puVar6 = &DAT_003ac120;
}
UNLOCK();
if (puVar6 == &DAT_003ac120) break;
ThreadInterlockedAssignIf64(&DAT_003ac128,*puVar1,iVar2 + 1,puVar1,iVar2);
}
ThreadInterlockedAssignIf64(&DAT_003ac128,puVar5,iVar2 + 1,puVar1,iVar2);
LOCK();
DAT_003ac130 = DAT_003ac130 + 1;
UNLOCK();
}
}
return;
}
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.