L L4D2node

CNetChan::DenyFile

0x001adeb0 · 478 bytes · __thiscall

_ZN8CNetChan8DenyFileEPKcjb

Decompiled

undefined (4 params)

/* CNetChan::DenyFile(char const*, unsigned int, bool) */

void __thiscall CNetChan::DenyFile(CNetChan *this,char *param_1,uint param_2,bool param_3)

{
  uint uVar1;
  byte *pbVar2;
  int iVar3;
  byte bVar4;
  uint uVar5;
  uint *puVar6;
  int iVar7;
  
  if (*(int *)(net_showfragments._28_4_ + 0x30) == 2) {
    DevMsg("DenyFile: %s (ID %i)\n",param_1,param_2);
  }
  uVar5 = *(uint *)(this + 0x2c);
  uVar1 = *(uint *)(this + 0x28);
  if ((int)uVar1 < (int)(uVar5 + 6)) {
    *(uint *)(this + 0x2c) = uVar1;
    this[0x30] = (CNetChan)0x1;
    uVar5 = uVar1;
  }
  else {
    iVar7 = ((int)uVar5 >> 5) * 4;
    uVar5 = uVar5 & 0x1f;
    puVar6 = (uint *)(*(int *)(this + 0x20) + iVar7);
    iVar3 = 0x20 - uVar5;
    *puVar6 = *puVar6 & *(uint *)(&DAT_003f2db8 + uVar5 * 0x84) | 2 << (sbyte)uVar5;
    if (iVar3 < 6) {
      puVar6 = (uint *)(*(int *)(this + 0x20) + 4 + iVar7);
      *puVar6 = (&g_BitWriteMasks)[6 - iVar3] & *puVar6 | 2U >> ((byte)iVar3 & 0x1f);
    }
    iVar7 = *(int *)(this + 0x2c);
    uVar1 = *(uint *)(this + 0x28);
    *(uint *)(this + 0x2c) = iVar7 + 6U;
    uVar5 = iVar7 + 6U;
  }
  if ((int)uVar1 < (int)(uVar5 + 0x20)) {
    *(uint *)(this + 0x2c) = uVar1;
    this[0x30] = (CNetChan)0x1;
  }
  else {
    iVar7 = ((int)uVar5 >> 5) * 4;
    uVar5 = uVar5 & 0x1f;
    puVar6 = (uint *)(*(int *)(this + 0x20) + iVar7);
    *puVar6 = *puVar6 & *(uint *)(&DAT_003f2e20 + uVar5 * 0x84) | param_2 << (sbyte)uVar5;
    iVar3 = 0x20 - uVar5;
    if (iVar3 != 0x20) {
      puVar6 = (uint *)(*(int *)(this + 0x20) + 4 + iVar7);
      *puVar6 = (&g_BitWriteMasks)[0x20 - iVar3] & *puVar6 | param_2 >> ((byte)iVar3 & 0x1f);
    }
    *(int *)(this + 0x2c) = *(int *)(this + 0x2c) + 0x20;
  }
  bf_write::WriteString((bf_write *)(this + 0x20),param_1);
  iVar7 = *(int *)(this + 0x2c);
  if (iVar7 < *(int *)(this + 0x28)) {
    if (this[0x30] == (CNetChan)0x0) {
      bVar4 = (byte)(1 << ((byte)iVar7 & 7));
      if (param_3) {
        pbVar2 = (byte *)(*(int *)(this + 0x20) + (iVar7 >> 3));
        *pbVar2 = *pbVar2 | bVar4;
      }
      else {
        pbVar2 = (byte *)(*(int *)(this + 0x20) + (iVar7 >> 3));
        *pbVar2 = *pbVar2 & ~bVar4;
      }
      iVar7 = *(int *)(this + 0x2c) + 1;
      *(int *)(this + 0x2c) = iVar7;
      if (*(int *)(this + 0x28) <= iVar7) goto LAB_001ae000;
    }
    if (this[0x30] == (CNetChan)0x0) {
      pbVar2 = (byte *)((iVar7 >> 3) + *(int *)(this + 0x20));
      *pbVar2 = *pbVar2 & ~(byte)(1 << ((byte)iVar7 & 7));
      *(int *)(this + 0x2c) = *(int *)(this + 0x2c) + 1;
    }
    return;
  }
LAB_001ae000:
  this[0x30] = (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)