pingserver
0x00203bb0 · 649 bytes · __cdecl
_ZL10pingserverRK8CCommand
Decompiled
undefined (1 param)
/* pingserver(CCommand const&) */
void pingserver(CCommand *param_1)
{
uchar *puVar1;
char cVar2;
undefined4 uVar3;
CCommand *pCVar4;
int iVar5;
int in_GS_OFFSET;
undefined1 local_68;
undefined1 local_67;
undefined1 local_66;
undefined1 local_65;
uchar *local_64 [4];
int local_54;
byte local_4f;
int local_4c;
int local_44;
byte local_30;
netadr_s local_2c [12];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (*(int *)param_1 < 2) {
ConMsg("Usage: pingserver <server:ip>\n");
}
else {
pCVar4 = (CCommand *)&DAT_002c79d4;
if (*(int *)(param_1 + 4) != 0) {
pCVar4 = param_1 + *(int *)(param_1 + 4) + 8;
}
netadr_s::SetIP(local_2c,0);
netadr_s::SetPort(local_2c,0);
netadr_s::SetType(local_2c,3);
netadr_s::SetFromString(local_2c,(char *)pCVar4,false);
uVar3 = netadr_s::ToString(local_2c,false);
Msg("pinging %s\n",uVar3);
CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_64,0,0,0);
if ((local_4f & 1) == 0) {
cVar2 = CUtlBuffer::CheckPut((CUtlBuffer *)local_64,4);
if (cVar2 != '\0') {
if ((local_30 & 1) == 0) {
puVar1 = local_64[0] + (local_54 - local_44);
puVar1[0] = 0xff;
puVar1[1] = 0xff;
puVar1[2] = 0xff;
puVar1[3] = 0xff;
}
else if (local_64[0] + (local_54 - local_44) != (uchar *)0x0) {
local_68 = 0xff;
local_67 = 0xff;
local_66 = 0xff;
local_65 = 0xff;
_V_memcpy(local_64[0] + (local_54 - local_44),&local_68,4);
}
local_54 = local_54 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_64);
}
}
else {
/* try { // try from 00203c89 to 00203e30 has its CatchHandler @ 00203e56 */
CUtlBuffer::Printf((CUtlBuffer *)local_64,"%d",0xffffffff);
}
if ((((local_4f & 1) != 0) && (local_54 != 0)) &&
(local_64[0][(local_54 + -1) - local_44] == '\n')) {
iVar5 = 0;
if ((local_4f & 0x10) == 0) {
iVar5 = local_4c;
}
while (iVar5 = iVar5 + -1, -1 < iVar5) {
cVar2 = CUtlBuffer::CheckPut((CUtlBuffer *)local_64,1);
if (cVar2 != '\0') {
local_64[0][local_54 - local_44] = '\t';
local_54 = local_54 + 1;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_64);
}
}
}
cVar2 = CUtlBuffer::CheckPut((CUtlBuffer *)local_64,1);
if (cVar2 != '\0') {
local_64[0][local_54 - local_44] = 'T';
local_54 = local_54 + 1;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_64);
}
CUtlBuffer::PutString((CUtlBuffer *)local_64,"Source Engine Query");
NET_SendPacket((INetChannel *)0x0,0,local_2c,local_64[0],local_54,(bf_write *)0x0,false,0);
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_64);
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return;
}
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.