L L4D2node

CMatchTitle::FireGameEvent

0x00037e80 · 1259 bytes · __thiscall

_ZN11CMatchTitle13FireGameEventEP10IGameEvent

Decompiled

undefined (2 params)

/* CMatchTitle::FireGameEvent(IGameEvent*) */

void __thiscall CMatchTitle::FireGameEvent(CMatchTitle *this,IGameEvent *param_1)

{
  int *piVar1;
  KeyValues *pKVar2;
  char *pcVar3;
  char *pcVar4;
  KeyValues *pKVar5;
  int iVar6;
  undefined4 uVar7;
  code *pcVar8;
  char *pcVar9;
  undefined *puVar10;
  KeyValues *local_20 [4];
  
  piVar1 = (int *)(**(code **)(*g_pMatchFramework + 0x24))(g_pMatchFramework);
  if (piVar1 != (int *)0x0) {
    pKVar2 = (KeyValues *)(**(code **)(*piVar1 + 4))(piVar1);
    pcVar3 = (char *)KeyValues::GetString(pKVar2,"Server/server","");
    pcVar4 = (char *)KeyValues::GetString(pKVar2,"System/lock","");
    if (((pcVar3 != (char *)0x0) && (*pcVar3 != '\0')) ||
       ((pcVar4 != (char *)0x0 && (*pcVar4 != '\0')))) {
      pcVar3 = (char *)KeyValues::GetString(pKVar2,"Game/mode","coop");
      pKVar5 = (KeyValues *)(**(code **)(*(int *)g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,pcVar3);
      pcVar3 = (char *)KeyValues::GetString(pKVar5,"base",pcVar3);
      pKVar5 = (KeyValues *)(**(code **)*piVar1)(piVar1);
      pcVar4 = (char *)KeyValues::GetString(pKVar5,"type",(char *)0x0);
      if ((((pcVar4 == (char *)0x0) || (iVar6 = _V_stricmp(pcVar4,"client"), iVar6 != 0)) &&
          (pcVar4 = (char *)(**(code **)(*(int *)param_1 + 8))(param_1), pcVar4 != (char *)0x0)) &&
         (*pcVar4 != '\0')) {
        iVar6 = _V_stricmp("round_start",pcVar4);
        if (iVar6 == 0) {
          pcVar8 = *(code **)(*piVar1 + 8);
          iVar6 = KeyValues::FromString
                            ("Update"," Update {  Game {  state game  }  } ",(char **)0x0);
                    /* try { // try from 00037fe4 to 00037fe5 has its CatchHandler @ 000383c7 */
          (*pcVar8)(piVar1,iVar6);
          if (iVar6 != 0) {
            KeyValues::deleteThis();
          }
        }
        else {
          pcVar9 = pcVar4;
          iVar6 = _V_stricmp("round_end",pcVar4);
          if (iVar6 == 0) {
            piVar1 = (int *)(**(code **)(*g_pMatchFramework + 0x1c))(g_pMatchFramework);
            pcVar8 = *(code **)(*piVar1 + 8);
            pKVar2 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pcVar9);
                    /* try { // try from 0003804f to 00038053 has its CatchHandler @ 000383b5 */
            KeyValues::KeyValues(pKVar2,"OnProfilesWriteOpportunity","reason","checkpoint");
          }
          else {
            iVar6 = _V_stricmp("finale_start",pcVar4);
            if (iVar6 == 0) {
              iVar6 = _V_stricmp(pcVar3,"survival");
              if (iVar6 == 0) {
                return;
              }
              iVar6 = _V_stricmp(pcVar3,"scavenge");
              if (iVar6 == 0) {
                return;
              }
              pcVar8 = *(code **)(*piVar1 + 8);
              iVar6 = KeyValues::FromString
                                ("Update"," Update {  Game {  state finale  }  } ",(char **)0x0);
                    /* try { // try from 000380dc to 000380dd has its CatchHandler @ 000383d7 */
              (*pcVar8)(piVar1,iVar6);
              if (iVar6 == 0) {
                return;
              }
              KeyValues::deleteThis();
              return;
            }
            iVar6 = _V_stricmp("game_newmap",pcVar4);
            if (iVar6 == 0) {
              uVar7 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"mapname",&DAT_000b2b65);
              pKVar5 = (KeyValues *)
                       KeyValues::FromString
                                 ("Update"," Update {  Game {  state game  }  } ",(char **)0x0);
              local_20[0] = (KeyValues *)0x0;
                    /* try { // try from 00038175 to 0003820b has its CatchHandler @ 0003837d */
              pKVar2 = (KeyValues *)
                       (**(code **)(*(int *)g_pMatchExtL4D + 0xc))
                                 (g_pMatchExtL4D,pKVar2,uVar7,local_20);
              if ((pKVar2 != (KeyValues *)0x0) && (local_20[0] != (KeyValues *)0x0)) {
                pcVar3 = (char *)KeyValues::GetString(local_20[0],"Name","");
                KeyValues::SetString(pKVar5,"Update/Game/campaign",pcVar3);
                iVar6 = KeyValues::GetInt(pKVar2,"chapter",0);
                KeyValues::SetInt(pKVar5,"Update/Game/chapter",iVar6);
              }
              pKVar2 = pKVar5;
              (**(code **)(*piVar1 + 8))(piVar1);
              piVar1 = (int *)(**(code **)(*g_pMatchFramework + 0x1c))(g_pMatchFramework);
              pcVar8 = *(code **)(*piVar1 + 8);
              pKVar2 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pKVar2);
                    /* try { // try from 00038229 to 0003822d has its CatchHandler @ 000383e7 */
              KeyValues::KeyValues(pKVar2,"OnProfilesWriteOpportunity","reason","checkpoint");
                    /* try { // try from 00038238 to 00038239 has its CatchHandler @ 0003837d */
              (*pcVar8)(piVar1,pKVar2);
              if (pKVar5 == (KeyValues *)0x0) {
                return;
              }
              KeyValues::deleteThis();
              return;
            }
            iVar6 = _V_stricmp("difficulty_changed",pcVar4);
            if (iVar6 == 0) {
              pcVar3 = (char *)(**(code **)(*(int *)param_1 + 0x28))
                                         (param_1,"strDifficulty","normal");
              pKVar2 = (KeyValues *)
                       KeyValues::FromString
                                 ("Update"," Update {  Game {  difficulty =  }  } ",(char **)0x0);
                    /* try { // try from 000382b6 to 000382c6 has its CatchHandler @ 00038393 */
              KeyValues::SetString(pKVar2,"Update/Game/difficulty",pcVar3);
              (**(code **)(*piVar1 + 8))(piVar1,pKVar2);
              if (pKVar2 == (KeyValues *)0x0) {
                return;
              }
              KeyValues::deleteThis();
              return;
            }
            iVar6 = _V_stricmp("server_pre_shutdown",pcVar4);
            if (iVar6 != 0) {
              return;
            }
            pcVar3 = (char *)(**(code **)(*(int *)param_1 + 0x28))(param_1,"reason",&DAT_000b06f2);
            puVar10 = &DAT_000b06f2;
            iVar6 = _V_stricmp(pcVar3,"quit");
            if (iVar6 != 0) {
              return;
            }
            DevMsg("Received server_pre_shutdown notification - server is shutting down...\n");
            piVar1 = (int *)(**(code **)(*g_pMatchFramework + 0x1c))(g_pMatchFramework);
            pcVar8 = *(code **)(*piVar1 + 8);
            pKVar2 = KeyValues::operator_new((KeyValues *)0x2c,(uint)puVar10);
                    /* try { // try from 00038373 to 00038377 has its CatchHandler @ 000383a3 */
            KeyValues::KeyValues(pKVar2,"OnEngineDisconnectReason","reason","Server shutting down");
          }
          (*pcVar8)(piVar1,pKVar2);
        }
      }
    }
  }
  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)