CSteam3Server::Activate
0x00211680 · 1196 bytes · __thiscall
_ZN13CSteam3Server8ActivateEv
Decompiled
undefined (1 param)
/* CSteam3Server::Activate() */
void __thiscall CSteam3Server::Activate(CSteam3Server *this)
{
code *pcVar1;
char cVar2;
undefined2 uVar3;
undefined2 uVar4;
int *piVar5;
int iVar6;
undefined4 uVar7;
undefined4 *puVar8;
uint uVar9;
char *pcVar10;
int in_GS_OFFSET;
longdouble lVar11;
undefined2 local_136;
ConVarRef local_12c [4];
int local_128;
netadr_s local_124 [260];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar6 = 1;
if (*(int *)(sv_lan._28_4_ + 0x30) == 0) {
iVar6 = GetCurrentServerMode();
}
if (*(int *)(this + 0x98) != iVar6) {
if ((*(int *)(this + 4) != 0) && (0 < *(int *)(this + 0x98))) {
Shutdown(this);
}
*(undefined4 *)(this + 0xb4) = 0;
*(undefined2 *)(this + 0xb8) = 0x6914;
piVar5 = (int *)CommandLine_Tier0();
iVar6 = (**(code **)(*piVar5 + 0x28))(piVar5,"-steamport");
if (iVar6 != 0) {
piVar5 = (int *)CommandLine_Tier0();
pcVar10 = (char *)(**(code **)(*piVar5 + 0x2c))(piVar5,iVar6 + 1);
lVar11 = (longdouble)EvaluateExpression(pcVar10,26900.0);
*(short *)(this + 0xb8) = (short)(int)lVar11;
}
ConVarRef::ConVarRef(local_12c,"ip");
cVar2 = ConVarRef::IsValid(local_12c);
if (cVar2 != '\0') {
netadr_s::SetIP(local_124,0);
netadr_s::SetPort(local_124,0);
netadr_s::SetType(local_124,3);
NET_StringToAdr(*(char **)(local_128 + 0x24),local_124);
cVar2 = netadr_s::IsLoopback(local_124);
if ((cVar2 == '\0') && (cVar2 = netadr_s::IsLocalhost(local_124), cVar2 == '\0')) {
uVar9 = netadr_s::GetIP(local_124);
*(uint *)(this + 0xb4) =
uVar9 >> 0x18 | (uVar9 & 0xff0000) >> 8 | (uVar9 & 0xff00) << 8 | uVar9 << 0x18;
}
}
uVar7 = 1;
if (*(int *)(sv_lan._28_4_ + 0x30) == 0) {
uVar7 = GetCurrentServerMode();
}
*(undefined4 *)(this + 0x98) = uVar7;
V_FileBase(com_gamedir,(char *)local_124,0x104);
if (((hltv == (CHLTVServer *)0x0) ||
(cVar2 = (**(code **)(*(int *)(hltv + 4) + 0x58))(hltv + 4), cVar2 == '\0')) ||
(cVar2 = CHLTVServer::IsTVRelay(hltv), cVar2 == '\0')) {
local_136 = NET_GetUDPPort(1);
}
else {
local_136 = 0;
}
if ((hltv == (CHLTVServer *)0x0) ||
(cVar2 = (**(code **)(*(int *)(hltv + 4) + 0x58))(hltv + 4), cVar2 == '\0')) {
uVar3 = 0;
}
else {
uVar3 = NET_GetUDPPort(2);
}
cVar2 = IsUsingMasterLegacyMode();
iVar6 = DAT_003b7f64;
if ((cVar2 == '\0') && (*(int *)(sv_master_share_game_socket._28_4_ + 0x30) == 0)) {
this[0x9c] = (CSteam3Server)0x0;
*(undefined2 *)(this + 0xba) = *(undefined2 *)(this + 0xb8);
}
else {
this[0x9c] = (CSteam3Server)0x1;
uVar4 = uVar3;
if (1 < iVar6) {
uVar4 = local_136;
}
*(undefined2 *)(this + 0xba) = uVar4;
}
uVar7 = Sys_GetVersionString();
cVar2 = SteamInternal_GameServer_Init
(*(undefined4 *)(this + 0xb4),*(short *)(this + 0xb8) + 1,local_136,uVar3,
*(undefined4 *)(this + 0x98),uVar7);
if (cVar2 == '\0') {
Warning("************************************************\n");
Warning("* Unable to load Steam support library. *\n");
Warning("* This server will operate in LAN mode only. *\n");
Warning("************************************************\n");
*(undefined4 *)(this + 0x98) = 1;
ConVar::SetValue(0x3b7d80);
}
else {
if (g_nDedicatedServerAppIdBreakpad != 0) {
SteamAPI_SetBreakpadAppID(g_nDedicatedServerAppIdBreakpad);
}
piVar5 = (int *)SteamInternal_ContextInit(SteamClient()::s_CallbackCounterAndContext);
iVar6 = *piVar5;
*(int *)this = iVar6;
if (iVar6 == 0) {
piVar5 = *(int **)(this + 4);
}
else {
puVar8 = (undefined4 *)
SteamInternal_ContextInit(SteamGameServer()::s_CallbackCounterAndContext);
*(undefined4 *)(this + 4) = *puVar8;
puVar8 = (undefined4 *)
SteamInternal_ContextInit(SteamGameServerUtils()::s_CallbackCounterAndContext);
*(undefined4 *)(this + 8) = *puVar8;
puVar8 = (undefined4 *)
SteamInternal_ContextInit(SteamGameServerNetworking()::s_CallbackCounterAndContext)
;
*(undefined4 *)(this + 0xc) = *puVar8;
puVar8 = (undefined4 *)
SteamInternal_ContextInit(SteamGameServerStats()::s_CallbackCounterAndContext);
*(undefined4 *)(this + 0x10) = *puVar8;
puVar8 = (undefined4 *)
SteamInternal_ContextInit(SteamGameServerHTTP()::s_CallbackCounterAndContext);
*(undefined4 *)(this + 0x14) = *puVar8;
puVar8 = (undefined4 *)
SteamInternal_ContextInit(SteamGameServerInventory()::s_CallbackCounterAndContext);
*(undefined4 *)(this + 0x18) = *puVar8;
puVar8 = (undefined4 *)
SteamInternal_ContextInit(SteamGameServerUGC()::s_CallbackCounterAndContext);
piVar5 = *(int **)(this + 4);
*(undefined4 *)(this + 0x1c) = *puVar8;
}
if (piVar5 != (int *)0x0) {
pcVar1 = *(code **)(*piVar5 + 4);
uVar7 = GetHostProductString();
(*pcVar1)(piVar5,uVar7);
pcVar1 = *(code **)(*piVar5 + 8);
uVar7 = (**(code **)(*serverGameDLL + 0x2c))(serverGameDLL);
(*pcVar1)(piVar5,uVar7);
(**(code **)(*piVar5 + 0x10))(piVar5,DAT_003b8088);
(**(code **)(*piVar5 + 0xc))(piVar5,local_124);
(**(code **)(*piVar5 + 0x18))(piVar5);
}
SendUpdatedServerDetails(this);
}
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.