L L4D2node

CMaster::CheckHeartbeat

0x002032b0 · 385 bytes · __thiscall

_ZN7CMaster14CheckHeartbeatEP11CBaseServer

Decompiled

undefined (2 params)

/* CMaster::CheckHeartbeat(CBaseServer*) */

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

{
  bool bVar1;
  char cVar2;
  float *pfVar3;
  int iVar4;
  uchar local_1d [13];
  
  if (*(int *)(sv_master_legacy_mode._28_4_ + 0x30) == 0) {
    cVar2 = IsUsingMasterLegacyMode();
    if (cVar2 == '\0') {
      return;
    }
  }
  if (this[0x18] == (CMaster)0x0) {
    cVar2 = (**(code **)(*(int *)param_1 + 0x58))(param_1);
    if (cVar2 != '\0') {
      cVar2 = (**(code **)(*(int *)param_1 + 0x68))(param_1);
      if (cVar2 != '\0') {
        cVar2 = CBaseServer::ShouldHideFromMasterServer(param_1);
        if (cVar2 == '\0') {
          (**(code **)(*(int *)this + 8))(this);
          local_1d[0] = 'q';
          if (0 < *(int *)(this + 0x10)) {
            iVar4 = 0;
            bVar1 = false;
            do {
              pfVar3 = (float *)GetHeartbeat(this,(CMasterserver *)
                                                  (*(int *)(this + 4) + iVar4 * 0x24),param_1);
              if ((pfVar3 != (float *)0x0) &&
                 ((double)*(int *)(this + 0x1c) <= net_time - (double)pfVar3[2])) {
                if ((*pfVar3 <= 0.0) ||
                   ((double)*(int *)(mm_heartbeat_timeout._28_4_ + 0x30) <=
                    net_time - (double)*pfVar3)) {
                  *pfVar3 = (float)net_time;
                  pfVar3[2] = (float)net_time;
                  if (!bVar1) {
                    Msg("Sending heartbeat to master server...\n");
                  }
                  NET_SendPacket((INetChannel *)0x0,*(int *)(param_1 + 8),
                                 (netadr_s *)(iVar4 * 0x24 + *(int *)(this + 4)),local_1d,1,
                                 (bf_write *)0x0,false,0);
                  bVar1 = true;
                }
              }
              iVar4 = iVar4 + 1;
            } while (iVar4 < *(int *)(this + 0x10));
          }
        }
      }
    }
  }
  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)