L L4D2node

CNetChan::CheckReceivingList

0x001b7c30 · 766 bytes · __thiscall

_ZN8CNetChan18CheckReceivingListEi

Decompiled

undefined (2 params)

/* CNetChan::CheckReceivingList(int) */

undefined4 __thiscall CNetChan::CheckReceivingList(CNetChan *this,int param_1)

{
  CNetChan *pCVar1;
  char cVar2;
  int iVar3;
  undefined4 uVar4;
  int iVar5;
  undefined4 local_40;
  undefined1 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  
  iVar3 = param_1 * 0x130;
  if (*(int *)(this + iVar3 + 0x1ec) == 0) {
    return 1;
  }
  iVar5 = *(int *)(this + iVar3 + 0x208);
  uVar4 = 1;
  if (iVar5 <= *(int *)(this + iVar3 + 0x20c)) {
    if (iVar5 < *(int *)(this + iVar3 + 0x20c)) {
      uVar4 = (**(code **)(*(int *)this + 4))(this);
      ConMsg("Receiving failed: too many fragments %i/%i from %s\n",
             *(undefined4 *)(this + iVar3 + 0x20c),*(undefined4 *)(this + iVar3 + 0x208),uVar4);
      return 0;
    }
    if (*(int *)(net_showfragments._28_4_ + 0x30) != 0) {
      ConMsg("Receiving complete: %i fragments, %i bytes\n",iVar5,
             *(undefined4 *)(this + iVar3 + 0x1f0));
    }
    if ((this[iVar3 + 0x1fc] == (CNetChan)0x0) ||
       (uVar4 = UncompressFragments(this,(dataFragments_s *)(this + iVar3 + 0xe4)),
       (char)uVar4 != '\0')) {
      if (this[iVar3 + 0xe8] == (CNetChan)0x0) {
        local_3c = 0;
        local_40 = 0;
        local_38 = 0xffffffff;
        local_34 = 0;
        CBitRead::StartReading
                  ((CBitRead *)&local_40,*(void **)(this + iVar3 + 0x1ec),
                   *(int *)(this + iVar3 + 0x1f0),0,-1);
        *(CNetChan **)(this + 0x423c) = this;
        uVar4 = _ProcessMessages(this,(bf_read *)&local_40);
      }
      else {
        pCVar1 = this + iVar3 + 0xe8;
        cVar2 = IsValidFileForTransfer((char *)pCVar1);
        if (cVar2 == '\0') {
          uVar4 = 1;
          ConMsg("Invalid file for transfer \'%s\'!\n",pCVar1);
        }
        else {
          cVar2 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x28))(g_pFileSystem + 4,pCVar1,0);
          if ((cVar2 == '\0') || (cVar2 = CL_ShouldRedownloadFile((char *)pCVar1), cVar2 != '\0')) {
            COM_CreatePath((char *)pCVar1);
            iVar5 = (**(code **)(*(int *)(g_pFileSystem + 4) + 8))
                              (g_pFileSystem + 4,pCVar1,&DAT_002a5c80,0);
            *(int *)(this + iVar3 + 0xe4) = iVar5;
            if (iVar5 == 0) {
              uVar4 = 1;
              ConMsg("Failed to write received file \'%s\'!\n",pCVar1);
            }
            else {
              (**(code **)(*(int *)(g_pFileSystem + 4) + 4))
                        (g_pFileSystem + 4,*(undefined4 *)(this + iVar3 + 0x1ec),
                         *(undefined4 *)(this + iVar3 + 0x1f0),iVar5);
              (**(code **)(*(int *)(g_pFileSystem + 4) + 0xc))
                        (g_pFileSystem + 4,*(undefined4 *)(this + iVar3 + 0xe4));
              if (*(int *)(net_showfragments._28_4_ + 0x30) == 2) {
                DevMsg("FileReceived: %s, %i bytes (ID %i)\n",pCVar1,
                       *(undefined4 *)(this + iVar3 + 0x1f0),*(undefined4 *)(this + iVar3 + 0x1f8));
              }
              uVar4 = 1;
              (**(code **)(**(int **)(this + 0x4208) + 0x20))
                        (*(int **)(this + 0x4208),pCVar1,*(undefined4 *)(this + iVar3 + 0x1f8),0);
            }
          }
          else {
            uVar4 = 1;
            ConMsg("Download file \'%s\' already exists!\n",pCVar1);
          }
        }
      }
      if (*(void **)(this + iVar3 + 0x1ec) != (void *)0x0) {
        operator_delete__(*(void **)(this + iVar3 + 0x1ec));
        *(undefined4 *)(this + iVar3 + 0x1ec) = 0;
      }
    }
  }
  return uVar4;
}

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)