L L4D2node

CHLTVDemoRecorder::StartRecording

0x0016eba0 · 504 bytes · __cdecl

_ZN17CHLTVDemoRecorder14StartRecordingEPKcb

Decompiled

undefined (2 params)

/* CHLTVDemoRecorder::StartRecording(char const*, bool) */

void CHLTVDemoRecorder::StartRecording(char *param_1,bool param_2)

{
  CDemoFile *this;
  char cVar1;
  undefined4 uVar2;
  char *pcVar3;
  int in_GS_OFFSET;
  float fVar4;
  undefined3 in_stack_00000009;
  char local_124 [260];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  this = (CDemoFile *)(param_1 + 4);
  (**(code **)(*(int *)param_1 + 0x1c))(param_1);
  cVar1 = CDemoFile::Open(this,_param_2,false);
  if (cVar1 == '\0') {
    ConMsg("StartRecording: couldn\'t open demo file %s.\n",_param_2);
  }
  else {
    ConMsg("Recording SourceTV demo to %s...\n",_param_2);
    _V_memset(param_1 + 0x108,0,0x430);
    V_strncpy(param_1 + 0x108,"HL2DEMO",8);
    param_1[0x110] = '\x04';
    param_1[0x111] = '\0';
    param_1[0x112] = '\0';
    param_1[0x113] = '\0';
    uVar2 = GetNetworkVersion();
    *(undefined4 *)(param_1 + 0x114) = uVar2;
    pcVar3 = (char *)(**(code **)(*(int *)(hltv + 4) + 0x3c))(hltv + 4);
    V_strncpy(param_1 + 800,pcVar3,0x104);
    V_strncpy(local_124,com_gamedir,0x104);
    V_FileBase(local_124,param_1 + 0x424,0x104);
    pcVar3 = "FCVAR_NEVER_AS_STRING";
    if ((host_name[0x15] & 0x10) == 0) {
      pcVar3 = "";
      if (*(char **)(host_name._28_4_ + 0x24) != (char *)0x0) {
        pcVar3 = *(char **)(host_name._28_4_ + 0x24);
      }
    }
    V_strncpy(param_1 + 0x118,pcVar3,0x104);
    V_strncpy(param_1 + 0x21c,"SourceTV Demo",0x104);
    CDemoFile::WriteDemoHeader(this);
    uVar2 = WriteSignonData((CHLTVDemoRecorder *)param_1);
    fVar4 = (float)host_tickcount;
    param_1[0x584] = '\0';
    param_1[0x585] = '\0';
    param_1[0x586] = '\0';
    param_1[0x587] = '\0';
    *(undefined4 *)(param_1 + 0x534) = uVar2;
    *(float *)(param_1 + 0x588) = fVar4;
    CDemoFile::WriteCmdHeader(this,'\x03',0,0);
    param_1[0x580] = '\x01';
    param_1[0x58c] = '\x01';
    param_1[0x58d] = '\0';
    param_1[0x58e] = '\0';
    param_1[0x58f] = '\0';
    param_1[0x590] = -1;
    param_1[0x591] = -1;
    param_1[0x592] = -1;
    param_1[0x593] = -1;
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)