L L4D2node

NET_CreateNetChannel

0x001c56d0 · 292 bytes · __cdecl

_Z20NET_CreateNetChanneliP8netadr_sPKcP18INetChannelHandlerb

Decompiled

undefined (5 params)

/* NET_CreateNetChannel(int, netadr_s*, char const*, INetChannelHandler*, bool) */

CNetChan *
NET_CreateNetChannel
          (int param_1,netadr_s *param_2,char *param_3,INetChannelHandler *param_4,bool param_5)

{
  uint uVar1;
  CNetChan *this;
  uint uVar2;
  bool bVar3;
  CNetChan *local_20 [4];
  
  local_20[0] = (CNetChan *)0x0;
  if ((((!param_5) && (param_2 != (netadr_s *)0x0)) &&
      (local_20[0] = (CNetChan *)NET_FindNetChannel(param_1,param_2), local_20[0] != (CNetChan *)0x0
      )) && ((**(code **)(*(int *)local_20[0] + 0x94))(local_20[0]), local_20[0] != (CNetChan *)0x0)
     ) goto LAB_001c5775;
  this = operator_new(0x42cc);
                    /* try { // try from 001c56fd to 001c5701 has its CatchHandler @ 001c57fa */
  CNetChan::CNetChan(this);
  local_20[0] = this;
  uVar2 = ThreadGetCurrentId();
  if (uVar2 == DAT_003ac4b4) {
LAB_001c57b0:
    DAT_003ac4b8 = DAT_003ac4b8 + 1;
  }
  else {
    LOCK();
    bVar3 = DAT_003ac4b4 == 0;
    uVar1 = uVar2;
    if (!bVar3) {
      uVar1 = DAT_003ac4b4;
    }
    DAT_003ac4b4 = uVar1;
    UNLOCK();
    if (bVar3) goto LAB_001c57b0;
    CThreadFastMutex::Lock(0x3ac4b4,uVar2);
  }
                    /* try { // try from 001c57d4 to 001c57d8 has its CatchHandler @ 001c580c */
  CUtlVector<CNetChan*,CUtlMemory<CNetChan*,int>>::InsertBefore
            ((CUtlVector<CNetChan*,CUtlMemory<CNetChan*,int>> *)&s_NetChannels,DAT_003ac4ac,local_20
            );
  DAT_003ac4b8 = DAT_003ac4b8 + -1;
  if (DAT_003ac4b8 == 0) {
    LOCK();
    UNLOCK();
    DAT_003ac4b4 = 0;
  }
LAB_001c5775:
  if (param_1 < 3) {
    NET_ClearLagData(param_1);
  }
  CNetChan::Setup(local_20[0],param_1,param_2,param_3,param_4);
  return local_20[0];
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)