L L4D2node

CMaster::RebuildInfo

0x002034e0 · 884 bytes · __thiscall

_ZN7CMaster11RebuildInfoEP11CBaseServer

Decompiled

undefined (2 params)

/* CMaster::RebuildInfo(CBaseServer*) */

void __thiscall CMaster::RebuildInfo(CMaster *this,CBaseServer *param_1)

{
  int *piVar1;
  char cVar2;
  char *pcVar3;
  int iVar4;
  undefined4 uVar5;
  char *pcVar6;
  uint uVar7;
  bf_write *this_00;
  byte bVar8;
  int in_GS_OFFSET;
  uint local_158;
  uint local_154;
  uint local_150;
  char local_14c [40];
  char local_124 [260];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  *(undefined4 *)(this + 0x28) = realtime;
  this_00 = (bf_write *)(this + 0x4dc);
  bf_write::Reset(this_00);
  bf_write::Reset(this_00);
  bf_write::WriteLong(this_00,-1);
  bf_write::WriteByte(this_00,0x49);
  bf_write::WriteByte(this_00,7);
  pcVar3 = (char *)(**(code **)(*(int *)param_1 + 0x38))(param_1);
  bf_write::WriteString(this_00,pcVar3);
  pcVar3 = (char *)(**(code **)(*(int *)param_1 + 0x3c))(param_1);
  bf_write::WriteString(this_00,pcVar3);
  V_FileBase(com_gamedir,local_124,0x104);
  bf_write::WriteString(this_00,local_124);
  pcVar3 = (char *)(**(code **)(*serverGameDLL + 0x2c))(serverGameDLL);
  bf_write::WriteString(this_00,pcVar3);
  iVar4 = GetSteamAppID();
  bf_write::WriteShort(this_00,iVar4);
  CBaseServer::GetMasterServerPlayerCounts
            ((CBaseServer *)&sv,(int *)&local_158,(int *)&local_154,(int *)&local_150);
  bf_write::WriteByte(this_00,local_158);
  bf_write::WriteByte(this_00,local_154);
  bf_write::WriteByte(this_00,local_150);
  cVar2 = (**(code **)(*(int *)param_1 + 0x70))(param_1);
  if (cVar2 == '\0') {
    cVar2 = (**(code **)(*(int *)param_1 + 0x60))(param_1);
    if (cVar2 == '\0') {
      bf_write::WriteByte(this_00,0x6c);
    }
    else {
      bf_write::WriteByte(this_00,100);
    }
  }
  else {
    bf_write::WriteByte(this_00,0x70);
  }
  bf_write::WriteByte(this_00,0x6c);
  iVar4 = (**(code **)(*(int *)param_1 + 0x74))(param_1);
  bf_write::WriteByte(this_00,(uint)(iVar4 != 0));
  iVar4 = Steam3Server();
  piVar1 = *(int **)(iVar4 + 4);
  if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)(*piVar1 + 0x24))(piVar1), cVar2 != '\0')) {
    cVar2 = (**(code **)(*(int *)param_1 + 0x70))(param_1);
    uVar7 = 1;
    if (cVar2 == '\0') goto LAB_00203696;
  }
  uVar7 = 0;
LAB_00203696:
  bf_write::WriteByte(this_00,uVar7);
  uVar5 = GetHostVersionString();
  V_snprintf(local_14c,0x28,"%s",uVar5);
  bVar8 = 0x80;
  bf_write::WriteString(this_00,local_14c);
  if (DAT_003b7f64 < 1) {
    bVar8 = 0;
  }
  if (hltv != (int *)0x0) {
    cVar2 = (**(code **)(hltv[1] + 0x58))(hltv + 1);
    if (cVar2 != '\0') {
      bVar8 = bVar8 | 0x40;
    }
  }
  pcVar3 = (char *)CBaseServer::GetGameType((CBaseServer *)&sv);
  if (pcVar3 != (char *)0x0) {
    iVar4 = _V_strlen(pcVar3);
    if (0 < iVar4) {
      bVar8 = bVar8 | 0x20;
    }
  }
  bf_write::WriteByte(this_00,(uint)bVar8);
  if ((char)bVar8 < '\0') {
    uVar7 = NET_GetUDPPort(1);
    bf_write::WriteShort(this_00,uVar7 & 0xffff);
  }
  if ((bVar8 & 0x40) != 0) {
    uVar7 = NET_GetUDPPort(2);
    bf_write::WriteShort(this_00,uVar7 & 0xffff);
    if (hltv == (int *)0x0) {
      pcVar6 = (char *)(**(code **)(*(int *)param_1 + 0x38))(param_1);
      bf_write::WriteString(this_00,pcVar6);
    }
    else {
      pcVar6 = (char *)(**(code **)(*hltv + 0x30))(hltv);
      bf_write::WriteString(this_00,pcVar6);
    }
  }
  if ((bVar8 & 0x20) != 0) {
    bf_write::WriteString(this_00,pcVar3);
  }
  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)