netadr_s::SetFromString
0x000482f0 · 433 bytes · __thiscall
_ZN8netadr_s13SetFromStringEPKcb
Decompiled
undefined (3 params)
/* netadr_s::SetFromString(char const*, bool) */
void __thiscall netadr_s::SetFromString(netadr_s *this,char *param_1,bool param_2)
{
char *pcVar1;
int iVar2;
hostent *phVar3;
uint uVar4;
int in_GS_OFFSET;
netadr_s local_134 [4];
netadr_s local_130 [4];
netadr_s local_12c [4];
netadr_s local_128 [4];
ushort local_124 [2];
char local_120 [256];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
this[7] = (netadr_s)0x0;
this[6] = (netadr_s)0x0;
this[5] = (netadr_s)0x0;
this[4] = (netadr_s)0x0;
*(undefined2 *)(this + 8) = 0;
*(undefined4 *)this = 3;
if (param_1 != (char *)0x0) {
if ((byte)(*param_1 - 0x30U) < 10) {
pcVar1 = strchr(param_1,0x2e);
if (pcVar1 != (char *)0x0) {
iVar2 = sscanf(param_1,"%d.%d.%d.%d:%d",local_134,local_130,local_12c,local_128,local_124);
if (3 < iVar2) {
this[6] = local_12c[0];
this[4] = local_134[0];
this[5] = local_130[0];
this[7] = local_128[0];
if (iVar2 == 5) {
*(ushort *)(this + 8) = local_124[0] >> 8 | local_124[0] << 8;
}
}
goto LAB_000483f8;
}
}
if (param_2) {
V_strncpy(local_120,param_1,0x100);
pcVar1 = strchr(local_120,0x3a);
if (pcVar1 != (char *)0x0) {
*pcVar1 = '\0';
}
phVar3 = gethostbyname(local_120);
if ((phVar3 != (hostent *)0x0) &&
(*(undefined4 *)(this + 4) = *(undefined4 *)*phVar3->h_addr_list, pcVar1 != (char *)0x0)) {
uVar4 = strtol(pcVar1 + 1,(char **)0x0,10);
*(ushort *)(this + 8) = (ushort)(uVar4 >> 8) & 0xff | (ushort)((uVar4 & 0xffff) << 8);
}
}
}
LAB_000483f8:
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.