L L4D2node

CBaseGameStats_Driver::CollectData

0x004623e0 · 400 bytes · __thiscall

_ZN21CBaseGameStats_Driver11CollectDataE14StatSendType_t

Decompiled

undefined (2 params)

/* CBaseGameStats_Driver::CollectData(StatSendType_t) */

void __thiscall CBaseGameStats_Driver::CollectData(CBaseGameStats_Driver *this,int param_2)

{
  int *piVar1;
  KeyValues *this_00;
  byte bVar2;
  undefined4 *puVar3;
  int iVar4;
  char *pcVar5;
  KeyValues *this_01;
  undefined4 *puVar6;
  int in_GS_OFFSET;
  char local_125 [4];
  undefined4 local_121 [64];
  int local_20;
  
  bVar2 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  puVar3 = (undefined4 *)(**(code **)(*engine + 0x208))(engine);
  if (puVar3 == (undefined4 *)0x0) {
    puVar3 = *(undefined4 **)(this + 0x1384);
  }
  else {
    piVar1 = *(int **)(this + 0x1384);
    if (piVar1 != (int *)0x0) {
      if (*piVar1 != 0) {
        KeyValues::deleteThis();
        *piVar1 = 0;
      }
      operator_delete(piVar1);
      *(undefined4 *)(this + 0x1384) = 0;
    }
  }
  this_00 = (KeyValues *)*puVar3;
  iVar4 = (**(code **)(*engine + 0x1a8))(engine);
  KeyValues::SetInt(this_00,"appid",iVar4);
  this_01 = this_00;
  if (param_2 == 0) {
    local_125[0] = '\0';
    local_125[1] = '\0';
    local_125[2] = '\0';
    local_125[3] = '\0';
    puVar6 = local_121;
    for (iVar4 = 0x40; iVar4 != 0; iVar4 = iVar4 + -1) {
      *puVar6 = 0;
      puVar6 = puVar6 + (uint)bVar2 * -2 + 1;
    }
    *(undefined1 *)puVar6 = 0;
    pcVar5 = "";
    if (*(char **)(gpGlobals + 0x3c) != (char *)0x0) {
      pcVar5 = *(char **)(gpGlobals + 0x3c);
    }
    V_strncpy(local_125,pcVar5,0x105);
    if (local_125[0] == '\0') goto LAB_004624c7;
    this_01 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pcVar5);
                    /* try { // try from 00462515 to 00462519 has its CatchHandler @ 00462580 */
    KeyValues::KeyValues(this_01,"map",(IKeyValuesSystem *)0x0,false);
    KeyValues::AddSubKey(this_00,this_01);
    KeyValues::SetString(this_01,"mapname",local_125);
  }
  bVar2 = (**(code **)(*(int *)gamestats + 4))(gamestats,this_01,param_2);
  *(byte *)(puVar3 + 1) = *(byte *)(puVar3 + 1) | bVar2;
LAB_004624c7:
  if (local_20 == *(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)