L L4D2node

CMatchTitle::OnEvent

0x00038490 · 1012 bytes · __thiscall

_ZN11CMatchTitle7OnEventEP9KeyValues

Decompiled

undefined (2 params)

/* CMatchTitle::OnEvent(KeyValues*) */

void __thiscall CMatchTitle::OnEvent(CMatchTitle *this,KeyValues *param_1)

{
  code *pcVar1;
  ulonglong uVar2;
  char *pcVar3;
  int iVar4;
  KeyValues *pKVar5;
  int *piVar6;
  KeyValues *pKVar7;
  KeyValues *pKVar8;
  undefined4 uVar9;
  undefined4 *puVar10;
  undefined8 uVar11;
  char *pcVar12;
  undefined4 uVar13;
  
  pcVar3 = (char *)KeyValues::GetName(param_1);
  iVar4 = _V_stricmp("OnPlayerRemoved",pcVar3);
  if ((iVar4 == 0) || (iVar4 = _V_stricmp("OnPlayerUpdated",pcVar3), iVar4 == 0)) {
    pKVar5 = (KeyValues *)GetCurrentMatchSessionSettings();
    MM_Title_RichPresence_PlayersChanged(pKVar5);
    return;
  }
  pcVar12 = pcVar3;
  iVar4 = _V_stricmp("OnPlayerMachinesConnected",pcVar3);
  if ((iVar4 == 0) ||
     (pcVar12 = pcVar3, iVar4 = _V_stricmp("OnPlayerMachinesDisconnected",pcVar3), iVar4 == 0)) {
    piVar6 = (int *)(**(code **)(*g_pMatchFramework + 0x24))(g_pMatchFramework);
    if (piVar6 != (int *)0x0) {
      pKVar5 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pcVar12);
                    /* try { // try from 0003853c to 00038540 has its CatchHandler @ 000388f0 */
      KeyValues::KeyValues(pKVar5,"Update",(IKeyValuesSystem *)0x0,false);
      pKVar7 = (KeyValues *)KeyValues::FindKey(pKVar5,"update",true);
      if (pKVar7 != (KeyValues *)0x0) {
        pKVar8 = (KeyValues *)(**(code **)(*piVar6 + 4))(piVar6);
        UpdateAggregateMembersSettings(pKVar8,pKVar7);
      }
                    /* try { // try from 0003857c to 0003857e has its CatchHandler @ 000388da */
      (**(code **)(*piVar6 + 8))(piVar6,pKVar5);
      if (pKVar5 != (KeyValues *)0x0) {
        KeyValues::deleteThis();
        return;
      }
    }
  }
  else {
    iVar4 = _V_stricmp("OnProfileDataSaved",pcVar3);
    if (iVar4 == 0) {
      piVar6 = (int *)(**(code **)(*g_pMatchFramework + 0x24))(g_pMatchFramework);
      if (piVar6 != (int *)0x0) {
        pcVar1 = *(code **)(*g_pPlayerManager + 4);
        uVar9 = KeyValues::GetInt(param_1,"iController",0);
        puVar10 = (undefined4 *)(*pcVar1)(g_pPlayerManager,uVar9);
        if (puVar10 != (undefined4 *)0x0) {
          pKVar5 = (KeyValues *)(**(code **)(*piVar6 + 4))(piVar6);
          pKVar5 = (KeyValues *)KeyValues::MakeCopy(pKVar5);
                    /* try { // try from 00038636 to 00038690 has its CatchHandler @ 000388a2 */
          InitializeMemberSettings(pKVar5);
          uVar2 = (**(code **)*puVar10)(puVar10);
          pKVar7 = (KeyValues *)SessionMembersFindPlayer(pKVar5,uVar2,(KeyValues **)0x0);
          if (pKVar7 != (KeyValues *)0x0) {
            pcVar3 = "game";
            iVar4 = KeyValues::FindKey(pKVar7,"game",false);
            if (iVar4 != 0) {
              pKVar8 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pcVar3);
                    /* try { // try from 000386af to 000386b3 has its CatchHandler @ 000388cb */
              KeyValues::KeyValues(pKVar8,"Game::PlayerInfo",(IKeyValuesSystem *)0x0,false);
                    /* try { // try from 000386ca to 0003872b has its CatchHandler @ 000388b8 */
              KeyValues::SetString(pKVar8,"run","host");
              uVar11 = (**(code **)*puVar10)(puVar10);
              uVar9 = (undefined4)((ulonglong)uVar11 >> 0x20);
              KeyValues::SetUint64((char *)pKVar8,CONCAT44((int)uVar11,"xuid"));
              uVar13 = 0;
              pKVar7 = (KeyValues *)KeyValues::FindKey(pKVar7,"game",false);
              pKVar7 = (KeyValues *)KeyValues::MakeCopy(pKVar7);
              KeyValues::AddSubKey(pKVar8,pKVar7);
              (**(code **)(*piVar6 + 0xc))(piVar6,pKVar8,uVar13,uVar9);
              if (pKVar8 != (KeyValues *)0x0) {
                KeyValues::deleteThis();
              }
              if (pKVar5 == (KeyValues *)0x0) {
                return;
              }
              KeyValues::deleteThis();
              return;
            }
          }
          if (pKVar5 != (KeyValues *)0x0) {
            KeyValues::deleteThis();
            return;
          }
        }
      }
    }
    else {
      iVar4 = _V_stricmp("OnMatchSessionUpdate",pcVar3);
      if (iVar4 == 0) {
        pcVar3 = (char *)KeyValues::GetString(param_1,"state","");
        iVar4 = _V_stricmp(pcVar3,"updated");
        if (iVar4 == 0) {
          param_1 = (KeyValues *)KeyValues::FindKey(param_1,"Update",false);
          if (param_1 == (KeyValues *)0x0) {
            return;
          }
          this = (CMatchTitle *)GetCurrentMatchSessionSettings();
        }
        else {
          pcVar3 = (char *)KeyValues::GetString(param_1,"state","");
          iVar4 = _V_stricmp(pcVar3,"created");
          if (iVar4 != 0) {
            pcVar3 = (char *)KeyValues::GetString(param_1,"state","");
            iVar4 = _V_stricmp(pcVar3,"ready");
            if (iVar4 != 0) {
              pcVar3 = (char *)KeyValues::GetString(param_1,"state","");
              iVar4 = _V_stricmp(pcVar3,"closed");
              if (iVar4 != 0) {
                return;
              }
              param_1 = (KeyValues *)0x0;
              this = (CMatchTitle *)0x0;
              goto LAB_000387d7;
            }
          }
          this = (CMatchTitle *)GetCurrentMatchSessionSettings();
          param_1 = (KeyValues *)0x0;
        }
LAB_000387d7:
        MM_Title_RichPresence_Update((KeyValues *)this,param_1);
        return;
      }
    }
  }
  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)