CNetChan::ProcessStream
0x001b8a10 · 2114 bytes · __thiscall
_ZN8CNetChan13ProcessStreamEv.part.127
Decompiled
undefined (1 param)
/* CNetChan::ProcessStream() [clone .part.127] */
undefined4 __thiscall CNetChan::ProcessStream(CNetChan *this)
{
uint *puVar1;
int iVar2;
CNetChan *in_EAX;
undefined4 uVar3;
int iVar4;
uint uVar5;
undefined4 uVar6;
uint uVar7;
int in_GS_OFFSET;
byte local_280;
uint local_278;
char *local_268;
char local_264;
undefined4 local_260;
undefined4 local_25c;
uint local_258;
int local_254;
uint *local_250;
uint *local_24c;
undefined4 local_244;
undefined1 local_240;
undefined4 local_23c;
undefined4 local_238;
char local_220 [512];
int local_20;
local_264 = '\0';
local_20 = *(int *)(in_GS_OFFSET + 0x14);
local_260 = 0xffffffff;
local_25c = 0;
local_268 = "inDataHeader";
CBitRead::StartReading((CBitRead *)&local_268,local_220,0x200,0,-1);
iVar4 = *(int *)(in_EAX + 0x42c);
if (iVar4 == 1) {
in_EAX[0x42a] = (CNetChan)0x1;
(**(code **)(*(int *)in_EAX + 0x80))();
uVar3 = SendReliableAcknowledge(in_EAX,*(int *)(in_EAX + 0x4200));
goto LAB_001b8abd;
}
if (iVar4 == 2) {
iVar4 = *(int *)(in_EAX + 0x434);
if (iVar4 != 0) goto LAB_001b8aae;
iVar4 = NET_ReceiveStream(*(int *)(in_EAX + 0x90),local_220,6,0);
if (iVar4 != 0) {
if (iVar4 != -1) {
if (local_254 < 0x10) {
if (local_250 == local_24c) {
local_250 = local_250 + 1;
local_254 = 1;
}
else if (local_250 <= local_24c) {
uVar7 = *local_250;
if (local_264 == '\0') {
local_280 = (byte)local_254;
uVar5 = (uVar7 & (&CBitBuffer::s_nMaskTable)[0x10 - local_254]) << (local_280 & 0x1f)
| local_258;
local_278._0_1_ = (byte)(0x10 - local_254);
local_278 = uVar7 >> ((byte)local_278 & 0x1f);
local_254 = local_254 + 0x10;
local_250 = local_250 + 1;
}
else {
uVar5 = 0;
local_278 = uVar7;
local_250 = local_250 + 1;
}
goto LAB_001b8e2c;
}
local_264 = '\x01';
local_278 = 0;
uVar5 = 0;
LAB_001b8e2c:
*(uint *)(in_EAX + 0x434) = uVar5;
iVar4 = local_254;
LAB_001b8e32:
local_254 = iVar4;
uVar7 = 0;
if (local_250 == local_24c) {
local_250 = local_250 + 1;
local_254 = 1;
local_258 = 0;
local_264 = '\x01';
}
else if (local_24c < local_250) {
local_264 = '\x01';
local_258 = 0;
}
else {
puVar1 = local_250 + 1;
local_258 = *local_250;
local_250 = puVar1;
if (local_264 == '\0') {
uVar7 = ((&CBitBuffer::s_nMaskTable)[0x20 - local_254] & local_258) <<
((byte)local_254 & 0x1f) | local_278;
local_258 = local_258 >> ((byte)(0x20 - local_254) & 0x1f);
}
}
uVar5 = *(uint *)(in_EAX + 0x434);
}
else {
uVar5 = local_258 & 0xffff;
iVar4 = local_254 + -0x10;
if (iVar4 == 0) {
if (local_250 == local_24c) {
local_254 = 1;
local_278 = 0;
local_250 = local_250 + 1;
goto LAB_001b8e2c;
}
if (local_24c < local_250) {
local_264 = '\x01';
uVar7 = 0;
}
else {
uVar7 = *local_250;
local_250 = local_250 + 1;
}
*(uint *)(in_EAX + 0x434) = uVar5;
LAB_001b8f24:
local_254 = 0x20;
if (local_250 == local_24c) {
local_254 = 1;
local_250 = local_250 + 1;
local_258 = 0;
}
else {
if (local_24c < local_250) {
local_264 = '\x01';
goto LAB_001b8d5d;
}
local_258 = *local_250;
local_250 = local_250 + 1;
}
}
else {
uVar7 = local_258 >> 0x10;
*(uint *)(in_EAX + 0x434) = uVar5;
local_278 = uVar7;
if (iVar4 < 0x20) goto LAB_001b8e32;
local_254 = local_254 + -0x30;
if (local_254 == 0) goto LAB_001b8f24;
LAB_001b8d5d:
local_258 = 0;
}
}
*(uint *)(in_EAX + 0x430) = uVar7;
if (0x37aa0 < (int)uVar5) {
ConMsg("ERROR! Stream indata too big (%i)",uVar5);
uVar3 = 0;
goto LAB_001b8abd;
}
iVar4 = *(int *)(in_EAX + 0x42c);
goto LAB_001b8a96;
}
goto LAB_001b8d95;
}
}
else {
LAB_001b8a96:
if (iVar4 == 3) {
if (in_EAX[0x43c] != (CNetChan)0x0) goto LAB_001b8aa8;
LAB_001b8d95:
uVar3 = 0;
goto LAB_001b8abd;
}
if ((iVar4 == 4) && (*(int *)(in_EAX + 0x430) == 0)) {
iVar4 = NET_ReceiveStream(*(int *)(in_EAX + 0x90),local_220,4,0);
uVar7 = local_258;
if (iVar4 == 0) goto LAB_001b8ab8;
if (iVar4 == -1) goto LAB_001b8d95;
if (local_254 < 0x20) {
uVar7 = 0;
if (local_250 == local_24c) {
local_254 = 1;
local_258 = 0;
local_264 = '\x01';
uVar5 = local_258;
local_250 = local_250 + 1;
}
else if (local_24c < local_250) {
local_264 = '\x01';
local_258 = 0;
uVar5 = local_258;
}
else {
puVar1 = local_250 + 1;
uVar5 = *local_250;
local_250 = puVar1;
if (local_264 == '\0') {
uVar7 = ((&CBitBuffer::s_nMaskTable)[0x20 - local_254] & uVar5) <<
((byte)local_254 & 0x1f) | local_258;
uVar5 = uVar5 >> ((byte)(0x20 - local_254) & 0x1f);
}
}
}
else {
local_254 = local_254 + -0x20;
if (local_254 == 0) {
local_254 = 0x20;
if (local_250 == local_24c) {
local_254 = 1;
local_258 = 0;
uVar5 = local_258;
local_250 = local_250 + 1;
}
else {
if (local_24c < local_250) {
local_264 = '\x01';
goto LAB_001b8c4a;
}
uVar5 = *local_250;
local_250 = local_250 + 1;
}
}
else {
LAB_001b8c4a:
local_258 = 0;
uVar5 = local_258;
}
}
local_258 = uVar5;
*(uint *)(in_EAX + 0x430) = uVar7;
if (uVar7 == *(uint *)(**(int **)(in_EAX + 0xbc) + 0x114)) {
if (*(int *)(net_showtcp._28_4_ + 0x30) != 0) {
uVar3 = netadr_s::ToString((netadr_s *)(in_EAX + 0x98),false);
ConMsg("TCP <- %s: ACKN seq=%i\n",uVar3,uVar7);
}
RemoveHeadInWaitingList(in_EAX,0);
}
else {
uVar3 = *(undefined4 *)(in_EAX + 0x434);
uVar6 = netadr_s::ToString((netadr_s *)(in_EAX + 0x98),false);
ConMsg("TCP <- %s: invalid ACKN streamlen %d seqnr %i\n",uVar6,uVar3,uVar7);
}
(**(code **)(*(int *)in_EAX + 0x80))();
goto LAB_001b8ab8;
}
LAB_001b8aa8:
iVar4 = *(int *)(in_EAX + 0x434);
LAB_001b8aae:
iVar2 = *(int *)(in_EAX + 0x438);
if ((iVar2 < iVar4) &&
(iVar4 = NET_ReceiveStream(*(int *)(in_EAX + 0x90),(char *)(iVar2 + *(int *)(in_EAX + 0x540))
,iVar4 - iVar2,0), iVar4 != 0)) {
if (iVar4 == -1) goto LAB_001b8d95;
iVar4 = iVar4 + *(int *)(in_EAX + 0x438);
*(int *)(in_EAX + 0x438) = iVar4;
if (*(int *)(in_EAX + 0x434) < iVar4) {
ConMsg("ERROR! Stream indata oversize.");
uVar3 = 0;
goto LAB_001b8abd;
}
if (iVar4 == *(int *)(in_EAX + 0x434)) {
local_240 = 0;
local_244 = 0;
iVar2 = *(int *)(in_EAX + 0x430);
local_23c = 0xffffffff;
local_238 = 0;
CBitRead::StartReading((CBitRead *)&local_244,*(void **)(in_EAX + 0x540),iVar4,0,-1);
*(CNetChan **)(in_EAX + 0x423c) = in_EAX;
_ProcessMessages(in_EAX,(bf_read *)&local_244);
(**(code **)(*(int *)in_EAX + 0x80))();
uVar3 = SendReliableAcknowledge(in_EAX,iVar2);
goto LAB_001b8abd;
}
}
}
LAB_001b8ab8:
uVar3 = 1;
LAB_001b8abd:
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.