L L4D2node

CDemoFile::WriteCmdHeader

0x00130660 · 537 bytes · __thiscall

_ZN9CDemoFile14WriteCmdHeaderEhii

Decompiled

undefined (4 params)

/* CDemoFile::WriteCmdHeader(unsigned char, int, int) */

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

{
  CUtlBuffer *this_00;
  char cVar1;
  void *pvVar2;
  int iVar3;
  undefined1 local_24;
  undefined1 uStack_23;
  undefined1 uStack_22;
  undefined1 uStack_21;
  undefined1 local_20;
  undefined1 local_1f;
  undefined1 local_1e;
  undefined1 local_1d;
  
  this_00 = (CUtlBuffer *)(this + 0x534);
  if (((byte)this[0x549] & 1) == 0) {
    cVar1 = CUtlBuffer::CheckPut(this_00,1);
    if (cVar1 != '\0') {
      *(uchar *)(*(int *)(this + 0x534) + (*(int *)(this + 0x544) - *(int *)(this + 0x554))) =
           param_1;
      *(int *)(this + 0x544) = *(int *)(this + 0x544) + 1;
      CUtlBuffer::AddNullTermination(this_00);
    }
  }
  else {
    CUtlBuffer::Printf(this_00,"%u",param_1);
  }
  if (((byte)this[0x549] & 1) == 0) {
    cVar1 = CUtlBuffer::CheckPut(this_00,4);
    if (cVar1 != '\0') {
      if (((byte)this[0x568] & 1) == 0) {
        *(int *)(*(int *)(this + 0x534) + (*(int *)(this + 0x544) - *(int *)(this + 0x554))) =
             param_2;
        iVar3 = *(int *)(this + 0x544);
      }
      else {
        iVar3 = *(int *)(this + 0x544);
        pvVar2 = (void *)((iVar3 - *(int *)(this + 0x554)) + *(int *)(this + 0x534));
        if (pvVar2 != (void *)0x0) {
          uStack_21 = (undefined1)((uint)param_2 >> 0x18);
          local_20 = uStack_21;
          uStack_22 = (undefined1)((uint)param_2 >> 0x10);
          local_1f = uStack_22;
          uStack_23 = (undefined1)((uint)param_2 >> 8);
          local_1e = uStack_23;
          local_24 = (undefined1)param_2;
          local_1d = local_24;
          _V_memcpy(pvVar2,&local_20,4);
          iVar3 = *(int *)(this + 0x544);
        }
      }
      *(int *)(this + 0x544) = iVar3 + 4;
      CUtlBuffer::AddNullTermination(this_00);
    }
  }
  else {
    CUtlBuffer::Printf(this_00,"%d",param_2);
  }
  if (((((byte)this[0x549] & 1) != 0) && (*(int *)(this + 0x544) != 0)) &&
     (*(char *)(*(int *)(this + 0x534) + ((*(int *)(this + 0x544) + -1) - *(int *)(this + 0x554)))
      == '\n')) {
    iVar3 = 0;
    if (((byte)this[0x549] & 0x10) == 0) {
      iVar3 = *(int *)(this + 0x54c);
    }
    while (iVar3 = iVar3 + -1, -1 < iVar3) {
      cVar1 = CUtlBuffer::CheckPut(this_00,1);
      if (cVar1 != '\0') {
        *(undefined1 *)(*(int *)(this + 0x534) + (*(int *)(this + 0x544) - *(int *)(this + 0x554)))
             = 9;
        *(int *)(this + 0x544) = *(int *)(this + 0x544) + 1;
        CUtlBuffer::AddNullTermination(this_00);
      }
    }
  }
  cVar1 = CUtlBuffer::CheckPut(this_00,1);
  if (cVar1 != '\0') {
    *(char *)(*(int *)(this + 0x534) + (*(int *)(this + 0x544) - *(int *)(this + 0x554))) =
         (char)param_3;
    *(int *)(this + 0x544) = *(int *)(this + 0x544) + 1;
    CUtlBuffer::AddNullTermination(this_00);
  }
  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)