L L4D2node

CBaseClientState::ProcessServerInfo

0x00101fe0 · 1778 bytes · __thiscall

_ZN16CBaseClientState17ProcessServerInfoEP14SVC_ServerInfo

Decompiled

undefined (2 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CBaseClientState::ProcessServerInfo(SVC_ServerInfo*) */

undefined4 __thiscall
CBaseClientState::ProcessServerInfo(CBaseClientState *this,SVC_ServerInfo *param_1)

{
  uint uVar1;
  code *pcVar2;
  char cVar3;
  int iVar4;
  undefined4 uVar5;
  int iVar6;
  int *piVar7;
  netadr_s *pnVar8;
  int in_GS_OFFSET;
  double dVar9;
  char *pcVar10;
  undefined4 local_144;
  undefined4 local_140;
  undefined4 *local_138 [2];
  undefined4 local_130;
  undefined4 local_12c;
  int *local_128;
  char local_124 [260];
  int local_20;
  
  local_144 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_140 = 0;
  if (_exit == (int *)0x0) {
    local_128 = (int *)0x0;
  }
  else {
    (*(code *)_exit[0x14])
              (_exit,&local_144,0,0,0,0,"/data/src/engine/./baseclientstate.cpp",0x647,
               &ProcessServerInfo(SVC_ServerInfo*)::tm_fmt,"(%s)%s","Unaccounted",
               "ProcessServerInfo");
    local_128 = _exit;
  }
  iVar6 = _DAT_0040b9d4;
  local_130 = local_144;
  local_12c = local_140;
  if ((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) {
                    /* try { // try from 001021c6 to 00102214 has its CatchHandler @ 00102701 */
    iVar4 = ThreadGetCurrentId();
    if (iVar6 == iVar4) {
      if ((char *)*_DAT_0040b030 != "ProcessServerInfo") {
        _DAT_0040b030 =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2a6e6e,&DAT_00000001,0x2a054b);
      }
      CVProfNode::EnterScope();
      DAT_0040b02c = '\0';
    }
  }
                    /* try { // try from 001020c4 to 00102107 has its CatchHandler @ 00102719 */
  COM_TimestampedLog(" CBaseClient::ProcessServerInfo");
  cVar3 = IsNetworkVersionCompatible(*(int *)(param_1 + 0x4c));
  if (cVar3 == '\0') {
    iVar6 = *(int *)(param_1 + 0x4c);
  }
  else {
                    /* try { // try from 00102228 to 001026f6 has its CatchHandler @ 00102719 */
    iVar6 = GetNetworkVersion();
    *(int *)(param_1 + 0x4c) = iVar6;
  }
  iVar4 = GetNetworkVersion();
  if (iVar4 == iVar6) {
    *(undefined4 *)(this + 0x6c) = *(undefined4 *)(param_1 + 0x50);
    *(undefined4 *)(this + 0x14c) = *(undefined4 *)(param_1 + 100);
    uVar1 = *(uint *)(param_1 + 0x68);
    *(uint *)(this + 0x41c8) = uVar1;
    iVar6 = Q_log2(uVar1);
    *(int *)(this + 0x41cc) = iVar6 + 1;
    if (*(int *)(this + 0x14c) - 1U < 0x20) {
      if (*(int *)(this + 0x41c8) - 1U < 0x200) {
        FreeEntityBaselines(this);
        CGameEventManager::HasClientListenersChanged((CGameEventManager *)&s_GameEventManager,true);
        *(undefined4 *)(this + 0xcc) = *(undefined4 *)(param_1 + 0x6c);
        *(int *)(this + 200) = *(int *)(param_1 + 0x6c) + 1;
        dVar9 = (double)*(float *)(param_1 + 0x70);
        if ((dVar9 < 0.001) || (0.1 < dVar9)) {
          pcVar10 = "Interval_per_tick %f out of range [%f to %f]\n";
          ConMsg("Interval_per_tick %f out of range [%f to %f]\n",dVar9,0x3f50624dd2f1a9fc,
                 0x3fb999999999999a);
        }
        else {
          pcVar10 = *(char **)(param_1 + 0x74);
          uVar5 = COM_CheckGameDirectory(pcVar10);
          if ((char)uVar5 != '\0') {
            V_snprintf((char *)(this + 0xd4),0x28,"maps/%s%s.bsp",*(undefined4 *)(param_1 + 0x78),
                       &DAT_002c79d4);
            V_strncpy((char *)(this + 0xfc),*(char **)(param_1 + 0x78),0x28);
            ConVarRef::ConVarRef((ConVarRef *)local_138,"sv_skyname");
            cVar3 = ConVarRef::IsValid((ConVarRef *)local_138);
            if (cVar3 != '\0') {
              (**(code **)*local_138[0])(local_138[0],*(undefined4 *)(param_1 + 0x7c));
            }
            *(undefined4 *)(this + 0xc0) = 0xffffffff;
            piVar7 = (int *)(**(code **)(s_GameEventManager + 0x1c))
                                      (&s_GameEventManager,"server_spawn",0,0);
            if (piVar7 != (int *)0x0) {
              (**(code **)(*piVar7 + 0x3c))(piVar7,"hostname");
              pcVar2 = *(code **)(*piVar7 + 0x3c);
              pnVar8 = (netadr_s *)
                       (**(code **)(**(int **)(this + 0x10) + 200))(*(int **)(this + 0x10));
              netadr_s::ToString(pnVar8,true);
              (*pcVar2)(piVar7,"address");
              pcVar2 = *(code **)(*piVar7 + 0x30);
              pnVar8 = (netadr_s *)
                       (**(code **)(**(int **)(this + 0x10) + 200))(*(int **)(this + 0x10));
              netadr_s::GetPort(pnVar8);
              (*pcVar2)(piVar7,"port");
              (**(code **)(*piVar7 + 0x3c))(piVar7,"game");
              (**(code **)(*piVar7 + 0x3c))(piVar7,"mapname");
              (**(code **)(*piVar7 + 0x30))(piVar7,"maxplayers");
              (**(code **)(*piVar7 + 0x30))(piVar7,"password");
              pcVar2 = *(code **)(*piVar7 + 0x3c);
              iVar6 = toupper((int)(char)param_1[0x57]);
              va("%c",iVar6);
              (*pcVar2)(piVar7,&DAT_002cd203);
              (**(code **)(*piVar7 + 0x2c))(piVar7,"dedicated");
              (**(code **)(*piVar7 + 0x2c))(piVar7,"vanilla");
              (**(code **)(*piVar7 + 0x3c))(piVar7,"mission");
              (**(code **)(*piVar7 + 0x3c))(piVar7,"gamemode");
              (**(code **)(s_GameEventManager + 0x24))(&s_GameEventManager,piVar7);
            }
            iVar6 = DAT_003b7f64;
            this[0x49da] = (CBaseClientState)0x1;
            if (iVar6 < 2) {
              SV_CheckForFlushMemory((char *)(this + 0x124),(char *)(this + 0xfc));
              SV_FlushMemoryIfMarked();
              V_snprintf(local_124,0x104,"maps/%s.bsp",*(undefined4 *)(param_1 + 0x78));
              (**(code **)(*(int *)modelloader + 0x1c))(modelloader,local_124);
              cVar3 = (*(code *)**(undefined4 **)g_pStringTableDictionary)
                                (g_pStringTableDictionary,*(undefined4 *)(param_1 + 0x78));
              if (cVar3 == '\0') {
                COM_ExplainDisconnection
                          (true,
                           "Map does not match the version on the server.\n(String table differs)\n"
                          );
                pcVar10 = "Disconnected";
                Host_Error("Disconnected");
                goto LAB_00102108;
              }
            }
            pcVar10 = "CBaseClient::ProcessServerInfo(done)";
            COM_TimestampedLog("CBaseClient::ProcessServerInfo(done)");
            goto LAB_0010210a;
          }
        }
      }
      else {
        pcVar10 = "Bad maxclasses (%u) from server.\n";
        ConMsg("Bad maxclasses (%u) from server.\n",*(int *)(this + 0x41c8));
      }
    }
    else {
      pcVar10 = "Bad maxclients (%u) from server.\n";
      ConMsg("Bad maxclients (%u) from server.\n",*(int *)(this + 0x14c));
    }
  }
  else {
    uVar5 = GetNetworkVersion();
    pcVar10 = "Server returned version %i, expected %i.\n";
    ConMsg("Server returned version %i, expected %i.\n",*(undefined4 *)(param_1 + 0x4c),uVar5);
  }
LAB_00102108:
  uVar5 = 0;
LAB_0010210a:
  iVar6 = _DAT_0040b9d4;
  if ((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) {
    iVar4 = ThreadGetCurrentId();
    if (iVar6 == iVar4) {
      pcVar10 = (char *)_DAT_0040b030;
      cVar3 = CVProfNode::ExitScope();
      if (cVar3 != '\0') {
        _DAT_0040b030 = (int *)_DAT_0040b030[0x19];
      }
      DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
    }
  }
  if (local_128 != (int *)0x0) {
    pcVar10 = (char *)local_128;
    (*(code *)local_128[0x15])(local_128,local_130,local_12c,0,0,0);
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar5;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail(pcVar10);
}

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)