L L4D2node

CHLTVDemoRecorder::WriteMessages

0x0016db50 · 568 bytes · __thiscall

_ZN17CHLTVDemoRecorder13WriteMessagesEhR8bf_write

Decompiled

undefined (3 params)

/* CHLTVDemoRecorder::WriteMessages(unsigned char, bf_write&) */

void __thiscall
CHLTVDemoRecorder::WriteMessages(CHLTVDemoRecorder *this,uchar param_1,bf_write *param_2)

{
  CDemoFile *this_00;
  uint uVar1;
  int iVar2;
  democmdinfo_t *pdVar3;
  democmdinfo_t *pdVar4;
  undefined4 uVar5;
  uint *puVar6;
  int iVar7;
  int iVar8;
  democmdinfo_t local_14c [304];
  democmdinfo_t local_1c [12];
  
  uVar1 = *(uint *)(param_2 + 0xc);
  iVar8 = (int)(uVar1 + 7) >> 3;
  if (0 < iVar8) {
    if ((int)uVar1 % 8 - 1U < 2) {
      if (*(int *)(param_2 + 8) < (int)(uVar1 + 6)) {
        *(int *)(param_2 + 0xc) = *(int *)(param_2 + 8);
        param_2[0x10] = (bf_write)0x1;
      }
      else {
        iVar2 = ((int)uVar1 >> 5) * 4;
        puVar6 = (uint *)(iVar2 + *(int *)param_2);
        *puVar6 = *puVar6 & *(uint *)(&DAT_003f2db8 + (uVar1 & 0x1f) * 0x84);
        iVar7 = 0x20 - (uVar1 & 0x1f);
        if (iVar7 < 6) {
          puVar6 = (uint *)(*(int *)param_2 + 4 + iVar2);
          *puVar6 = *puVar6 & (&g_BitWriteMasks)[6 - iVar7];
        }
        *(int *)(param_2 + 0xc) = *(int *)(param_2 + 0xc) + 6;
      }
    }
    if (param_1 == '\x02') {
      *(int *)(this + 0x584) = *(int *)(this + 0x584) + 1;
    }
    this_00 = (CDemoFile *)(this + 4);
    iVar2 = (**(code **)(*(int *)this + 4))(this);
    CDemoFile::WriteCmdHeader(this_00,param_1,iVar2,0);
    pdVar3 = local_14c;
    do {
      *(undefined4 *)pdVar3 = 0;
      pdVar4 = pdVar3 + 0x4c;
      *(undefined4 *)(pdVar3 + 4) = 0;
      *(undefined4 *)(pdVar3 + 8) = 0;
      *(undefined4 *)(pdVar3 + 0xc) = 0;
      *(undefined4 *)(pdVar3 + 0x10) = 0;
      *(undefined4 *)(pdVar3 + 0x14) = 0;
      *(undefined4 *)(pdVar3 + 0x18) = 0;
      *(undefined4 *)(pdVar3 + 0x1c) = 0;
      *(undefined4 *)(pdVar3 + 0x20) = 0;
      *(undefined4 *)(pdVar3 + 0x24) = 0;
      *(undefined4 *)(pdVar3 + 0x28) = 0;
      *(undefined4 *)(pdVar3 + 0x2c) = 0;
      *(undefined4 *)(pdVar3 + 0x30) = 0;
      *(undefined4 *)(pdVar3 + 0x34) = 0;
      *(undefined4 *)(pdVar3 + 0x38) = 0;
      *(undefined4 *)(pdVar3 + 0x3c) = 0;
      *(undefined4 *)(pdVar3 + 0x40) = 0;
      *(undefined4 *)(pdVar3 + 0x44) = 0;
      *(undefined4 *)(pdVar3 + 0x48) = 0;
      pdVar3 = pdVar4;
    } while (pdVar4 != local_1c);
    _V_memset(local_14c,0,0x130);
    CDemoFile::WriteCmdInfo(this_00,local_14c);
    CDemoFile::WriteSequenceInfo(this_00,*(int *)(this + 0x58c),*(int *)(this + 0x58c));
    *(int *)(this + 0x58c) = *(int *)(this + 0x58c) + 1;
    CDemoFile::WriteRawData(this_00,*(char **)param_2,iVar8);
    if (1 < *(int *)(tv_debug._28_4_ + 0x30)) {
      uVar5 = CDemoFile::GetCurPos(this_00,false);
      Msg("Writing SourceTV demo message %i bytes at file pos %i\n",iVar8,uVar5);
    }
  }
  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)