Win32UploadGameStatsBlocking
0x00213c80 · 2285 bytes · __cdecl
_Z28Win32UploadGameStatsBlockingRK20TGameStatsParameters
Decompiled
undefined (1 param)
/* Win32UploadGameStatsBlocking(TGameStatsParameters const&) */
undefined4 Win32UploadGameStatsBlocking(TGameStatsParameters *param_1)
{
char cVar1;
uchar uVar2;
undefined4 uVar3;
int iVar4;
int in_GS_OFFSET;
uchar local_fd;
uchar local_fc;
uchar local_fb;
ushort local_fa;
int local_f8;
uint local_f4;
undefined4 local_f0;
undefined1 local_ec;
undefined1 local_eb;
undefined1 local_ea;
undefined1 local_e9;
undefined4 local_e8;
undefined1 local_e4;
undefined1 local_e3;
undefined1 local_e2;
undefined1 local_e1;
uchar *local_e0 [3];
int local_d4;
uint local_d0;
undefined1 local_cc;
byte local_cb;
int local_c8;
undefined4 local_c4;
int local_c0;
byte local_ac;
netadr_s local_a8 [12];
sockaddr local_9c;
sockaddr_in local_8c [16];
sockaddr local_7c;
CBlockingUDPSocket local_6c [20];
int local_58;
CWin32UploadGameStats local_54 [52];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_e0,*(int *)(param_1 + 0xd4) + 0x1000,0,0);
/* try { // try from 00213cd2 to 00213ed9 has its CatchHandler @ 002145c2 */
UpdateProgress(param_1,"Creating initial report.");
CUtlBuffer::SetBigEndian((CUtlBuffer *)local_e0,false);
local_d4 = 0;
local_d0 = 0;
local_c0 = 0;
local_c4 = 0;
local_cc = 0;
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_e0);
if ((((local_cb & 1) != 0) && (local_d0 != 0)) && (local_e0[0][(local_d0 - 1) - local_c0] == '\n')
) {
iVar4 = 0;
if ((local_cb & 0x10) == 0) {
iVar4 = local_c8;
}
while (iVar4 = iVar4 + -1, -1 < iVar4) {
while (cVar1 = CUtlBuffer::CheckPut((CUtlBuffer *)local_e0,1), cVar1 != '\0') {
local_e0[0][local_d0 - local_c0] = '\t';
local_d0 = local_d0 + 1;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_e0);
iVar4 = iVar4 + -1;
if (iVar4 < 0) goto LAB_00213da0;
}
}
}
LAB_00213da0:
cVar1 = CUtlBuffer::CheckPut((CUtlBuffer *)local_e0,1);
if (cVar1 != '\0') {
local_e0[0][local_d0 - local_c0] = 'k';
local_d0 = local_d0 + 1;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_e0);
}
if ((((local_cb & 1) != 0) && (local_d0 != 0)) && (local_e0[0][(local_d0 - 1) - local_c0] == '\n')
) {
iVar4 = 0;
if ((local_cb & 0x10) == 0) {
iVar4 = local_c8;
}
while (iVar4 = iVar4 + -1, -1 < iVar4) {
while (cVar1 = CUtlBuffer::CheckPut((CUtlBuffer *)local_e0,1), cVar1 != '\0') {
local_e0[0][local_d0 - local_c0] = '\t';
local_d0 = local_d0 + 1;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_e0);
iVar4 = iVar4 + -1;
if (iVar4 < 0) goto LAB_00213e38;
}
}
}
LAB_00213e38:
cVar1 = CUtlBuffer::CheckPut((CUtlBuffer *)local_e0,1);
if (cVar1 != '\0') {
local_e0[0][local_d0 - local_c0] = '\n';
local_d0 = local_d0 + 1;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_e0);
}
if ((((local_cb & 1) != 0) && (local_d0 != 0)) && (local_e0[0][(local_d0 - 1) - local_c0] == '\n')
) {
iVar4 = 0;
if ((local_cb & 0x10) == 0) {
iVar4 = local_c8;
}
while (iVar4 = iVar4 + -1, -1 < iVar4) {
/* try { // try from 0021403c to 002142b3 has its CatchHandler @ 002145c2 */
cVar1 = CUtlBuffer::CheckPut((CUtlBuffer *)local_e0,1);
if (cVar1 != '\0') {
local_e0[0][local_d0 - local_c0] = '\t';
local_d0 = local_d0 + 1;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_e0);
}
}
}
cVar1 = CUtlBuffer::CheckPut((CUtlBuffer *)local_e0,1);
if (cVar1 != '\0') {
local_e0[0][local_d0 - local_c0] = '\x02';
local_d0 = local_d0 + 1;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_e0);
}
uVar3 = *(undefined4 *)(param_1 + 0xe4);
if ((local_cb & 1) == 0) {
local_f0 = uVar3;
cVar1 = CUtlBuffer::CheckPut((CUtlBuffer *)local_e0,4);
if (cVar1 != '\0') {
if ((local_ac & 1) == 0) {
*(undefined4 *)(local_e0[0] + (local_d0 - local_c0)) = uVar3;
}
else if (local_e0[0] + (local_d0 - local_c0) != (uchar *)0x0) {
local_ec = local_f0._3_1_;
local_eb = local_f0._2_1_;
local_ea = local_f0._1_1_;
local_e9 = (undefined1)local_f0;
_V_memcpy(local_e0[0] + (local_d0 - local_c0),&local_ec,4);
}
local_d0 = local_d0 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_e0);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)local_e0,"%d",uVar3);
}
uVar3 = *(undefined4 *)(param_1 + 0xd4);
if ((local_cb & 1) == 0) {
local_e8 = uVar3;
cVar1 = CUtlBuffer::CheckPut((CUtlBuffer *)local_e0,4);
if (cVar1 != '\0') {
if ((local_ac & 1) == 0) {
*(undefined4 *)(local_e0[0] + (local_d0 - local_c0)) = uVar3;
}
else if (local_e0[0] + (local_d0 - local_c0) != (uchar *)0x0) {
local_e4 = local_e8._3_1_;
local_e3 = local_e8._2_1_;
local_e2 = local_e8._1_1_;
local_e1 = (undefined1)local_e8;
_V_memcpy(local_e0[0] + (local_d0 - local_c0),&local_e4,4);
}
local_d0 = local_d0 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_e0);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)local_e0,"%d",uVar3);
}
CBlockingUDPSocket::CBlockingUDPSocket(local_6c);
if (local_58 == 0) {
uVar3 = 1;
goto LAB_00213fd2;
}
/* try { // try from 00213ef2 to 00213fcf has its CatchHandler @ 002145a8 */
netadr_s::ToSockadr((netadr_s *)param_1,&local_9c);
uVar3 = netadr_s::ToString((netadr_s *)param_1,false);
UpdateProgress(param_1,"Sending game stats to server %s.",uVar3);
CBlockingUDPSocket::SendSocketMessage(local_6c,(sockaddr_in *)&local_9c,local_e0[0],local_d0);
UpdateProgress(param_1,"Waiting for response.");
cVar1 = CBlockingUDPSocket::WaitForMessage(local_6c,2.0);
if (cVar1 == '\0') {
UpdateProgress(param_1,"No response from server.");
LAB_00213fd0:
uVar3 = 0;
goto LAB_00213fd2;
}
UpdateProgress(param_1,"Received response.");
CUtlBuffer::EnsureCapacity((CUtlBuffer *)local_e0,0x1000);
iVar4 = CBlockingUDPSocket::ReceiveSocketMessage(local_6c,local_8c,local_e0[0],0x1000);
if (iVar4 == 0) {
uVar3 = 0;
goto LAB_00213fd2;
}
/* try { // try from 002142cf to 0021457b has its CatchHandler @ 002145a8 */
CUtlBuffer::SeekPut((CUtlBuffer *)local_e0,0,iVar4);
UpdateProgress(param_1,"Checking response.");
if ((local_cb & 1) == 0) {
cVar1 = CUtlBuffer::CheckGet((CUtlBuffer *)local_e0,1);
if (cVar1 != '\0') {
uVar2 = local_e0[0][local_d4 - local_c0];
local_d4 = local_d4 + 1;
goto LAB_00214319;
}
LAB_0021431d:
UpdateProgress(param_1,"Request denied, invalid message type.");
}
else {
local_fd = '\0';
CUtlBuffer::Scanf((CUtlBuffer *)local_e0,"%c",&local_fd);
uVar2 = local_fd;
LAB_00214319:
if (uVar2 != 'l') goto LAB_0021431d;
if ((local_cb & 1) == 0) {
cVar1 = CUtlBuffer::CheckGet((CUtlBuffer *)local_e0,1);
if (cVar1 != '\0') {
uVar2 = local_e0[0][local_d4 - local_c0];
local_d4 = local_d4 + 1;
goto LAB_00214368;
}
}
else {
local_fc = '\0';
CUtlBuffer::Scanf((CUtlBuffer *)local_e0,"%c",&local_fc);
uVar2 = local_fc;
LAB_00214368:
if (uVar2 == '\x01') {
if ((local_cb & 1) == 0) {
cVar1 = CUtlBuffer::CheckGet((CUtlBuffer *)local_e0,1);
if (cVar1 != '\0') {
uVar2 = local_e0[0][local_d4 - local_c0];
local_d4 = local_d4 + 1;
goto LAB_00214427;
}
}
else {
local_fb = '\0';
CUtlBuffer::Scanf((CUtlBuffer *)local_e0,"%c",&local_fb);
uVar2 = local_fb;
LAB_00214427:
if (uVar2 == '\x02') {
CUtlBuffer::GetType<int>((CUtlBuffer *)local_e0,&local_f8,"%d");
CUtlBuffer::GetType<short>((CUtlBuffer *)local_e0,(short *)&local_fa,"%d");
CUtlBuffer::GetType<int>((CUtlBuffer *)local_e0,(int *)&local_f4,"%d");
local_7c.sa_family = 2;
local_7c.sa_data._0_2_ = local_fa >> 8 | local_fa << 8;
local_7c.sa_data[2] = (undefined1)local_f8;
local_7c.sa_data[3] = local_f8._1_1_;
local_7c.sa_data[4] = local_f8._2_1_;
local_7c.sa_data[5] = local_f8._3_1_;
netadr_s::netadr_s(local_a8);
netadr_s::SetFromSockadr(local_a8,&local_7c);
uVar3 = netadr_s::ToString(local_a8,false);
UpdateProgress(param_1,"Server requested game stats upload to %s.",uVar3);
CWin32UploadGameStats::CWin32UploadGameStats(local_54,local_a8,param_1,local_f4);
/* try { // try from 00214583 to 00214587 has its CatchHandler @ 002145c6 */
uVar3 = CWin32UploadGameStats::Upload(local_54,(CUtlBuffer *)local_e0);
CWin32UploadGameStats::~CWin32UploadGameStats(local_54);
goto LAB_00213fd2;
}
}
UpdateProgress(param_1,"Stats report accepted, data upload skipped.");
goto LAB_00213fd0;
}
}
UpdateProgress(param_1,"Request denied, invalid message protocol.");
}
uVar3 = 5;
LAB_00213fd2:
CBlockingUDPSocket::~CBlockingUDPSocket(local_6c);
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_e0);
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return uVar3;
}
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.