L L4D2node

CMatchTitleGameSettingsMgr::DefineSessionSearchKeys

0x0003a200 · 2449 bytes · __thiscall

_ZN26CMatchTitleGameSettingsMgr23DefineSessionSearchKeysEP9KeyValues

Decompiled

undefined (2 params)

/* CMatchTitleGameSettingsMgr::DefineSessionSearchKeys(KeyValues*) */

KeyValues * __thiscall
CMatchTitleGameSettingsMgr::DefineSessionSearchKeys
          (CMatchTitleGameSettingsMgr *this,KeyValues *param_1)

{
  KeyValues *this_00;
  int iVar1;
  char *pcVar2;
  KeyValues *pKVar3;
  undefined4 uVar4;
  KeyValues *pKVar5;
  char *pcVar6;
  KeyValues *pKVar7;
  char *pcVar8;
  int iVar9;
  int in_GS_OFFSET;
  longlong lVar10;
  uint in_stack_fffffeb8;
  CFmtStrN<256> local_12c [5];
  char local_127 [263];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  this_00 = KeyValues::operator_new((KeyValues *)0x2c,in_stack_fffffeb8);
                    /* try { // try from 0003a243 to 0003a247 has its CatchHandler @ 0003abea */
  KeyValues::KeyValues(this_00,"SessionSearch",(IKeyValuesSystem *)0x0,false);
  iVar1 = KeyValues::GetInt(param_1,"Members/numPlayers",1);
  KeyValues::SetInt(this_00,"numPlayers",iVar1);
  pcVar2 = (char *)KeyValues::GetString(param_1,"Game/mode","");
  pKVar3 = (KeyValues *)(**(code **)(*(int *)g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,pcVar2);
  uVar4 = KeyValues::GetString(pKVar3,"base",pcVar2);
  pKVar5 = (KeyValues *)(**(code **)(*(int *)g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,uVar4);
  lVar10 = KeyValues::GetUint64((char *)param_1,0xb0cf5);
  if (lVar10 != 0) {
    KeyValues::SetUint64((char *)this_00,CONCAT44((int)lVar10,"DependentLobby"));
  }
  pcVar6 = (char *)KeyValues::GetString(param_1,"Game/state",(char *)0x0);
  if (pcVar6 != (char *)0x0) {
    KeyValues::SetString(this_00,"Filter=/Game:state",pcVar6);
  }
  pcVar6 = (char *)KeyValues::GetString(param_1,"Game/mode",(char *)0x0);
  if (pcVar6 != (char *)0x0) {
    KeyValues::SetString(this_00,"Filter=/Game:mode",pcVar6);
  }
  pcVar6 = (char *)KeyValues::GetString(param_1,"Game/difficulty",(char *)0x0);
  if (pcVar6 != (char *)0x0) {
    KeyValues::SetString(this_00,"Filter=/Game:difficulty",pcVar6);
  }
  iVar1 = KeyValues::GetInt(param_1,"Game/maxrounds",0);
  if (iVar1 != 0) {
    iVar9 = KeyValues::GetInt(pKVar5,"hasroundlimit",0);
    iVar9 = KeyValues::GetInt(pKVar3,"hasroundlimit",(uint)(iVar9 != 0));
    if (iVar9 != 0) {
      iVar9 = StringAfterPrefix(pcVar2,"team");
      pcVar6 = "Near";
      if (iVar9 != 0) {
        pcVar6 = "Filter=";
      }
      CFmtStrN<256>::CFmtStrN(local_12c,"%s/Game:maxrounds",pcVar6);
      KeyValues::SetInt(this_00,local_127,iVar1);
    }
  }
  pcVar6 = (char *)KeyValues::GetString(param_1,"Game/campaign","");
  if (*pcVar6 != '\0') {
    KeyValues::SetString(this_00,"Filter=/Game:campaign",pcVar6);
  }
  CFmtStrN<256>::CFmtStrN(local_12c,"game/sk_%s",uVar4);
  pKVar7 = (KeyValues *)KeyValues::FindKey(param_1,local_127,false);
  if (pKVar7 != (KeyValues *)0x0) {
    iVar1 = KeyValues::GetInt(pKVar7,(char *)0x0,0);
    CFmtStrN<256>::CFmtStrN(local_12c,"Near/Game:sk_%s",uVar4);
    KeyValues::SetInt(this_00,local_127,iVar1);
  }
  iVar1 = KeyValues::GetInt(param_1,"Game/chapter",0);
  if (iVar1 != 0) {
    iVar9 = KeyValues::GetInt(pKVar5,"singlechapter",0);
    iVar9 = KeyValues::GetInt(pKVar3,"singlechapter",(uint)(iVar9 != 0));
    if ((iVar9 == 0) && (iVar9 = StringAfterPrefix(pcVar2,"team"), iVar9 == 0)) {
      pcVar6 = "Near";
    }
    else {
      pcVar6 = "Filter=";
    }
    CFmtStrN<256>::CFmtStrN(local_12c,"%s/Game:chapter",pcVar6);
    KeyValues::SetInt(this_00,local_127,iVar1);
  }
  iVar1 = StringAfterPrefix(pcVar2,"team");
  if (iVar1 == 0) {
    KeyValues::SetInt(this_00,"Near/Members:numPlayers",99);
  }
  pcVar6 = (char *)KeyValues::GetString(param_1,"Game/MissionInfo/BuiltIn",(char *)0x0);
  pcVar8 = (char *)KeyValues::GetString(param_1,"Game/campaign","");
  if (*pcVar8 == '\0') {
    pcVar8 = (char *)KeyValues::GetString(param_1,"Options/action","");
    iVar1 = _V_stricmp(pcVar8,"quickmatch");
    if ((iVar1 == 0) || (iVar1 = _V_stricmp(pcVar8,"custommatch"), iVar1 == 0)) {
      pcVar6 = "official";
    }
    pcVar8 = (char *)KeyValues::GetString(param_1,"Game/mode","");
    iVar1 = StringAfterPrefix(pcVar8,"team");
    if (iVar1 == 0) goto LAB_0003a4da;
    pcVar6 = "official";
  }
  else {
LAB_0003a4da:
    if (pcVar6 == (char *)0x0) goto LAB_0003a648;
  }
  iVar1 = _V_stricmp(pcVar6,"addon");
  if (iVar1 != 0) {
    iVar1 = _V_stricmp(pcVar6,"official");
    if (iVar1 == 0) {
      KeyValues::SetInt(this_00,"Filter=/Game:MissionInfo:BuiltIn",1);
      goto LAB_0003a648;
    }
    iVar1 = _V_stricmp(pcVar6,"installedaddon");
    if (iVar1 != 0) {
      iVar1 = _V_stricmp(pcVar6,"notinstalledaddon");
      if (iVar1 == 0) {
        KeyValues::SetInt(this_00,"Filter=/Game:MissionInfo:BuiltIn",0);
        pKVar3 = (KeyValues *)(*(code *)**(undefined4 **)g_pMatchExtL4D)(g_pMatchExtL4D);
        if (pKVar3 != (KeyValues *)0x0) {
          for (pKVar3 = (KeyValues *)KeyValues::GetFirstTrueSubKey(pKVar3);
              pKVar3 != (KeyValues *)0x0; pKVar3 = (KeyValues *)KeyValues::GetNextTrueSubKey(pKVar3)
              ) {
            iVar1 = KeyValues::GetInt(pKVar3,"BuiltIn",0);
            if (iVar1 == 0) {
              pcVar8 = "Name";
              pcVar6 = (char *)KeyValues::GetString(pKVar3,"Name","");
              pKVar5 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pcVar8);
                    /* try { // try from 0003a5e9 to 0003a5ed has its CatchHandler @ 0003abd2 */
              KeyValues::KeyValues(pKVar5,"Game:campaign",(char *)0x0,pcVar6);
              pKVar7 = (KeyValues *)KeyValues::FindKey(this_00,"Filter<>",true);
              KeyValues::AddSubKey(pKVar7,pKVar5);
            }
          }
        }
        KeyValues::SetString(this_00,"Filter<>/Game:MissionInfo:Website","");
      }
      goto LAB_0003a648;
    }
  }
  KeyValues::SetInt(this_00,"Filter=/Game:MissionInfo:BuiltIn",0);
LAB_0003a648:
  iVar1 = StringAfterPrefix(pcVar2,"team");
  if (iVar1 == 0) {
    pcVar6 = (char *)KeyValues::GetString(param_1,"Options/action","");
    iVar1 = _V_stricmp(pcVar6,"quickmatch");
    if ((iVar1 == 0) &&
       (pcVar6 = (char *)KeyValues::GetString(param_1,"Options/server",(char *)0x0),
       pcVar6 != (char *)0x0)) {
      KeyValues::SetString(this_00,"Filter=/Options:server",pcVar6);
    }
  }
  else {
    pcVar6 = (char *)KeyValues::GetString(param_1,"Options/server","");
    iVar1 = _V_stricmp(pcVar6,"listen");
    pcVar6 = "Filter<>";
    if (iVar1 == 0) {
      pcVar6 = "Filter=";
    }
    CFmtStrN<256>::CFmtStrN(local_12c,"%s/Options:server",pcVar6);
    KeyValues::SetString(this_00,local_127,"listen");
  }
  pcVar6 = (char *)KeyValues::GetString(param_1,"Options/action","");
  iVar1 = _V_stricmp(pcVar6,"quickmatch");
  if ((iVar1 == 0) || (iVar1 = _V_stricmp(pcVar6,"custommatch"), iVar1 == 0)) {
    pcVar6 = (char *)KeyValues::GetString(param_1,"Game/state","");
    iVar1 = _V_stricmp("game",pcVar6);
    if (iVar1 == 0) {
      pKVar3 = (KeyValues *)KeyValues::MakeCopy(this_00);
      KeyValues::SetName(pKVar3,"nextpass");
      KeyValues::AddSubKey(this_00,pKVar3);
      KeyValues::SetString(pKVar3,"Filter=/Game:state","lobby");
    }
  }
  iVar1 = StringAfterPrefix(pcVar2,"team");
  if (iVar1 != 0) {
    iVar1 = KeyValues::GetInt(param_1,"Game/chapter",0);
    pKVar3 = this_00;
    if (iVar1 != 0) {
      pKVar3 = (KeyValues *)KeyValues::MakeCopy(this_00);
      KeyValues::SetName(pKVar3,"nextpass");
      KeyValues::AddSubKey(this_00,pKVar3);
      KeyValues::SetInt(pKVar3,"Filter=/Game:chapter",0);
    }
    pcVar2 = (char *)KeyValues::GetString(param_1,"game/campaign","");
    if ((*pcVar2 != '\0') &&
       (iVar1 = KeyValues::GetInt(param_1,"game/missioninfo/BuiltIn",0), iVar1 != 0)) {
      pKVar5 = (KeyValues *)KeyValues::MakeCopy(pKVar3);
      KeyValues::SetName(pKVar5,"nextpass");
      KeyValues::AddSubKey(pKVar3,pKVar5);
      KeyValues::SetString(pKVar5,"Filter=/Game:campaign","");
    }
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return this_00;
  }
                    /* 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)