L L4D2node

CNetChan::RequestFile

0x001ae0b0 · 510 bytes · __thiscall

_ZN8CNetChan11RequestFileEPKcb

Decompiled

undefined (3 params)

/* CNetChan::RequestFile(char const*, bool) */

undefined4 __thiscall CNetChan::RequestFile(CNetChan *this,char *param_1,bool param_2)

{
  uint uVar1;
  undefined4 uVar2;
  uint uVar3;
  byte *pbVar4;
  int iVar5;
  byte bVar6;
  uint uVar7;
  uint *puVar8;
  int iVar9;
  
  uVar2 = net_showfragments._28_4_;
  iVar9 = *(int *)(this + 0x424);
  *(int *)(this + 0x424) = iVar9 + 1;
  if (*(int *)(uVar2 + 0x30) == 2) {
    DevMsg("RequestFile: %s (ID %i)\n",param_1,iVar9 + 1);
  }
  uVar7 = *(uint *)(this + 0x2c);
  uVar3 = *(uint *)(this + 0x28);
  if ((int)uVar3 < (int)(uVar7 + 6)) {
    *(uint *)(this + 0x2c) = uVar3;
    this[0x30] = (CNetChan)0x1;
    uVar7 = uVar3;
  }
  else {
    iVar9 = ((int)uVar7 >> 5) * 4;
    uVar7 = uVar7 & 0x1f;
    puVar8 = (uint *)(*(int *)(this + 0x20) + iVar9);
    iVar5 = 0x20 - uVar7;
    *puVar8 = *puVar8 & *(uint *)(&DAT_003f2db8 + uVar7 * 0x84) | 2 << (sbyte)uVar7;
    if (iVar5 < 6) {
      puVar8 = (uint *)(*(int *)(this + 0x20) + 4 + iVar9);
      *puVar8 = (&g_BitWriteMasks)[6 - iVar5] & *puVar8 | 2U >> ((byte)iVar5 & 0x1f);
    }
    iVar9 = *(int *)(this + 0x2c);
    uVar3 = *(uint *)(this + 0x28);
    *(uint *)(this + 0x2c) = iVar9 + 6U;
    uVar7 = iVar9 + 6U;
  }
  uVar1 = *(uint *)(this + 0x424);
  if ((int)uVar3 < (int)(uVar7 + 0x20)) {
    *(uint *)(this + 0x2c) = uVar3;
    this[0x30] = (CNetChan)0x1;
  }
  else {
    iVar9 = ((int)uVar7 >> 5) * 4;
    uVar7 = uVar7 & 0x1f;
    puVar8 = (uint *)(*(int *)(this + 0x20) + iVar9);
    *puVar8 = *puVar8 & *(uint *)(&DAT_003f2e20 + uVar7 * 0x84) | uVar1 << (sbyte)uVar7;
    iVar5 = 0x20 - uVar7;
    if (iVar5 != 0x20) {
      puVar8 = (uint *)(*(int *)(this + 0x20) + 4 + iVar9);
      *puVar8 = (&g_BitWriteMasks)[0x20 - iVar5] & *puVar8 | uVar1 >> ((byte)iVar5 & 0x1f);
    }
    *(int *)(this + 0x2c) = *(int *)(this + 0x2c) + 0x20;
  }
  bf_write::WriteString((bf_write *)(this + 0x20),param_1);
  iVar9 = *(int *)(this + 0x2c);
  if (iVar9 < *(int *)(this + 0x28)) {
    if (this[0x30] == (CNetChan)0x0) {
      bVar6 = (byte)(1 << ((byte)iVar9 & 7));
      if (param_2) {
        pbVar4 = (byte *)(*(int *)(this + 0x20) + (iVar9 >> 3));
        *pbVar4 = *pbVar4 | bVar6;
      }
      else {
        pbVar4 = (byte *)(*(int *)(this + 0x20) + (iVar9 >> 3));
        *pbVar4 = *pbVar4 & ~bVar6;
      }
      iVar9 = *(int *)(this + 0x2c) + 1;
      *(int *)(this + 0x2c) = iVar9;
      if (*(int *)(this + 0x28) <= iVar9) goto LAB_001ae218;
    }
    if (this[0x30] == (CNetChan)0x0) {
      pbVar4 = (byte *)((iVar9 >> 3) + *(int *)(this + 0x20));
      *pbVar4 = *pbVar4 | (byte)(1 << ((byte)iVar9 & 7));
      *(int *)(this + 0x2c) = *(int *)(this + 0x2c) + 1;
    }
    return *(undefined4 *)(this + 0x424);
  }
LAB_001ae218:
  this[0x30] = (CNetChan)0x1;
  return *(undefined4 *)(this + 0x424);
}

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)