L L4D2node

status

0x0017d400 · 1279 bytes · __cdecl

_ZL6statusRK8CCommand

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* status(CCommand const&) */

void status(CCommand *param_1)

{
  int iVar1;
  bool bVar2;
  char cVar3;
  undefined1 uVar4;
  int iVar5;
  undefined4 uVar6;
  uint uVar7;
  char *pcVar8;
  undefined *puVar9;
  code *pcVar10;
  int *piVar11;
  char *pcVar12;
  char *pcVar13;
  char *pcVar14;
  IClient *pIVar15;
  int in_GS_OFFSET;
  undefined8 uVar16;
  undefined1 *puVar17;
  ulonglong uVar18;
  char *local_38;
  int local_34;
  uint local_30;
  netadr_s local_2c [12];
  int local_20;
  
  pcVar10 = Host_Client_Printf;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if ((cmd_source == 1) && (pcVar10 = ConMsg, DAT_003b7f64 < 2)) {
    Cmd_ForwardToServer(param_1,true);
    goto LAB_0017d6f7;
  }
  uVar4 = 0xea;
  if ((host_name[0x15] & 0x10) == 0) {
    puVar17 = &DAT_002c79d4;
    if (*(undefined1 **)(host_name._28_4_ + 0x24) != (undefined1 *)0x0) {
      puVar17 = *(undefined1 **)(host_name._28_4_ + 0x24);
    }
    uVar4 = SUB41(puVar17,0);
  }
  (*pcVar10)("hostname: %s\n",uVar4);
  iVar5 = Steam3Server();
  piVar11 = *(int **)(iVar5 + 4);
  if ((piVar11 == (int *)0x0) || (cVar3 = (**(code **)(*piVar11 + 0x24))(piVar11), cVar3 == '\0')) {
    iVar5 = Steam3Server();
    bVar2 = false;
    if (*(int *)(iVar5 + 0x98) != 3) goto LAB_0017d470;
    iVar5 = Steam3Server();
    piVar11 = *(int **)(iVar5 + 4);
    if ((piVar11 == (int *)0x0) || (cVar3 = (**(code **)(*piVar11 + 0x20))(piVar11), cVar3 == '\0'))
    {
      bVar2 = false;
      pcVar14 = "(secure mode enabled, disconnected from Steam3)";
    }
    else {
      bVar2 = false;
      pcVar14 = "(secure mode enabled, connected to Steam3)";
    }
  }
  else {
    bVar2 = true;
LAB_0017d470:
    pcVar14 = "";
  }
  iVar5 = GetSteamUniverse();
  pcVar8 = "(unknown)";
  if (iVar5 - 1U < 4) {
    pcVar8 = *(char **)(CSWTCH_951 + (iVar5 - 1U) * 4);
  }
  pcVar12 = "secure";
  if (!bVar2) {
    pcVar12 = "insecure";
  }
  uVar6 = build_number();
  uVar16 = CONCAT44(pcVar12,uVar6);
  (*pcVar10)("version : %s %d %s %s %s\n",0x80);
  cVar3 = NET_IsMultiplayer();
  if (cVar3 != '\0') {
    pcVar12 = "Dedicated";
    if (DAT_003b8088 == '\0') {
      pcVar12 = "Listen";
    }
    netadr_s::SetIP(local_2c,0);
    netadr_s::SetPort(local_2c,0);
    netadr_s::SetType(local_2c,3,uVar16,pcVar14,pcVar8);
    puVar9 = (undefined *)((ulonglong)uVar16 >> 0x20);
    cVar3 = NET_GetPublicAdr(local_2c);
    NET_GetUDPPort(DAT_003b7f68);
    if (cVar3 == '\0') {
      uVar4 = netadr_s::ToString((netadr_s *)&net_local_adr,true);
      (*pcVar10)("udp/ip  : %s:%i [ public n/a ]\n",uVar4);
    }
    else {
      cVar3 = netadr_s::CompareAdr(local_2c,(netadr_s *)&net_local_adr,true);
      puVar9 = &DAT_002b457a;
      if (cVar3 == '\0') {
        puVar9 = (undefined *)netadr_s::ToString(local_2c,false);
      }
      uVar4 = netadr_s::ToString((netadr_s *)&net_local_adr,true);
      (*pcVar10)("udp/ip  : %s:%i [ public %s ]\n",uVar4);
    }
    uVar16 = CONCAT44(puVar9,pcVar12);
    (*pcVar10)("os      : %s %s\n",0x4e);
  }
  puVar17 = &DAT_003b7f70;
  (*pcVar10)("map     : %s\n",0x70);
  if ((hltv != (int *)0x0) &&
     (cVar3 = (**(code **)(hltv[1] + 0x58))(hltv + 1,puVar17,uVar16), cVar3 != '\0')) {
    piVar11 = (int *)(**(code **)(*hltv + 0x40))(hltv);
    (**(code **)(*piVar11 + 0x20))(piVar11);
    uVar4 = (**(code **)(hltv[1] + 0x24))(hltv + 1);
    (*pcVar10)("sourcetv:  port %i, delay %.1fs\n",uVar4);
  }
  pcVar14 = "unreserved";
  CBaseServer::GetMasterServerPlayerCounts
            ((CBaseServer *)&sv,(int *)&local_38,&local_34,(int *)&local_30);
  if (DAT_003b80d0 != 0 || _DAT_003b80cc != 0) {
    uVar16 = CBaseServer::GetReservationCookie((CBaseServer *)&sv);
    pcVar14 = (char *)va("reserved %llx",(int)uVar16,(int)((ulonglong)uVar16 >> 0x20));
  }
  cVar3 = CGameServer::IsHibernating((CGameServer *)&sv);
  pcVar8 = "hibernating";
  if (cVar3 == '\0') {
    pcVar8 = "not hibernating";
  }
  uVar18 = (ulonglong)local_30;
  (*pcVar10)("players : %i humans, %i bots (%i max) (%s) (%s)\n\n",(char)local_38);
  pcVar12 = local_38;
  if (*(int *)param_1 == 2) {
    pcVar12 = "short";
    iVar5 = _V_stricmp(*(char **)(param_1 + 0x40c),"short");
    if (iVar5 == 0) {
      if (0 < DAT_003b8080) {
        iVar5 = 0;
        pcVar13 = (char *)0x1;
        do {
          piVar11 = (int *)(*(int *)(DAT_003b8074 + iVar5) + 4);
          if (*(int *)(DAT_003b8074 + iVar5) == 0) {
            piVar11 = (int *)0x0;
          }
          cVar3 = (**(code **)(*piVar11 + 0x88))(piVar11,pcVar12,uVar18,pcVar8,pcVar14);
          if (cVar3 != '\0') {
            uVar7 = (**(code **)(*piVar11 + 0x48))(piVar11);
            uVar18 = (ulonglong)uVar7;
            pcVar12 = pcVar13;
            (*pcVar10)("#%i - %s\n",(char)pcVar13);
          }
          iVar5 = iVar5 + 4;
          bVar2 = (int)pcVar13 < DAT_003b8080;
          pcVar13 = pcVar13 + 1;
        } while (bVar2);
      }
      goto LAB_0017d6f7;
    }
  }
  (*pcVar10)("# userid name uniqueid connected ping loss state rate",(char)pcVar12);
  if (cmd_source == 1) {
    (*pcVar10)(" adr",(char)pcVar12);
  }
  iVar5 = 0;
  (*pcVar10)("\n",(char)pcVar12);
  uVar4 = SUB41(pcVar12,0);
  if (0 < DAT_003b8080) {
    do {
      while( true ) {
        iVar1 = *(int *)(DAT_003b8074 + iVar5 * 4);
        pIVar15 = (IClient *)(iVar1 + 4);
        if (iVar1 == 0) {
          pIVar15 = (IClient *)0x0;
        }
        cVar3 = (**(code **)(*(int *)pIVar15 + 0x80))(pIVar15);
        uVar4 = SUB41(pcVar12,0);
        if (cVar3 == '\0') break;
        pcVar12 = (char *)(uint)(cmd_source == 1);
        iVar5 = iVar5 + 1;
        Host_Status_PrintClient(pIVar15,cmd_source == 1,pcVar10);
        uVar4 = SUB41(pcVar12,0);
        if (DAT_003b8080 <= iVar5) goto LAB_0017d6ee;
      }
      iVar5 = iVar5 + 1;
    } while (iVar5 < DAT_003b8080);
  }
LAB_0017d6ee:
  (*pcVar10)("#end\n",uVar4);
LAB_0017d6f7:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)