NET_RemoveNetChannel
0x001c78a0 · 302 bytes · __regparm1
_Z20NET_RemoveNetChannelP11INetChannelb
Decompiled
undefined (2 params)
/* NET_RemoveNetChannel(INetChannel*, bool) */
INetChannel * __regparm1 NET_RemoveNetChannel(INetChannel *param_1,bool param_2)
{
INetChannel *pIVar1;
INetChannel *pIVar2;
int iVar3;
int iVar4;
bool bVar5;
undefined3 in_stack_00000005;
char in_stack_00000008;
if (_param_2 == (INetChannel *)0x0) {
return param_1;
}
pIVar2 = (INetChannel *)ThreadGetCurrentId();
if (pIVar2 == DAT_003ac4b4) {
LAB_001c78f0:
DAT_003ac4b8 = (INetChannel *)((int)DAT_003ac4b8 + 1);
}
else {
LOCK();
bVar5 = DAT_003ac4b4 == (INetChannel *)0x0;
pIVar1 = pIVar2;
if (!bVar5) {
pIVar1 = DAT_003ac4b4;
}
DAT_003ac4b4 = pIVar1;
UNLOCK();
if (bVar5) goto LAB_001c78f0;
CThreadFastMutex::Lock(0x3ac4b4,(uint)pIVar2);
}
if (DAT_003ac4ac < 1) {
LAB_001c7924:
/* try { // try from 001c7933 to 001c79d0 has its CatchHandler @ 001c79d9 */
DevMsg(1,"NET_CloseNetChannel: unknown channel.\n");
}
else {
iVar3 = 0;
if (_param_2 == (INetChannel *)*s_NetChannels) {
LAB_001c7981:
iVar4 = (DAT_003ac4ac - iVar3) + -1;
if (0 < iVar4) {
_V_memmove(s_NetChannels + iVar3,s_NetChannels + iVar3 + 1,iVar4 * 4);
}
DAT_003ac4ac = DAT_003ac4ac + -1;
}
else {
do {
iVar3 = iVar3 + 1;
if (iVar3 == DAT_003ac4ac) goto LAB_001c7924;
} while (_param_2 != (INetChannel *)s_NetChannels[iVar3]);
if (iVar3 == -1) goto LAB_001c7924;
iVar3 = 0;
do {
iVar3 = iVar3 + 1;
if (iVar3 == DAT_003ac4ac) goto LAB_001c7995;
} while (_param_2 != (INetChannel *)s_NetChannels[iVar3]);
if (iVar3 != -1) goto LAB_001c7981;
}
LAB_001c7995:
NET_ClearQueuedPacketsForChannel(_param_2);
if (in_stack_00000008 != '\0') {
(**(code **)(*(int *)_param_2 + 0x70))(_param_2);
}
}
DAT_003ac4b8 = (INetChannel *)((int)DAT_003ac4b8 - 1);
pIVar2 = DAT_003ac4b8;
if (DAT_003ac4b8 == (INetChannel *)0x0) {
LOCK();
UNLOCK();
pIVar2 = DAT_003ac4b4;
DAT_003ac4b4 = (INetChannel *)0x0;
}
return pIVar2;
}
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.