L L4D2node

CDirector::OverridePopulation

0x00875d70 · 356 bytes · __thiscall

_ZN9CDirector18OverridePopulationEPKcS1_

Decompiled

undefined (3 params)

/* CDirector::OverridePopulation(char const*, char const*) */

void __thiscall CDirector::OverridePopulation(CDirector *this,char *param_1,char *param_2)

{
  char cVar1;
  KeyValues *this_00;
  IBaseFileSystem *pIVar2;
  KeyValues *this_01;
  KeyValues *pKVar3;
  int in_GS_OFFSET;
  char *pcVar4;
  CFmtStrN<256> local_12c [5];
  char local_127 [263];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pcVar4 = "%sPopulation";
  CFmtStrN<256>::CFmtStrN(local_12c,"%sPopulation",param_2);
  this_00 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pcVar4);
                    /* try { // try from 00875dd2 to 00875dd6 has its CatchHandler @ 00875ede */
  KeyValues::KeyValues(this_00,local_127,(IKeyValuesSystem *)0x0,false);
  CFmtStrN<256>::CFmtStrN(local_12c,"scripts/population_%s.txt",param_2);
  pIVar2 = (IBaseFileSystem *)0x0;
  if (filesystem != 0) {
    pIVar2 = (IBaseFileSystem *)(filesystem + 4);
  }
  cVar1 = KeyValues::LoadFromFile(this_00,pIVar2,local_127,"GAME");
  if (cVar1 != '\0') {
    for (this_01 = (KeyValues *)KeyValues::GetFirstSubKey(this_00); this_01 != (KeyValues *)0x0;
        this_01 = (KeyValues *)KeyValues::GetNextKey(this_01)) {
      pcVar4 = (char *)KeyValues::GetName(this_01);
      pKVar3 = (KeyValues *)KeyValues::FindKey(*(KeyValues **)(this + 0x414),pcVar4,false);
      if (pKVar3 != (KeyValues *)0x0) {
        KeyValues::RemoveSubKey(*(KeyValues **)(this + 0x414),pKVar3);
        KeyValues::deleteThis();
      }
    }
    KeyValues::MergeFrom(*(KeyValues **)(this + 0x414),this_00,1);
  }
  KeyValues::deleteThis();
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail(this_00);
  }
  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)