L L4D2node

CMatchExtL4D::MakeGameModeCopy

0x00034ac0 · 716 bytes · __thiscall

_ZN12CMatchExtL4D16MakeGameModeCopyEPKcS1_

Decompiled

undefined (3 params)

/* CMatchExtL4D::MakeGameModeCopy(char const*, char const*) */

void __thiscall CMatchExtL4D::MakeGameModeCopy(CMatchExtL4D *this,char *param_1,char *param_2)

{
  KeyValues *pKVar1;
  KeyValues *pKVar2;
  int iVar3;
  KeyValues *pKVar4;
  undefined4 uVar5;
  int in_GS_OFFSET;
  CFmtStrN<256> local_12c [5];
  char local_127 [263];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  CFmtStrN<256>::CFmtStrN(local_12c,"GameModes/%s",param_1);
  pKVar1 = (KeyValues *)KeyValues::FindKey(*(KeyValues **)(this + 4),local_127,false);
  CFmtStrN<256>::CFmtStrN(local_12c,"GameModes/%s",param_2);
  pKVar2 = (KeyValues *)KeyValues::FindKey(*(KeyValues **)(this + 4),local_127,false);
  if ((pKVar1 != (KeyValues *)0x0) && (pKVar2 == (KeyValues *)0x0)) {
    pKVar2 = (KeyValues *)KeyValues::MakeCopy(pKVar1);
    KeyValues::SetName(pKVar2,param_2);
    pKVar4 = (KeyValues *)KeyValues::FindKey(*(KeyValues **)(this + 4),"GameModes",false);
    KeyValues::AddSubKey(pKVar4,pKVar2);
  }
  if ((pKVar2 != (KeyValues *)0x0) && (pKVar1 != (KeyValues *)0x0)) {
    uVar5 = KeyValues::FindKey(pKVar1,"missions",false);
    pKVar4 = (KeyValues *)KeyValues::FindKey(pKVar2,"missions",true);
    KeyValues::MergeFrom(pKVar4,uVar5,1);
    iVar3 = KeyValues::GetInt(pKVar1,"missions",0);
    KeyValues::SetInt(pKVar2,"missions",iVar3);
  }
  iVar3 = StringAfterPrefix(param_2,"team");
  KeyValues::SetInt(pKVar2,"team",(uint)(iVar3 != 0));
  pKVar1 = (KeyValues *)(*(code *)**(undefined4 **)this)(this);
  if (pKVar1 != (KeyValues *)0x0) {
    for (pKVar1 = (KeyValues *)KeyValues::GetFirstTrueSubKey(pKVar1); pKVar1 != (KeyValues *)0x0;
        pKVar1 = (KeyValues *)KeyValues::GetNextTrueSubKey(pKVar1)) {
      pKVar2 = (KeyValues *)KeyValues::FindKey(pKVar1,"Modes",false);
      iVar3 = KeyValues::FindKey(pKVar2,param_2,false);
      if (iVar3 == 0) {
        CFmtStrN<256>::CFmtStrN(local_12c,"Modes/%s",param_1);
        pKVar2 = (KeyValues *)KeyValues::FindKey(pKVar1,local_127,false);
        if (pKVar2 != (KeyValues *)0x0) {
          pKVar2 = (KeyValues *)KeyValues::MakeCopy(pKVar2);
          KeyValues::SetName(pKVar2,param_2);
          pKVar4 = (KeyValues *)KeyValues::FindKey(pKVar1,"Modes",false);
          KeyValues::AddSubKey(pKVar4,pKVar2);
        }
      }
    }
  }
  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)