L L4D2node

CDemoFile::WriteUserCmd

0x00131880 · 300 bytes · __thiscall

_ZN9CDemoFile12WriteUserCmdEiPKchii

Decompiled

undefined (6 params)

/* CDemoFile::WriteUserCmd(int, char const*, unsigned char, int, int) */

void __thiscall
CDemoFile::WriteUserCmd
          (CDemoFile *this,int param_1,char *param_2,uchar param_3,int param_4,int param_5)

{
  CUtlStreamBuffer *this_00;
  char cVar1;
  int iVar2;
  void *pvVar3;
  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 = (CUtlStreamBuffer *)(this + 0x534);
  cVar1 = CUtlStreamBuffer::IsOpen(this_00);
  if (cVar1 == '\0') {
    return;
  }
  WriteCmdHeader(this,'\x05',param_4,param_5);
  if (((byte)this[0x549] & 1) == 0) {
    cVar1 = CUtlBuffer::CheckPut((CUtlBuffer *)this_00,4);
    if (cVar1 != '\0') {
      if (((byte)this[0x568] & 1) == 0) {
        *(int *)(*(int *)(this + 0x534) + (*(int *)(this + 0x544) - *(int *)(this + 0x554))) =
             param_1;
        iVar2 = *(int *)(this + 0x544);
      }
      else {
        iVar2 = *(int *)(this + 0x544);
        pvVar3 = (void *)((iVar2 - *(int *)(this + 0x554)) + *(int *)(this + 0x534));
        if (pvVar3 != (void *)0x0) {
          uStack_21 = (undefined1)((uint)param_1 >> 0x18);
          local_20 = uStack_21;
          uStack_22 = (undefined1)((uint)param_1 >> 0x10);
          local_1f = uStack_22;
          uStack_23 = (undefined1)((uint)param_1 >> 8);
          local_1e = uStack_23;
          local_24 = (undefined1)param_1;
          local_1d = local_24;
          _V_memcpy(pvVar3,&local_20,4);
          iVar2 = *(int *)(this + 0x544);
        }
      }
      *(int *)(this + 0x544) = iVar2 + 4;
      CUtlBuffer::AddNullTermination((CUtlBuffer *)this_00);
    }
  }
  else {
    CUtlBuffer::Printf((CUtlBuffer *)this_00,"%d",param_1);
  }
  WriteRawData(this,param_2,(uint)param_3);
  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)