CNetChan::SetMaxBufferSize
0x001b2670 · 398 bytes · __thiscall
_ZN8CNetChan16SetMaxBufferSizeEbib
Decompiled
undefined (4 params)
/* CNetChan::SetMaxBufferSize(bool, int, bool) */
void __thiscall CNetChan::SetMaxBufferSize(CNetChan *this,bool param_1,int param_2,bool param_3)
{
int iVar1;
size_t sVar2;
void *pvVar3;
int iVar4;
size_t __size;
CUtlMemory<unsigned_char,int> *this_00;
int in_GS_OFFSET;
bf_write *local_fd0;
undefined1 local_fc0 [4000];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
sVar2 = 4000;
if (3999 < param_2) {
sVar2 = param_2;
}
__size = 0x37aa0;
if ((int)sVar2 < 0x37aa1) {
__size = sVar2;
}
if (param_1) {
local_fd0 = (bf_write *)(this + 0x20);
this_00 = (CUtlMemory<unsigned_char,int> *)(this + 0x38);
}
else if (param_3) {
local_fd0 = (bf_write *)(this + 0x68);
this_00 = (CUtlMemory<unsigned_char,int> *)(this + 0x80);
}
else {
local_fd0 = (bf_write *)(this + 0x44);
this_00 = (CUtlMemory<unsigned_char,int> *)(this + 0x5c);
}
if (*(size_t *)(this_00 + 4) != __size) {
iVar1 = *(int *)(local_fd0 + 0xc);
iVar4 = iVar1 + 7 >> 3;
if (iVar4 < (int)__size) {
if (0 < iVar1) {
_V_memcpy(local_fc0,*(void **)this_00,iVar4);
}
CUtlMemory<unsigned_char,int>::Purge(this_00);
if ((*(int *)(this_00 + 4) < (int)__size) && (-1 < *(int *)(this_00 + 8))) {
*(size_t *)(this_00 + 4) = __size;
if (*(void **)this_00 == (void *)0x0) {
pvVar3 = malloc(__size);
*(void **)this_00 = pvVar3;
}
else {
pvVar3 = realloc(*(void **)this_00,__size);
*(void **)this_00 = pvVar3;
}
}
else {
pvVar3 = *(void **)this_00;
}
if (0 < iVar1) {
_V_memcpy(pvVar3,local_fc0,iVar4);
pvVar3 = *(void **)this_00;
}
bf_write::StartWriting(local_fd0,pvVar3,__size,iVar1,-1);
}
else {
ConMsg("CNetChan::SetMaxBufferSize: cant preserve exiting data %i>%i.\n",iVar4,__size);
}
}
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.