CBaseServer::ConnectClient
0x0010ad80 · 1786 bytes · __thiscall
_ZN11CBaseServer13ConnectClientER8netadr_siiiPKcS3_S3_iR10CUtlVectorI22CLC_SplitPlayerConnect10CUtlMemoryIS5_iEEb
Decompiled
undefined (11 params)
/* CBaseServer::ConnectClient(netadr_s&, int, int, int, char const*, char const*, char const*, int,
CUtlVector<CLC_SplitPlayerConnect, CUtlMemory<CLC_SplitPlayerConnect, int> >&, bool) */
INetChannelHandler * __thiscall
CBaseServer::ConnectClient
(CBaseServer *this,netadr_s *param_1,int param_2,int param_3,int param_4,char *param_5,
char *param_6,char *param_7,int param_8,CUtlVector *param_9,bool param_10)
{
code *pcVar1;
int iVar2;
bool bVar3;
int iVar4;
char cVar5;
char cVar6;
int *piVar7;
undefined4 uVar8;
int *piVar9;
int iVar10;
undefined4 uVar11;
int iVar12;
int iVar13;
int iVar14;
double dVar15;
char *pcVar16;
int local_24;
int local_20;
COM_TimestampedLog("CBaseServer::ConnectClient");
cVar5 = (**(code **)(*(int *)this + 0x58))(this);
if (cVar5 == '\0') {
uVar8 = netadr_s::ToString(param_1,false);
DevMsg("Server not active, ignoring %s\n",uVar8);
return (INetChannelHandler *)0x0;
}
if (((param_5 == (char *)0x0) || (param_6 == (char *)0x0)) || (param_7 == (char *)0x0)) {
uVar8 = netadr_s::ToString(param_1,false);
DevMsg("Bad auth data from %s\n",uVar8);
return (INetChannelHandler *)0x0;
}
cVar5 = (**(code **)(*(int *)this + 0xe0))(this,param_1,param_2);
if (cVar5 == '\0') {
uVar8 = netadr_s::ToString(param_1,false);
DevMsg("Protocol error from %s\n",uVar8);
return (INetChannelHandler *)0x0;
}
cVar5 = (**(code **)(*(int *)this + 0xe4))(this,param_1,param_3);
if (cVar5 == '\0') {
iVar10 = *(int *)this;
pcVar16 = "Bad challenge.\n";
goto LAB_0010b1e8;
}
cVar6 = '\x01';
cVar5 = netadr_s::IsLocalhost(param_1);
if (cVar5 == '\0') {
cVar6 = netadr_s::IsLoopback(param_1);
}
cVar5 = IsExclusiveToLobbyConnections(this);
if ((cVar5 == '\0') || (*(int *)(this + 0x170) != 0 || *(int *)(this + 0x16c) != 0)) {
cVar5 = (**(code **)(*(int *)this + 0x60))(this);
if ((cVar5 == '\0') && (cVar6 == '\0')) {
if (DAT_003b8186 != '\0') {
iVar10 = *(int *)this;
pcVar16 = "#Valve_Reject_Background_Map";
goto LAB_0010b1e8;
}
if ((serverGameDLL != (int *)0x0) &&
(cVar5 = (**(code **)(*serverGameDLL + 0x84))(serverGameDLL), cVar5 != '\0')) {
iVar10 = *(int *)this;
pcVar16 = "#Valve_Reject_Hidden_Game";
goto LAB_0010b1e8;
}
}
}
else {
if (cVar6 == '\0') {
pcVar1 = *(code **)(*(int *)this + 0xc4);
uVar8 = netadr_s::ToString(param_1,false);
(*pcVar1)(this,param_1,"Server only accepting connections from game lobby %s %d.\n",uVar8,
param_3);
return (INetChannelHandler *)0x0;
}
(**(code **)(*(int *)this + 0x60))(this);
}
cVar5 = (**(code **)(*(int *)this + 0x70))(this);
if (cVar5 == '\0') {
cVar5 = (**(code **)(*(int *)this + 200))(this,param_1,param_4);
iVar10 = *(int *)this;
if (cVar5 == '\0') {
pcVar16 = "#Valve_Reject_LAN_Game";
goto LAB_0010b1e8;
}
cVar5 = (**(code **)(iVar10 + 0xec))(this,param_1,param_6,param_5);
if (cVar5 == '\0') {
uVar8 = netadr_s::ToString(param_1,false);
ConMsg("%s: password failed.\n",uVar8);
iVar10 = *(int *)this;
pcVar16 = "#Valve_Reject_Bad_Password";
goto LAB_0010b1e8;
}
}
if (*(int *)(this + 0x17c) == 0) {
LAB_0010ae7e:
COM_TimestampedLog("CBaseServer::ConnectClient: GetFreeClient");
piVar7 = (int *)GetFreeClientInternal(this,param_1);
if (piVar7 != (int *)0x0) {
uVar8 = GetNextUserID(this);
cVar5 = (**(code **)(*(int *)this + 0xe8))(this,piVar7,uVar8,param_1,param_4,param_7,param_8);
if ((cVar5 == '\0') ||
(cVar5 = (**(code **)(*(int *)this + 0xd4))(this,param_1,param_4,param_7), cVar5 == '\0'))
{
return (INetChannelHandler *)0x0;
}
if (*(int *)(this + 0x170) == 0 && *(int *)(this + 0x16c) == 0) {
LAB_0010af21:
COM_TimestampedLog("CBaseServer::ConnectClient: NET_CreateNetChannel");
piVar9 = (int *)NET_CreateNetChannel
(*(int *)(this + 8),param_1,param_5,
(INetChannelHandler *)(piVar7 + 1),false);
if (piVar9 != (int *)0x0) {
(**(code **)(*piVar9 + 0x8c))(piVar9,param_3);
COM_TimestampedLog("CBaseServer::ConnectClient: client->Connect");
iVar10 = 0;
if (0 < *(int *)(param_9 + 0xc)) {
iVar10 = *(int *)param_9 + 0x4c;
}
(**(code **)(*piVar7 + 0x30))(piVar7,param_5,uVar8,piVar9,0,iVar10);
dVar15 = net_time + 0.05000000074505806;
*(bool *)((int)piVar7 + 0x216) = param_10;
*(undefined4 *)(this + 0x100) = uVar8;
*(double *)(piVar7 + 0x86) = dVar15;
piVar7[0x88] = 0x3d4ccccd;
piVar7[0x3c] = -1;
piVar7[0x3e] = 0;
piVar7[0x3d] = 0;
if ((CFrameSnapshot *)piVar7[0x3f] != (CFrameSnapshot *)0x0) {
CFrameSnapshot::ReleaseReference((CFrameSnapshot *)piVar7[0x3f]);
piVar7[0x3f] = 0;
}
NET_OutOfBandPrintf(*(int *)(this + 8),param_1,"%c00000000000000",0x42);
if (param_4 == 2) {
V_strncpy((char *)(piVar7 + 0x17),param_7,0x20);
*(undefined1 *)(piVar7 + 0x1f) = 0;
}
iVar10 = 0x60;
if (1 < *(int *)(param_9 + 0xc)) {
iVar14 = 1;
do {
iVar14 = iVar14 + 1;
ConMsg("Processing Split Screen connection packet.\n");
iVar13 = *(int *)param_9 + iVar10;
iVar10 = iVar10 + 0x60;
(**(code **)(*piVar7 + 0xbc))(piVar7,iVar13);
} while (iVar14 < *(int *)(param_9 + 0xc));
}
cVar5 = (**(code **)(*piVar9 + 0x18))(piVar9);
if (cVar5 == '\0') {
uVar8 = (**(code **)(*piVar9 + 4))(piVar9);
uVar11 = (**(code **)(*piVar7 + 0x1c))(piVar7);
ConMsg("Client \"%s\" connected (%s).\n",uVar11,uVar8);
}
*(undefined4 *)(this + 0x174) = 0;
*(undefined4 *)(this + 0x178) = 0xbf800000;
return (INetChannelHandler *)(piVar7 + 1);
}
iVar10 = *(int *)this;
pcVar16 = "Failed to create net channel.\n";
}
else {
if ((*(int *)(param_9 + 0xc) != 0) &&
(iVar10 = *(int *)param_9, 0 < *(int *)(iVar10 + 0x58))) {
bVar3 = false;
iVar14 = 0;
do {
pcVar16 = (char *)(iVar14 * 0x208 + *(int *)(iVar10 + 0x4c));
iVar13 = _V_stricmp(pcVar16,"cl_session");
if (iVar13 == 0) {
pcVar16 = pcVar16 + 0x104;
iVar12 = sscanf(pcVar16,"$%llx",&local_24);
iVar4 = local_20;
iVar13 = local_24;
if (iVar12 == 1) {
iVar12 = *(int *)(this + 0x170);
iVar2 = *(int *)(this + 0x16c);
if (local_20 == iVar12 && local_24 == iVar2) {
bVar3 = true;
}
else {
uVar11 = netadr_s::ToString(param_1,false);
Warning("mismatching cookie from %s, client %llx, server %llx!\n",uVar11,iVar13,
iVar4,iVar2,iVar12);
}
}
else {
Warning("failed to parse session id %s\n",pcVar16);
}
}
iVar14 = iVar14 + 1;
} while (iVar14 < *(int *)(iVar10 + 0x58));
if (bVar3) goto LAB_0010af21;
}
iVar10 = *(int *)this;
pcVar16 = "Invalid user info.\n";
}
goto LAB_0010b1e8;
}
}
else {
iVar10 = *(int *)(param_9 + 0xc);
iVar14 = (**(code **)(*(int *)this + 0xc))(this);
iVar13 = (**(code **)(*(int *)this + 0x14))(this);
if (iVar10 + (iVar14 - iVar13) <= *(int *)(this + 0x17c)) goto LAB_0010ae7e;
}
iVar10 = *(int *)this;
pcVar16 = "#Valve_Reject_Server_Full";
LAB_0010b1e8:
(**(code **)(iVar10 + 0xc4))(this,param_1,pcVar16);
return (INetChannelHandler *)0x0;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.