L L4D2node

CNetChan::Shutdown

0x001b5c30 · 541 bytes · __thiscall

_ZN8CNetChan8ShutdownEPKc.part.125

Decompiled

undefined (2 params)

/* CNetChan::Shutdown(char const*) [clone .part.125] */

void __thiscall CNetChan::Shutdown(CNetChan *this,char *param_1)

{
  int *piVar1;
  INetChannel *pIVar2;
  CNetChan *in_EAX;
  int iVar3;
  uint *puVar4;
  uint uVar5;
  char *in_EDX;
  ulonglong uVar6;
  
  (**(code **)(*(int *)in_EAX + 0x94))();
  if (in_EDX != (char *)0x0) {
    uVar5 = *(uint *)(in_EAX + 0x50);
    if (*(int *)(in_EAX + 0x4c) < (int)(uVar5 + 6)) {
      *(int *)(in_EAX + 0x50) = *(int *)(in_EAX + 0x4c);
      in_EAX[0x54] = (CNetChan)0x1;
    }
    else {
      iVar3 = ((int)uVar5 >> 5) * 4;
      uVar5 = uVar5 & 0x1f;
      puVar4 = (uint *)(iVar3 + *(int *)(in_EAX + 0x44));
      *puVar4 = *puVar4 & *(uint *)(&DAT_003f2db8 + uVar5 * 0x84) | 1 << (sbyte)uVar5;
      if ((int)(0x20 - uVar5) < 6) {
        puVar4 = (uint *)(*(int *)(in_EAX + 0x44) + 4 + iVar3);
        *puVar4 = *puVar4 & (&g_BitWriteMasks)[6 - (0x20 - uVar5)];
      }
      *(int *)(in_EAX + 0x50) = *(int *)(in_EAX + 0x50) + 6;
    }
    bf_write::WriteString((bf_write *)(in_EAX + 0x44),in_EDX);
    (**(code **)(*(int *)in_EAX + 0xc4))();
  }
  if (*(int *)(in_EAX + 0x90) != 0) {
    NET_CloseSocket(*(int *)(in_EAX + 0x90),*(int *)(in_EAX + 0x8c));
    in_EAX[0x42a] = (CNetChan)0x0;
    *(undefined4 *)(in_EAX + 0x90) = 0;
  }
  uVar6 = (**(code **)(*(int *)g_pSteamSocketMgr + 0x1c))
                    (g_pSteamSocketMgr,(netadr_s *)(in_EAX + 0x98));
  if (uVar6 != 0) {
    NET_TerminateSteamConnection(*(int *)(in_EAX + 0x8c),uVar6);
  }
  if (in_EAX == g_pNetChannelProcessingActivePacket) {
    NetChannelProcessingCallbacksRunOnProcessingFinished(in_EAX,false);
  }
  DumpSocketProcessingStats(in_EAX,"shutdown netchan");
  *(undefined4 *)(in_EAX + 0x8c) = 0xffffffff;
  netadr_s::Clear((netadr_s *)(in_EAX + 0x98));
  piVar1 = *(int **)(in_EAX + 0x4208);
  if (piVar1 != (int *)0x0) {
    (**(code **)(*piVar1 + 0xc))(piVar1);
    *(undefined4 *)(in_EAX + 0x4208) = 0;
  }
  if (0 < *(int *)(in_EAX + 0x4218)) {
    iVar3 = 0;
    do {
      piVar1 = *(int **)(*(int *)(in_EAX + 0x420c) + iVar3 * 4);
      if (piVar1 != (int *)0x0) {
        (**(code **)(*piVar1 + 4))(piVar1);
      }
      iVar3 = iVar3 + 1;
    } while (iVar3 < *(int *)(in_EAX + 0x4218));
  }
  *(undefined4 *)(in_EAX + 0x4218) = 0;
  CUtlMemory<INetMessage*,int>::Purge((CUtlMemory<INetMessage*,int> *)(in_EAX + 0x420c));
  pIVar2 = *(INetChannel **)(in_EAX + 0x420c);
  *(undefined4 *)(in_EAX + 0x4220) = 0;
  *(INetChannel **)(in_EAX + 0x421c) = pIVar2;
  if (in_EAX[4] == (CNetChan)0x0) {
    NET_RemoveNetChannel(pIVar2,SUB41(in_EAX,0));
    return;
  }
  NET_RemoveNetChannel(pIVar2,SUB41(in_EAX,0));
  in_EAX[5] = (CNetChan)0x1;
  return;
}

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)