NET_ProcessListen
0x001c5ea0 · 552 bytes · __cdecl
_Z17NET_ProcessListeni
Decompiled
undefined (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* NET_ProcessListen(int) */
void NET_ProcessListen(int param_1)
{
uint uVar1;
int iVar2;
uint uVar3;
undefined4 uVar4;
int iVar5;
int in_GS_OFFSET;
bool bVar6;
char local_41;
socklen_t local_40;
int local_3c;
sockaddr local_38;
int local_28;
int local_24;
float local_20;
netadr_s local_1c [12];
int local_10;
local_10 = *(int *)(in_GS_OFFSET + 0x14);
iVar5 = param_1 * 0x10 + net_sockets;
if (*(char *)(iVar5 + 4) == '\0') goto LAB_001c5ec5;
local_40 = 0x10;
iVar2 = (**(code **)(_g_pVCR + 0xc))();
if (iVar2 != 2) {
local_3c = accept(*(int *)(iVar5 + 0xc),&local_38,&local_40);
}
(**(code **)(_g_pVCR + 0x74))("accept",&local_3c,4);
(**(code **)(_g_pVCR + 0x74))("sockaddr",&local_38,0x10);
if (local_3c == -1) {
NET_GetLastError();
if (net_error != 0xb) {
uVar4 = NET_ErrorString(net_error);
ConDMsg("NET_ThreadListen: %s\n",uVar4);
}
goto LAB_001c5ec5;
}
netadr_s::SetIP(local_1c,0);
netadr_s::SetPort(local_1c,0);
netadr_s::SetType(local_1c,3);
local_28 = local_3c;
local_24 = param_1;
netadr_s::SetFromSockadr(local_1c,&local_38);
local_20 = (float)net_time;
uVar3 = ThreadGetCurrentId();
if (uVar3 == DAT_003ac474) {
LAB_001c6060:
DAT_003ac478 = DAT_003ac478 + 1;
}
else {
LOCK();
bVar6 = DAT_003ac474 == 0;
uVar1 = uVar3;
if (!bVar6) {
uVar1 = DAT_003ac474;
}
DAT_003ac474 = uVar1;
UNLOCK();
if (bVar6) goto LAB_001c6060;
CThreadFastMutex::Lock(0x3ac474,uVar3);
}
/* try { // try from 001c6004 to 001c602e has its CatchHandler @ 001c60da */
CUtlVector<pendingsocket_t,CUtlMemory<pendingsocket_t,int>>::InsertBefore
((CUtlVector<pendingsocket_t,CUtlMemory<pendingsocket_t,int>> *)&s_PendingSockets,
DAT_003ac46c,(pendingsocket_t *)&local_28);
local_41 = '\x01';
NET_SendStream(local_3c,&local_41,1,0);
if (*(int *)(net_showtcp._28_4_ + 0x30) != 0) {
/* try { // try from 001c60bb to 001c60cf has its CatchHandler @ 001c60da */
uVar4 = netadr_s::ToString(local_1c,false);
Msg("TCP <- %s: connection request.\n",uVar4);
}
DAT_003ac478 = DAT_003ac478 + -1;
if (DAT_003ac478 == 0) {
LOCK();
UNLOCK();
DAT_003ac474 = 0;
}
LAB_001c5ec5:
if (local_10 != *(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.