L L4D2node

tv_record

0x001745d0 · 377 bytes · __cdecl

_ZL9tv_recordRK8CCommand

Decompiled

undefined (1 param)

/* tv_record(CCommand const&) */

void tv_record(CCommand *param_1)

{
  char cVar1;
  char *pcVar2;
  undefined1 *puVar3;
  undefined4 uVar4;
  int in_GS_OFFSET;
  char local_114 [260];
  int local_10;
  
  local_10 = *(int *)(in_GS_OFFSET + 0x14);
  if (*(int *)param_1 < 2) {
    ConMsg("Usage:  tv_record  <filename>\n");
  }
  else {
    if (hltv != (int *)0x0) {
      cVar1 = (**(code **)(hltv[1] + 0x58))(hltv + 1);
      if (cVar1 != '\0') {
        cVar1 = (**(code **)(*hltv + 0x54))(hltv);
        if (cVar1 == '\0') {
          ConMsg("Only SourceTV Master can record demos instantly.\n");
        }
        else {
          cVar1 = CHLTVDemoRecorder::IsRecording((CHLTVDemoRecorder *)(hltv + 0x1301));
          if (cVar1 == '\0') {
            pcVar2 = "";
            if (1 < *(int *)param_1) {
              pcVar2 = *(char **)(param_1 + 0x40c);
            }
            cVar1 = COM_IsValidPath(pcVar2);
            if (cVar1 == '\0') {
              puVar3 = &DAT_002c79d4;
              if (1 < *(int *)param_1) {
                puVar3 = *(undefined1 **)(param_1 + 0x40c);
              }
              ConMsg("record %s: invalid path.\n",puVar3);
            }
            else {
              if (*(int *)param_1 < 2) {
                pcVar2 = "";
              }
              else {
                pcVar2 = *(char **)(param_1 + 0x40c);
              }
              V_strncpy(local_114,pcVar2,0x104);
              V_DefaultExtension(local_114,".dem",0x104);
              CHLTVDemoRecorder::StartRecording((char *)(hltv + 0x1301),SUB41(local_114,0));
            }
          }
          else {
            uVar4 = CHLTVDemoRecorder::GetDemoFile((CHLTVDemoRecorder *)(hltv + 0x1301));
            ConMsg("SourceTV already recording to %s.\n",uVar4);
          }
        }
        goto LAB_00174616;
      }
    }
    ConMsg("SourceTV not active.\n");
  }
LAB_00174616:
  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)