CBaseServer::ReplyChallenge
0x00109930 · 1162 bytes · __thiscall
_ZN11CBaseServer14ReplyChallengeER8netadr_sR7bf_read.part.41
Decompiled
undefined (3 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CBaseServer::ReplyChallenge(netadr_s&, bf_read&) [clone .part.41] */
void __thiscall CBaseServer::ReplyChallenge(CBaseServer *this,netadr_s *param_1,bf_read *param_2)
{
int *piVar1;
char cVar2;
byte bVar3;
CBaseServer *in_EAX;
ulong uVar4;
long lVar5;
CSteam3Server *this_00;
undefined4 *puVar6;
uint uVar7;
undefined4 uVar8;
CBitRead *in_ECX;
int iVar9;
netadr_s *in_EDX;
char *pcVar10;
int in_GS_OFFSET;
undefined4 uVar11;
ulong local_360;
uint local_35c;
uchar *local_344 [3];
int local_338;
char local_329 [9];
undefined4 local_320;
undefined1 local_220 [512];
int local_20;
bVar3 = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
bf_write::bf_write((bf_write *)local_344,local_220,0x200,-1);
puVar6 = &local_320;
for (iVar9 = 0x40; iVar9 != 0; iVar9 = iVar9 + -1) {
*puVar6 = 0;
puVar6 = puVar6 + (uint)bVar3 * -2 + 1;
}
CBitRead::ReadString(in_ECX,(char *)&local_320,0x100,false,(int *)0x0);
uVar4 = (**(code **)(*(int *)in_EAX + 0xd8))();
iVar9 = (**(code **)(*(int *)in_EAX + 0xdc))();
bf_write::WriteLong((bf_write *)local_344,-1);
bf_write::WriteByte((bf_write *)local_344,0x41);
bf_write::WriteLong((bf_write *)local_344,uVar4);
bf_write::WriteLong((bf_write *)local_344,iVar9);
if (iVar9 == 3) {
this_00 = (CSteam3Server *)Steam3Server();
puVar6 = (undefined4 *)CSteam3Server::GetGSSteamID(this_00);
uVar8 = puVar6[1];
uVar11 = *puVar6;
bf_write::WriteShort((bf_write *)local_344,0);
bf_write::WriteLongLong(CONCAT44(uVar11,(bf_write *)local_344));
iVar9 = Steam3Server();
piVar1 = *(int **)(iVar9 + 4);
uVar7 = 0;
if (piVar1 != (int *)0x0) {
uVar7 = (**(code **)(*piVar1 + 0x24))(piVar1,uVar11,uVar8);
uVar7 = uVar7 & 0xff;
}
bf_write::WriteByte((bf_write *)local_344,uVar7);
}
else {
bf_write::WriteShort((bf_write *)local_344,1);
bf_write::WriteLongLong(ZEXT48((bf_write *)local_344));
bf_write::WriteByte((bf_write *)local_344,0);
}
iVar9 = _V_strlen("connect");
iVar9 = V_strnicmp((char *)&local_320,"connect",iVar9);
if (iVar9 != 0) {
bf_write::WriteString((bf_write *)local_344,(char *)&local_320);
goto LAB_00109b9c;
}
cVar2 = netadr_s::IsLoopback(in_EDX);
if (cVar2 == '\0') {
cVar2 = netadr_s::IsLocalhost(in_EDX);
if (cVar2 != '\0') goto LAB_00109ab9;
iVar9 = (**(code **)(*(int *)in_EAX + 0x74))();
if (iVar9 == 0) goto LAB_00109ac1;
bVar3 = IsExclusiveToLobbyConnections(in_EAX);
local_35c = bVar3 ^ 1;
}
else {
LAB_00109ab9:
(**(code **)(*(int *)in_EAX + 0x74))();
LAB_00109ac1:
local_35c = 0;
}
iVar9 = _V_strlen("connect");
local_360 = 0;
if ((*(char *)((int)&local_320 + iVar9) == '0') && (*(char *)((int)&local_320 + iVar9 + 1) == 'x')
) {
local_329[0] = '\0';
local_329[1] = '\0';
local_329[2] = '\0';
local_329[3] = '\0';
local_329[4] = '\0';
local_329[5] = '\0';
local_329[6] = '\0';
local_329[7] = '\0';
local_329[8] = 0;
V_strncpy(local_329,(char *)((int)&local_320 + iVar9 + 2),9);
local_360 = strtoul(local_329,(char **)0x0,0x10);
}
cVar2 = IsExclusiveToLobbyConnections(in_EAX);
if ((cVar2 == '\0') || (*(int *)(in_EAX + 0x170) != 0 || *(int *)(in_EAX + 0x16c) != 0)) {
bf_write::WriteString((bf_write *)local_344,(char *)&local_320);
}
else if (uVar4 == local_360) {
bf_write::WriteString((bf_write *)local_344,"connect-granted");
*(float *)(in_EAX + 0x1a8) = (float)net_time;
*(undefined4 *)(in_EAX + 0x1ac) = *(undefined4 *)in_EDX;
*(undefined4 *)(in_EAX + 0x1b0) = *(undefined4 *)(in_EDX + 4);
*(undefined2 *)(in_EAX + 0x1b4) = *(undefined2 *)(in_EDX + 8);
uVar8 = netadr_s::ToString(in_EDX,false);
DevMsg("Server requires lobby reservation and is unreserved: granting reservation grace period to %s\n"
,uVar8);
}
else {
bf_write::WriteString((bf_write *)local_344,"connect-retry");
}
pcVar10 = "";
cVar2 = IsExclusiveToLobbyConnections(in_EAX);
if ((cVar2 != '\0') && (pcVar10 = "public", *(int *)(sv_steamgroup_exclusive._28_4_ + 0x30) != 0))
{
pcVar10 = "friends";
}
lVar5 = GetHostVersion();
bf_write::WriteLong((bf_write *)local_344,lVar5);
bf_write::WriteString((bf_write *)local_344,pcVar10);
bf_write::WriteByte((bf_write *)local_344,local_35c);
bf_write::WriteLongLong(CONCAT44(_DAT_003b80cc,(bf_write *)local_344));
LAB_00109b9c:
NET_SendPacket((INetChannel *)0x0,*(int *)(in_EAX + 8),in_EDX,local_344[0],local_338 + 7 >> 3,
(bf_write *)0x0,false,0);
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.