L L4D2node

CHLTVServer::StartMaster

0x00172dd0 · 1083 bytes · __thiscall

_ZN11CHLTVServer11StartMasterEP11CGameClient

Decompiled

undefined (2 params)

/* CHLTVServer::StartMaster(CGameClient*) */

void __thiscall CHLTVServer::StartMaster(CHLTVServer *this,CGameClient *param_1)

{
  byte bVar1;
  double dVar2;
  int iVar3;
  undefined4 uVar4;
  char *pcVar5;
  int *piVar6;
  CGameEventDescriptor *pCVar7;
  bool bVar8;
  longdouble lVar9;
  
  (**(code **)(*(int *)this + 0x18))(this);
  if (param_1 == (CGameClient *)0x0) {
    this = (CHLTVServer *)s_SourceTV_client_not_found__002b1849;
  }
  else {
    bVar8 = serverGameDirector != 0;
    *(int *)(this + 0x51b8) = serverGameDirector;
    if (bVar8) {
      *(CGameClient **)(this + 0x210) = param_1;
      piVar6 = serverGameClients;
      param_1[0xbc] = (CGameClient)0x1;
      iVar3 = (**(code **)(*piVar6 + 0x2c))
                        (piVar6,*(undefined4 *)
                                 ((int)&__DT_REL[0x14c5].r_offset + *(int *)(this + 0x210)));
      *(undefined1 *)(iVar3 + 0x28) = 1;
      uVar4 = (**(code **)(**(int **)(this + 0x210) + 0x24))(*(int **)(this + 0x210));
      bVar1 = tv_name[0x15] & 0x10;
      *(undefined4 *)(this + 0x51b4) = uVar4;
      pcVar5 = "FCVAR_NEVER_AS_STRING";
      if (bVar1 == 0) {
        pcVar5 = "";
        if (*(char **)(tv_name._28_4_ + 0x24) != (char *)0x0) {
          pcVar5 = *(char **)(tv_name._28_4_ + 0x24);
        }
      }
      KeyValues::SetString(*(KeyValues **)(*(int *)(this + 0x210) + 0xb0),"name",pcVar5);
      KeyValues::SetString(*(KeyValues **)(*(int *)(this + 0x210) + 0xb0),"cl_team","1");
      KeyValues::SetString(*(KeyValues **)(*(int *)(this + 0x210) + 0xb0),"rate","30000");
      KeyValues::SetString(*(KeyValues **)(*(int *)(this + 0x210) + 0xb0),"cl_updaterate","22");
      KeyValues::SetString(*(KeyValues **)(*(int *)(this + 0x210) + 0xb0),"cl_interp_ratio","1.0");
      KeyValues::SetString(*(KeyValues **)(*(int *)(this + 0x210) + 0xb0),"cl_predict","0");
      iVar3 = (**(code **)(**(int **)(this + 0x210) + 0x10))(*(int **)(this + 0x210));
      *(int *)(this + 0x51c8) = iVar3 + 1;
      uVar4 = (**(code **)(**(int **)(this + 0x210) + 0x10))(*(int **)(this + 0x210));
      *(undefined4 *)(this + 0x51cc) = uVar4;
      uVar4 = (**(code **)(**(int **)(this + 0x51b4) + 0x18))(*(int **)(this + 0x51b4));
      *(undefined4 *)(this + 0x5388) = uVar4;
      piVar6 = *(int **)(this + 0x51b4);
      *(int *)(this + 0xfc) = piVar6[0x3e];
      *(int *)(this + 0x100) = piVar6[0x3f];
      *(int *)(this + 0xb4) = piVar6[0x2c];
      *(int *)(this + 0xb8) = piVar6[0x2d];
      lVar9 = (longdouble)(**(code **)(*piVar6 + 0x30))(piVar6);
      *(float *)(this + 0x110) = (float)lVar9;
      CHLTVFrame::AllocBuffers((CHLTVFrame *)(this + 0x51d0));
      InstallStringTables(this);
      (**(code **)(**(int **)(this + 0x51b8) + 0xc))(*(int **)(this + 0x51b8),this + 0x204);
      piVar6 = (int *)(**(code **)(**(int **)(this + 0x51b8) + 0x24))(*(int **)(this + 0x51b8));
      pcVar5 = (char *)*piVar6;
      while (pcVar5 != (char *)0x0) {
        while( true ) {
          piVar6 = piVar6 + 1;
          pCVar7 = (CGameEventDescriptor *)
                   CGameEventManager::GetEventDescriptor
                             ((CGameEventManager *)&s_GameEventManager,pcVar5,(int *)0x0);
          if (pCVar7 != (CGameEventDescriptor *)0x0) break;
          DevMsg("CHLTVServer::StartMaster: game event %s not found.\n",pcVar5);
          pcVar5 = (char *)*piVar6;
          if (pcVar5 == (char *)0x0) goto LAB_00173070;
        }
        CGameEventManager::AddListener((CGameEventManager *)&s_GameEventManager,this,pCVar7,2);
        pcVar5 = (char *)*piVar6;
      }
LAB_00173070:
      iVar3 = *(int *)(this + 0x51b4);
      bf_write::StartWriting
                ((bf_write *)(this + 0xd8),*(void **)(iVar3 + 0xd4),*(int *)(iVar3 + 0xd8),
                 *(int *)(iVar3 + 0xe0),-1);
      V_strncpy((char *)(this + 0x14),(char *)(*(int *)(this + 0x51b4) + 0x10),0x40);
      V_strncpy((char *)(this + 0x54),(char *)(*(int *)(this + 0x51b4) + 0x50),0x40);
      NET_ListenSocket(*(int *)(this + 0xc),true);
      (**(code **)(**(int **)(this + 0x210) + 0x60))(*(int **)(this + 0x210),"spectate");
      (**(code **)(**(int **)(this + 0x210) + 0xd8))(*(int **)(this + 0x210));
      *(int *)(*(int *)(this + 0x210) + 0xf8) = *(int *)(*(int *)(this + 0x210) + 0xf8) + -1;
      if (this[0x63a0] != (CHLTVServer)0x0) {
        ConVar::SetValue(0x3a0ea0);
      }
      (**(code **)(*(int *)this + 0xb0))(this,*(undefined4 *)(tv_maxclients._28_4_ + 0x30));
      dVar2 = net_time;
      this[0x537c] = (CHLTVServer)0x0;
      *(int *)(this + 0x10c) = *(int *)(this + 0x10c) + 1;
      *(undefined4 *)(this + 8) = 2;
      *(float *)(this + 0x5380) = (float)dVar2;
      CHLTVDemoRecorder::StopRecording((CHLTVDemoRecorder *)(this + 0x4c04));
      if (*(int *)(tv_autorecord._28_4_ + 0x30) != 0) {
        CHLTVDemoRecorder::StartAutoRecording((CHLTVDemoRecorder *)(this + 0x4c04));
      }
      CBaseServer::ReconnectClients((CBaseServer *)(this + 4));
      return;
    }
    this = (CHLTVServer *)s_Mod_doesn_t_support_SourceTV__No_002b1f88;
  }
  ConMsg((char *)this);
  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)