L L4D2node

CMatchTitleGameSettingsMgr::RollupGameDetails

0x00039a20 · 1463 bytes · __thiscall

_ZN26CMatchTitleGameSettingsMgr17RollupGameDetailsEP9KeyValuesS1_S1_

Decompiled

undefined (4 params)

/* CMatchTitleGameSettingsMgr::RollupGameDetails(KeyValues*, KeyValues*, KeyValues*) */

KeyValues * __thiscall
CMatchTitleGameSettingsMgr::RollupGameDetails
          (CMatchTitleGameSettingsMgr *this,KeyValues *param_1,KeyValues *param_2,KeyValues *param_3
          )

{
  int iVar1;
  int iVar2;
  char *pcVar3;
  undefined4 uVar4;
  KeyValues *pKVar5;
  KeyValues *this_00;
  char *pcVar6;
  int in_GS_OFFSET;
  char *pcVar7;
  ulong local_134;
  int local_130;
  CFmtStrN<256> local_12c [5];
  char local_127 [263];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (param_1 == (KeyValues *)0x0) {
    if ((((param_2 != (KeyValues *)0x0) &&
         (iVar1 = KeyValues::GetInt(param_2,"Game/MissionInfo/BuiltIn",0), iVar1 == 0)) &&
        (pcVar3 = (char *)KeyValues::GetString(param_2,"Game/MissionInfo/Website",(char *)0x0),
        pcVar3 != (char *)0x0)) && (*pcVar3 != '\0')) {
      uVar4 = KeyValues::GetString(param_2,"Game/campaign","");
      CFmtStrN<256>::CFmtStrN(local_12c,"%s/Version",uVar4);
      pKVar5 = (KeyValues *)(*(code *)**(undefined4 **)g_pMatchExtL4D)(g_pMatchExtL4D);
      iVar1 = KeyValues::GetInt(pKVar5,local_127,-1);
      iVar2 = KeyValues::GetInt(param_2,"Game/MissionInfo/Version",0);
      if (iVar1 < iVar2) {
        pKVar5 = (KeyValues *)KeyValues::FindKey(param_2,"Rollup",false);
        if (pKVar5 != (KeyValues *)0x0) {
          KeyValues::RemoveSubKey(param_2,pKVar5);
          KeyValues::deleteThis();
        }
        goto LAB_00039b0b;
      }
    }
  }
  else {
    if (param_2 != (KeyValues *)0x0) {
      iVar1 = KeyValues::GetInt(param_2,"Game/MissionInfo/Version",-1);
      iVar2 = KeyValues::GetInt(param_1,"Game/MissionInfo/Version",0);
      if (iVar1 < iVar2) {
        uVar4 = KeyValues::FindKey(param_1,"Game/MissionInfo",false);
        pKVar5 = (KeyValues *)KeyValues::FindKey(param_2,"Game/MissionInfo",true);
        KeyValues::MergeFrom(pKVar5,uVar4,1);
      }
      pcVar3 = (char *)KeyValues::GetString(param_1,"Game/state","game");
      iVar1 = _V_stricmp(pcVar3,"lobby");
      if ((iVar1 != 0) && (iVar1 = _V_stricmp(pcVar3,"game"), iVar1 != 0)) {
        pcVar3 = "game";
      }
      CFmtStrN<256>::CFmtStrN(local_12c,"Rollup/%s",pcVar3);
      iVar1 = KeyValues::GetInt(param_2,local_127,0);
      KeyValues::SetInt(param_2,local_127,iVar1 + 1);
      goto LAB_00039b0b;
    }
    pcVar3 = (char *)KeyValues::GetString(param_1,"Game/mode","");
    if ((pcVar3 != (char *)0x0) && (*pcVar3 != '\0')) {
      pKVar5 = (KeyValues *)(**(code **)(*(int *)g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,pcVar3);
      uVar4 = KeyValues::GetString(pKVar5,"base",pcVar3);
      this_00 = (KeyValues *)(**(code **)(*(int *)g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,uVar4);
      iVar1 = KeyValues::GetInt(this_00,"singlechapter",0);
      iVar1 = KeyValues::GetInt(pKVar5,"singlechapter",(uint)(iVar1 != 0));
      iVar2 = KeyValues::GetInt(this_00,"hasdifficulty",0);
      iVar2 = KeyValues::GetInt(pKVar5,"hasdifficulty",(uint)(iVar2 != 0));
      pcVar7 = "Game/campaign";
      pcVar6 = (char *)KeyValues::GetString(param_1,"Game/campaign","");
      if ((pcVar6 != (char *)0x0) && (*pcVar6 != '\0')) {
        param_2 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pcVar7);
                    /* try { // try from 00039dff to 00039e03 has its CatchHandler @ 00039fe7 */
        KeyValues::KeyValues(param_2,"Rollup",(IKeyValuesSystem *)0x0,false);
        local_134 = 0;
        CRC32_Init(&local_134);
        KeyValues::SetString(param_2,"Game/mode",pcVar3);
        AppendToRollup(pcVar3,&local_134);
        KeyValues::SetString(param_2,"Game/campaign",pcVar6);
        AppendToRollup(pcVar6,&local_134);
        if ((iVar1 != 0) &&
           (local_130 = KeyValues::GetInt(param_1,"Game/chapter",-1), 0 < local_130)) {
          KeyValues::SetInt(param_2,"Game/chapter",local_130);
          CRC32_ProcessBuffer(&local_134,&local_130,4);
        }
        if (((iVar2 != 0) &&
            (pcVar3 = (char *)KeyValues::GetString(param_1,"Game/difficulty",(char *)0x0),
            pcVar3 != (char *)0x0)) && (*pcVar3 != '\0')) {
          KeyValues::SetString(param_2,"Game/difficulty",pcVar3);
          AppendToRollup(pcVar3,&local_134);
        }
        iVar1 = KeyValues::GetString(param_3,"Game/state",(char *)0x0);
        if (((iVar1 != 0) &&
            (pcVar3 = (char *)KeyValues::GetString(param_1,"Game/state",(char *)0x0),
            pcVar3 != (char *)0x0)) && (*pcVar3 != '\0')) {
          KeyValues::SetString(param_2,"Game/state",pcVar3);
        }
        KeyValues::SetUint64((char *)param_2,CONCAT44(local_134,"rollupkey"));
        goto LAB_00039b0b;
      }
    }
  }
  param_2 = (KeyValues *)0x0;
LAB_00039b0b:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return param_2;
}

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)