L L4D2node

CCommentarySystem::CalculateCommentaryState

0x0064ca40 · 282 bytes · __thiscall

_ZN17CCommentarySystem24CalculateCommentaryStateEv

Decompiled

undefined (1 param)

/* CCommentarySystem::CalculateCommentaryState() */

void __thiscall CCommentarySystem::CalculateCommentaryState(CCommentarySystem *this)

{
  char cVar1;
  int in_GS_OFFSET;
  undefined1 *puVar2;
  char *pcVar3;
  ConVarRef *local_218;
  int local_214;
  char local_210 [512];
  int local_10;
  
  local_10 = *(int *)(in_GS_OFFSET + 0x14);
  puVar2 = &DAT_00d539c2;
  if (*(undefined1 **)(gpGlobals + 0x3c) != (undefined1 *)0x0) {
    puVar2 = *(undefined1 **)(gpGlobals + 0x3c);
  }
  V_snprintf(local_210,0x200,"maps/%s_commentary.txt",puVar2);
  cVar1 = (**(code **)(*(int *)(filesystem + 4) + 0x28))(filesystem + 4,local_210,0);
  if (cVar1 == '\0') {
    pcVar3 = (char *)0x0;
    puVar2 = commentary_available;
    g_bInCommentaryMode = '\0';
    ConVar::SetValue(0xfc3d80);
  }
  else {
    pcVar3 = (char *)0x1;
    puVar2 = commentary_available;
    ConVar::SetValue(0xfc3d80);
  }
  if (g_bInCommentaryMode != '\0') {
    puVar2 = (undefined1 *)&local_218;
    pcVar3 = "sv_cheats";
    ConVarRef::ConVarRef((ConVarRef *)puVar2,"sv_cheats");
    cVar1 = ConVarRef::IsValid((ConVarRef *)puVar2);
    if (cVar1 != '\0') {
      this[0x28] = (CCommentarySystem)(*(int *)(local_214 + 0x30) != 0);
      pcVar3 = (char *)0x1;
      (**(code **)(*(int *)local_218 + 8))(local_218,1);
      puVar2 = local_218;
    }
  }
  if (local_10 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail(puVar2,pcVar3);
  }
  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)