L L4D2node

CMatchNetworkMsgControllerBase::GetActiveServerGameDetails

0x000595e0 · 754 bytes · __thiscall

_ZN30CMatchNetworkMsgControllerBase26GetActiveServerGameDetailsEP9KeyValues

Decompiled

undefined (2 params)

/* CMatchNetworkMsgControllerBase::GetActiveServerGameDetails(KeyValues*) */

KeyValues * __thiscall
CMatchNetworkMsgControllerBase::GetActiveServerGameDetails
          (CMatchNetworkMsgControllerBase *this,KeyValues *param_1)

{
  char cVar1;
  char *pcVar2;
  KeyValues *this_00;
  undefined4 *puVar3;
  int *piVar4;
  uint uVar5;
  int iVar6;
  undefined4 uVar7;
  int in_GS_OFFSET;
  netadr_s *pnVar8;
  netadr_s local_50 [12];
  netadr_s local_44 [14];
  char local_36;
  char local_35;
  char local_34;
  char local_33;
  char *local_30;
  uint local_28;
  uint local_24;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  netadr_s::SetIP(local_50,0);
  netadr_s::SetPort(local_50,0);
  netadr_s::SetType(local_50,3);
  netadr_s::SetIP(local_44,0);
  netadr_s::SetPort(local_44,0);
  netadr_s::SetType(local_44,3);
  pnVar8 = local_50;
  (**(code **)(**(int **)(g_pMatchExtensions + 0x54) + 0x18))(*(int **)(g_pMatchExtensions + 0x54));
  if (local_36 == '\0') {
    piVar4 = *(int **)(g_pMatchExtensions + 0x5c);
    if (((piVar4 != (int *)0x0) && (cVar1 = (**(code **)(*piVar4 + 0x168))(piVar4), cVar1 == '\0'))
       && ((pcVar2 = (char *)(**(code **)(*piVar4 + 0xd4))(piVar4), pcVar2 != (char *)0x0 &&
           (*pcVar2 != '\0')))) {
      this_00 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pnVar8);
                    /* try { // try from 000596de to 000596e2 has its CatchHandler @ 000598e2 */
      KeyValues::KeyValues(this_00,"GameDetailsClient",(IKeyValuesSystem *)0x0,false);
      goto LAB_000596e3;
    }
  }
  else {
    this_00 = (KeyValues *)
              KeyValues::FromString
                        ("GameDetailsServer",
                         " System {  network LIVE  access public  }  Server {  name =  server =  adronline =  adrlocal =  }  Members {  numSlots #int#0  numPlayers #int#0  } "
                         ,(char **)0x0);
    if ((local_35 == '\0') &&
       (iVar6 = (**(code **)(*g_pMatchFramework + 0x24))(g_pMatchFramework), iVar6 != 0)) {
      piVar4 = (int *)(**(code **)(*g_pMatchFramework + 0x24))(g_pMatchFramework);
      uVar7 = (**(code **)(*piVar4 + 4))(piVar4);
      KeyValues::MergeFrom(this_00,uVar7,3);
    }
    KeyValues::SetString(this_00,"Server/name",local_30);
    pcVar2 = "dedicated";
    if (local_35 == '\0') {
      pcVar2 = "listen";
    }
    KeyValues::SetString(this_00,"Server/server",pcVar2);
    pcVar2 = (char *)netadr_s::ToString(local_44,false);
    KeyValues::SetString(this_00,"Server/adronline",pcVar2);
    pcVar2 = (char *)netadr_s::ToString(local_50,false);
    KeyValues::SetString(this_00,"Server/adrlocal",pcVar2);
    if (((local_35 != '\0') && (local_34 != '\0')) && (local_33 != '\0')) {
      KeyValues::SetString(this_00,"System/access","friends");
    }
    piVar4 = (int *)(**(code **)(*(int *)g_pMMF + 0x20))(g_pMMF);
    uVar5 = (**(code **)(*piVar4 + 0x10))(piVar4);
    local_28 = ~((int)local_28 >> 0x1f | -(uint)(local_28 <= uVar5)) & uVar5 |
               -(uint)(local_28 <= uVar5) & local_28;
    KeyValues::SetInt(this_00,"Members/numSlots",local_28);
    local_24 = ~((int)local_24 >> 0x1f | -(uint)(local_24 <= local_28)) & local_28 |
               -(uint)(local_24 <= local_28) & local_24;
    KeyValues::SetInt(this_00,"Members/numPlayers",local_24);
LAB_000596e3:
    if (this_00 != (KeyValues *)0x0) {
      puVar3 = (undefined4 *)(**(code **)(*(int *)g_pMMF + 0x44))(g_pMMF);
      (**(code **)*puVar3)(puVar3,this_00,param_1);
      goto LAB_00059708;
    }
  }
  this_00 = (KeyValues *)0x0;
LAB_00059708:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return this_00;
}

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)