CBaseClientState::CheckForResend
0x00102b70 · 1022 bytes · __thiscall
_ZN16CBaseClientState14CheckForResendEb
Decompiled
undefined (2 params)
/* CBaseClientState::CheckForResend(bool) */
void __thiscall CBaseClientState::CheckForResend(CBaseClientState *this,bool param_1)
{
netadr_s *this_00;
char cVar1;
undefined4 uVar2;
undefined4 uVar3;
char *pcVar4;
int iVar5;
uint uVar6;
int iVar7;
int iVar8;
int in_GS_OFFSET;
float fVar9;
CUtlString local_bc [16];
undefined4 local_ac;
undefined4 local_a8;
undefined2 local_a4;
char local_a0 [128];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if ((((*(int *)(this + 0x60) == 1) && (this[0x189] == (CBaseClientState)0x0)) &&
((param_1 ||
((double)*(float *)(cl_resend._28_4_ + 0x2c) <= net_time - *(double *)(this + 0x1c))))) &&
(0 < *(int *)(this + 0x38))) {
iVar7 = 0;
iVar8 = 0;
do {
cVar1 = Remote_t::Resolve((Remote_t *)(*(int *)(this + 0x2c) + iVar7));
if (cVar1 == '\0') {
uVar2 = CUtlString::Get((CUtlString *)(*(int *)(this + 0x2c) + iVar7 + 0x10));
uVar3 = CUtlString::Get((CUtlString *)(iVar7 + *(int *)(this + 0x2c)));
ConMsg("Bad server address %s(%s)\n",uVar3,uVar2);
(**(code **)(*(int *)this + 0x94))(this,1);
goto LAB_00102b94;
}
iVar8 = iVar8 + 1;
iVar7 = iVar7 + 0x2c;
} while (iVar8 < *(int *)(this + 0x38));
iVar7 = *(int *)(this + 0x24);
iVar8 = (**(code **)(*(int *)this + 0xbc))(this);
if (iVar7 < iVar8) {
*(double *)(this + 0x1c) = net_time;
pcVar4 = CUtlString::operator_cast_to_char_((CUtlString *)(*(int *)(this + 0x2c) + 0x10));
iVar7 = V_strncmp(pcVar4,"localhost",9);
if (iVar7 != 0) {
CUtlString::CUtlString(local_bc);
/* try { // try from 00102cf7 to 00102d29 has its CatchHandler @ 00102f7e */
CAddressList::Describe((CAddressList *)(this + 0x2c),local_bc);
uVar2 = CUtlString::Get(local_bc);
pcVar4 = "Connecting to";
if (*(int *)(this + 0x24) != 0) {
pcVar4 = "Retrying";
}
ConMsg("%s %s\n",pcVar4,uVar2);
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_bc);
}
V_snprintf(local_a0,0x80,"%cconnect0x%08X",0x71,*(undefined4 *)(this + 0x1a0));
iVar5 = (**(code **)(*(int *)g_pSteamSocketMgr + 8))(g_pSteamSocketMgr);
iVar7 = *(int *)(this + 0x5c);
iVar8 = *(int *)(this + 0x58);
if ((iVar7 == 0 && iVar8 == 0) ||
((((int)*(uint *)(this + 0x24) < 1 || ((*(uint *)(this + 0x24) & 1) != 0)) && (iVar5 != 2))
)) {
if (0 < *(int *)(this + 0x38)) {
iVar7 = 0;
iVar8 = 0;
do {
iVar5 = *(int *)(this + 0x2c);
this_00 = (netadr_s *)((CUtlString *)(iVar7 + iVar5) + 0x20);
uVar2 = netadr_s::ToString(this_00,false);
uVar3 = CUtlString::Get((CUtlString *)(iVar7 + iVar5));
local_ac = 0xff00ff00;
ConColorMsg((Color *)&local_ac,"Sending UDP connect to %s IP %s\n",uVar3,uVar2);
iVar5 = _V_strlen(local_a0);
fVar9 = *(float *)(cl_resend._28_4_ + 0x2c) * 0.5;
if (fVar9 <= 0.0) {
fVar9 = 0.0;
}
if (1.0 <= fVar9) {
fVar9 = 1.0;
}
uVar6 = (uint)(2.1474836e+09 <= fVar9 * 1000.0);
uVar6 = ((int)(fVar9 * 1000.0 - (float)(-uVar6 & 0x4f000000)) ^ uVar6 * -0x80000000) *
iVar8;
iVar8 = iVar8 + 1;
NET_OutOfBandDelayedPrintf(*(int *)(this + 0xc),this_00,uVar6,local_a0,iVar5 + 1);
iVar7 = iVar7 + 0x2c;
} while (iVar8 < *(int *)(this + 0x38));
}
}
else {
uVar2 = CUtlString::Get((CUtlString *)(*(int *)(this + 0x2c) + 0x10));
local_ac = 0xff00ff00;
ConColorMsg((Color *)&local_ac,"Sending Steam connect to %s %llx\n",uVar2,iVar8,iVar7);
iVar7 = *(int *)(this + 0x2c);
iVar8 = _V_strlen(local_a0);
NET_InitiateSteamConnection
((int)&local_ac,CONCAT44(*(undefined4 *)(this + 0x58),*(undefined4 *)(this + 0xc))
,*(char **)(this + 0x5c),local_a0,iVar8 + 1);
*(undefined4 *)(iVar7 + 0x20) = local_ac;
*(undefined4 *)(iVar7 + 0x24) = local_a8;
*(undefined2 *)(iVar7 + 0x28) = local_a4;
}
*(int *)(this + 0x24) = *(int *)(this + 0x24) + 1;
}
else {
uVar2 = (**(code **)(*(int *)this + 0xbc))(this);
COM_ExplainDisconnection(true,"Connection failed after %i retries.\n",uVar2);
(**(code **)(*(int *)this + 0x94))(this,1);
}
}
LAB_00102b94:
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.