NET_ProcessPending
0x001c5840 · 1498 bytes · unknown
_Z18NET_ProcessPendingv
Decompiled
undefined (0 params)
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* NET_ProcessPending() */
void NET_ProcessPending(void)
{
netadr_s *this;
int *piVar1;
int *piVar2;
uint uVar3;
char *pcVar4;
char cVar5;
uint uVar6;
int iVar7;
char *pcVar8;
int iVar9;
uint *puVar10;
int iVar11;
int in_GS_OFFSET;
bool bVar12;
char *pcVar13;
undefined4 uVar14;
uint local_58;
uint local_54;
uint local_50;
undefined4 local_4c;
char local_48;
undefined4 local_44;
undefined4 local_40;
uint local_3c;
int local_38;
uint *local_34;
uint *local_30;
char local_28 [8];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
uVar6 = ThreadGetCurrentId();
if (uVar6 != DAT_003ac474) {
LOCK();
bVar12 = DAT_003ac474 != 0;
uVar3 = uVar6;
if (bVar12) {
uVar3 = DAT_003ac474;
}
DAT_003ac474 = uVar3;
UNLOCK();
if (bVar12) {
CThreadFastMutex::Lock(0x3ac474,uVar6);
goto LAB_001c5881;
}
}
DAT_003ac478 = DAT_003ac478 + 1;
LAB_001c5881:
if (0 < DAT_003ac46c) {
iVar11 = 0;
LAB_001c58d8:
do {
piVar1 = (int *)(s_PendingSockets + iVar11 * 0x18);
if (4.0 < net_time - (double)(float)piVar1[2]) {
LAB_001c5898:
if (*piVar1 != 0) {
/* try { // try from 001c58a3 to 001c5aa9 has its CatchHandler @ 001c5e15 */
NET_CloseSocket(*piVar1,-1);
}
}
else {
iVar7 = NET_ReceiveStream(*piVar1,local_28,5,0);
if (iVar7 == 0) {
iVar11 = iVar11 + 1;
if (DAT_003ac46c <= iVar11) break;
goto LAB_001c58d8;
}
if (iVar7 == -1) goto LAB_001c5898;
pcVar13 = local_28;
uVar14 = 5;
local_48 = '\0';
local_4c = 0;
local_44 = 0xffffffff;
local_40 = 0;
CBitRead::StartReading((CBitRead *)&local_4c,pcVar13,5,0,-1);
if (local_38 < 8) {
if (local_34 == local_30) {
local_34 = local_34 + 1;
local_38 = 1;
LAB_001c5a6d:
local_48 = '\x01';
local_58 = 0;
local_50 = 0;
iVar7 = local_38;
LAB_001c5a7b:
local_38 = iVar7;
puVar10 = local_34;
if (local_34 == local_30) goto LAB_001c5cb5;
LAB_001c5a83:
if (local_34 < local_30) {
puVar10 = local_34 + 1;
local_3c = *local_34;
local_34 = puVar10;
if (local_48 == '\0') {
uVar6 = (&CBitBuffer::s_nMaskTable)[0x20 - local_38] & local_3c;
local_3c = local_3c >> ((byte)(0x20 - local_38) & 0x1f);
local_54 = uVar6 << ((byte)local_38 & 0x1f) | local_58;
goto LAB_001c59cb;
}
}
else {
local_48 = '\x01';
local_3c = 0;
}
}
else {
if (local_30 < local_34) goto LAB_001c5a6d;
puVar10 = local_34 + 1;
local_58 = *local_34;
local_34 = puVar10;
if (local_48 != '\0') {
local_50 = 0;
iVar7 = local_38;
goto LAB_001c5a7b;
}
uVar6 = local_58 & (&CBitBuffer::s_nMaskTable)[8 - local_38];
local_54._0_1_ = (byte)(8 - local_38);
local_58 = local_58 >> ((byte)local_54 & 0x1f);
local_50 = uVar6 << ((byte)local_38 & 0x1f) | local_3c;
local_38 = local_38 + 0x18;
if (puVar10 != local_30) goto LAB_001c5a83;
LAB_001c5cb5:
local_34 = puVar10 + 1;
local_38 = 1;
local_3c = 0;
local_48 = '\x01';
}
local_54 = 0;
if (local_50 == 4) goto LAB_001c5aa5;
LAB_001c59d5:
uVar14 = netadr_s::ToString((netadr_s *)(piVar1 + 3),false);
Msg("TCP <- %s: invalid connection request.\n",uVar14);
goto LAB_001c5898;
}
iVar7 = local_38 + -8;
local_50 = local_3c & 0xff;
if (iVar7 == 0) {
if (local_34 == local_30) {
local_38 = 1;
local_58 = 0;
iVar7 = local_38;
local_34 = local_34 + 1;
goto LAB_001c5a7b;
}
if (local_34 < local_30) {
local_58 = *local_34;
local_34 = local_34 + 1;
}
else {
local_48 = '\x01';
local_58 = 0;
}
bVar12 = false;
if (local_34 == local_30) goto LAB_001c5d77;
LAB_001c5bfd:
local_38 = 0x20;
if (local_30 <= local_34 && !bVar12) {
local_48 = '\x01';
goto LAB_001c59c1;
}
local_3c = *local_34;
local_54 = local_58;
local_34 = local_34 + 1;
}
else {
local_58 = local_3c >> 8;
if (iVar7 < 0x20) goto LAB_001c5a7b;
local_38 = local_38 + -0x28;
if (local_38 == 0) {
bVar12 = local_34 == local_30;
if (!bVar12) goto LAB_001c5bfd;
LAB_001c5d77:
local_38 = 1;
local_3c = 0;
local_54 = local_58;
local_34 = local_34 + 1;
}
else {
LAB_001c59c1:
local_3c = 0;
local_54 = local_58;
}
}
LAB_001c59cb:
if (local_50 != 4) goto LAB_001c59d5;
LAB_001c5aa5:
pcVar8 = (char *)ThreadGetCurrentId();
if (pcVar8 == DAT_003ac4b4) {
LAB_001c5ac5:
DAT_003ac4b8 = DAT_003ac4b8 + 1;
pcVar8 = pcVar13;
}
else {
LOCK();
bVar12 = DAT_003ac4b4 == (char *)0x0;
pcVar4 = pcVar8;
if (!bVar12) {
pcVar4 = DAT_003ac4b4;
}
DAT_003ac4b4 = pcVar4;
UNLOCK();
if (bVar12) goto LAB_001c5ac5;
uVar14 = 0;
/* try { // try from 001c5d4d to 001c5d51 has its CatchHandler @ 001c5e15 */
CThreadFastMutex::Lock(0x3ac4b4,(uint)pcVar8);
}
if (0 < DAT_003ac4ac) {
this = (netadr_s *)(piVar1 + 3);
iVar7 = 0;
do {
while( true ) {
piVar2 = *(int **)(s_NetChannels + iVar7 * 4);
/* try { // try from 001c5b11 to 001c5b85 has its CatchHandler @ 001c5e6b */
iVar9 = (**(code **)(*piVar2 + 0xd4))(piVar2,pcVar8,uVar14);
if (((iVar9 == piVar1[1]) &&
(uVar6 = (**(code **)(*piVar2 + 0xd8))(piVar2), uVar6 == local_54)) &&
(piVar2[0x24] == 0)) break;
iVar7 = iVar7 + 1;
if (DAT_003ac4ac <= iVar7) goto LAB_001c5b95;
}
uVar14 = 1;
cVar5 = netadr_s::CompareAdr(this,(netadr_s *)(piVar2 + 0x26),true);
if (cVar5 != '\0') {
piVar2[0x24] = *piVar1;
*(undefined1 *)((int)piVar2 + 0x42a) = 1;
/* try { // try from 001c5dcf to 001c5e0d has its CatchHandler @ 001c5e6b */
(**(code **)(*piVar2 + 0x80))(piVar2);
if (*(int *)(net_showtcp._28_4_ + 0x30) != 0) {
uVar14 = netadr_s::ToString(this,false);
Msg("TCP <- %s: connection accepted\n",uVar14);
}
bVar12 = true;
goto LAB_001c5b97;
}
pcVar8 = (char *)netadr_s::ToString(this,false);
Msg("TCP <- %s: IP address mismatch.\n");
iVar7 = iVar7 + 1;
} while (iVar7 < DAT_003ac4ac);
}
LAB_001c5b95:
bVar12 = false;
LAB_001c5b97:
DAT_003ac4b8 = DAT_003ac4b8 + -1;
if (DAT_003ac4b8 == 0) {
LOCK();
UNLOCK();
DAT_003ac4b4 = (char *)0x0;
}
if (!bVar12) goto LAB_001c59d5;
}
CUtlVector<pendingsocket_t,CUtlMemory<pendingsocket_t,int>>::ShiftElementsLeft
((CUtlVector<pendingsocket_t,CUtlMemory<pendingsocket_t,int>> *)&s_PendingSockets,
iVar11,1);
iVar11 = iVar11 + 1;
DAT_003ac46c = DAT_003ac46c + -1;
} while (iVar11 < DAT_003ac46c);
}
DAT_003ac478 = DAT_003ac478 + -1;
if (DAT_003ac478 == 0) {
LOCK();
UNLOCK();
DAT_003ac474 = 0;
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.