L L4D2node

CDemoFile::ReadCmdHeader

0x00130890 · 561 bytes · __thiscall

_ZN9CDemoFile13ReadCmdHeaderERhRiS1_

Decompiled

undefined (4 params)

/* CDemoFile::ReadCmdHeader(unsigned char&, int&, int&) */

void __thiscall CDemoFile::ReadCmdHeader(CDemoFile *this,uchar *param_1,int *param_2,int *param_3)

{
  CUtlBuffer *this_00;
  CDemoFile CVar1;
  byte bVar2;
  char cVar3;
  int *piVar4;
  int iVar5;
  uint uVar6;
  int iVar7;
  int local_24;
  undefined4 local_20;
  
  this_00 = (CUtlBuffer *)(this + 0x534);
  uVar6 = (byte)this[0x549] & 1;
  if (((byte)this[0x549] & 1) == 0) {
    cVar3 = CUtlBuffer::CheckGet(this_00,1);
    if (cVar3 != '\0') {
      bVar2 = *(byte *)(*(int *)(this + 0x534) + (*(int *)(this + 0x540) - *(int *)(this + 0x554)));
      uVar6 = (uint)bVar2;
      *(int *)(this + 0x540) = *(int *)(this + 0x540) + 1;
      *param_1 = bVar2;
      CVar1 = this[0x548];
      goto joined_r0x001309c8;
    }
  }
  else {
    local_20 = local_20 & 0xffffff00;
    CUtlBuffer::Scanf(this_00,"%u",&local_20);
    uVar6 = local_20 & 0xff;
  }
  *param_1 = (uchar)uVar6;
  CVar1 = this[0x548];
joined_r0x001309c8:
  if (CVar1 != (CDemoFile)0x0) {
    ConDMsg("Missing end tag in demo file.\n");
    *param_1 = '\a';
    return;
  }
  if (8 < (byte)((char)uVar6 - 1U)) {
    ConDMsg("Unexepcted command token [%d] in .demo file\n",uVar6);
    *param_1 = '\a';
    return;
  }
  if (((byte)this[0x549] & 1) == 0) {
    cVar3 = CUtlBuffer::CheckGet(this_00,4);
    iVar7 = 0;
    if (cVar3 != '\0') {
      if (((byte)this[0x568] & 1) == 0) {
        iVar5 = *(int *)(this + 0x540);
        iVar7 = *(int *)(*(int *)(this + 0x534) + (iVar5 - *(int *)(this + 0x554)));
      }
      else {
        piVar4 = (int *)((*(int *)(this + 0x540) - *(int *)(this + 0x554)) + *(int *)(this + 0x534))
        ;
        if (piVar4 == (int *)0x0) {
          piVar4 = &local_24;
        }
        local_20 = local_24;
        local_20 = CONCAT31((int3)((uint)local_24 >> 8),*(undefined1 *)((int)piVar4 + 3));
        local_20._2_2_ = (undefined2)((uint)local_24 >> 0x10);
        local_20._0_2_ = CONCAT11(*(undefined1 *)((int)piVar4 + 2),*(undefined1 *)((int)piVar4 + 3))
        ;
        local_20._3_1_ = (undefined1)((uint)local_24 >> 0x18);
        local_20._0_3_ = CONCAT12(*(undefined1 *)((int)piVar4 + 1),(undefined2)local_20);
        local_20 = CONCAT13((char)*piVar4,(undefined3)local_20);
        _V_memcpy(&local_24,&local_20,4);
        iVar5 = *(int *)(this + 0x540);
        iVar7 = local_24;
      }
      *(int *)(this + 0x540) = iVar5 + 4;
    }
  }
  else {
    local_24 = 0;
    CUtlBuffer::Scanf(this_00,"%d",&local_24);
    iVar7 = local_24;
  }
  *param_2 = iVar7;
  if (((byte)this[0x549] & 1) == 0) {
    cVar3 = CUtlBuffer::CheckGet(this_00,1);
    iVar7 = 0;
    if (cVar3 != '\0') {
      iVar7 = (int)*(char *)(*(int *)(this + 0x534) +
                            (*(int *)(this + 0x540) - *(int *)(this + 0x554)));
      *(int *)(this + 0x540) = *(int *)(this + 0x540) + 1;
    }
  }
  else {
    local_20 = local_20 & 0xffffff00;
    CUtlBuffer::Scanf(this_00,"%c",&local_20);
    iVar7 = (int)(char)local_20;
  }
  *param_3 = iVar7;
  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)