L L4D2node

CDemoFile::ReadRawData

0x001311b0 · 452 bytes · __thiscall

_ZN9CDemoFile11ReadRawDataEPci

Decompiled

undefined (3 params)

/* CDemoFile::ReadRawData(char*, int) */

int __thiscall CDemoFile::ReadRawData(CDemoFile *this,char *param_1,int param_2)

{
  CUtlBuffer *this_00;
  char cVar1;
  int *piVar2;
  int iVar3;
  int iVar4;
  int local_24;
  undefined4 local_20;
  
  this_00 = (CUtlBuffer *)(this + 0x534);
  if (((byte)this[0x549] & 1) == 0) {
    cVar1 = CUtlBuffer::CheckGet(this_00,4);
    iVar3 = 0;
    if (cVar1 != '\0') {
      if (((byte)this[0x568] & 1) == 0) {
        iVar4 = *(int *)(this + 0x540);
        iVar3 = *(int *)(*(int *)(this + 0x534) + (iVar4 - *(int *)(this + 0x554)));
      }
      else {
        piVar2 = (int *)((*(int *)(this + 0x540) - *(int *)(this + 0x554)) + *(int *)(this + 0x534))
        ;
        if (piVar2 == (int *)0x0) {
          piVar2 = &local_24;
        }
        local_20 = local_24;
        local_20 = CONCAT31((int3)((uint)local_24 >> 8),*(undefined1 *)((int)piVar2 + 3));
        local_20._2_2_ = (undefined2)((uint)local_24 >> 0x10);
        local_20._0_2_ = CONCAT11(*(undefined1 *)((int)piVar2 + 2),*(undefined1 *)((int)piVar2 + 3))
        ;
        local_20._3_1_ = (undefined1)((uint)local_24 >> 0x18);
        local_20._0_3_ = CONCAT12(*(undefined1 *)((int)piVar2 + 1),(undefined2)local_20);
        local_20 = CONCAT13((char)*piVar2,(undefined3)local_20);
        _V_memcpy(&local_24,&local_20,4);
        iVar4 = *(int *)(this + 0x540);
        iVar3 = local_24;
      }
      *(int *)(this + 0x540) = iVar4 + 4;
    }
  }
  else {
    local_24 = 0;
    CUtlBuffer::Scanf(this_00,"%d",&local_24);
    iVar3 = local_24;
  }
  if ((param_2 < iVar3) && (param_1 != (char *)0x0)) {
    DevMsg("CDemoFile::ReadRawData: buffe overflow (%i).\n",iVar3);
    iVar3 = -1;
  }
  else if (param_1 == (char *)0x0) {
    CUtlBuffer::SeekGet(this_00,1,iVar3);
  }
  else if (param_2 < iVar3) {
    DevMsg("CDemoFile::ReadRawData: buffer overflow (%i).\n",iVar3);
    CUtlBuffer::SeekGet(this_00,1,iVar3);
    iVar3 = -1;
  }
  else {
    CUtlBuffer::Get(this_00,param_1,iVar3);
    if (this[0x548] != (CDemoFile)0x0) {
      Host_EndGame(true,"Error reading demo message data.\n");
      iVar3 = -1;
    }
  }
  return iVar3;
}

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)