CNetChan::CreateFragmentsFromFile
0x001b44a0 · 550 bytes · __cdecl
_ZN8CNetChan23CreateFragmentsFromFileEPKcijb
Decompiled
undefined (4 params)
/* CNetChan::CreateFragmentsFromFile(char const*, int, unsigned int, bool) */
undefined4 CNetChan::CreateFragmentsFromFile(char *param_1,int param_2,uint param_3,bool param_4)
{
char cVar1;
undefined4 uVar2;
int iVar3;
undefined4 uVar4;
dataFragments_s *pdVar5;
undefined3 in_stack_00000011;
dataFragments_s *local_20 [4];
uVar2 = IsFileInWaitingList((CNetChan *)param_1,(char *)param_2);
if ((char)uVar2 == '\0') {
cVar1 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x28))
(g_pFileSystem + 4,param_2,&DAT_002a076d);
if (cVar1 == '\0') {
ConMsg("CreateFragmentsFromFile: \'%s\' doesn\'t exist.\n",param_2);
return uVar2;
}
iVar3 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x1c))
(g_pFileSystem + 4,param_2,&DAT_002a076d);
if (iVar3 < *(int *)(net_maxfilesize._28_4_ + 0x30) * 0x100000) {
if (iVar3 < 0x3ffffff) {
uVar4 = IsValidFileForTransfer((char *)param_2);
if ((char)uVar4 == '\0') {
Msg("CreateFragmentsFromFile: \'%s\' invalid file for transfer\n",param_2);
}
else {
pdVar5 = operator_new(0x130);
*(int *)(pdVar5 + 0x10c) = iVar3;
*(int *)(pdVar5 + 0x110) = iVar3 << 3;
*(int *)(pdVar5 + 0x108) = 0;
pdVar5[0x118] = (dataFragments_s)0x0;
*(int *)(pdVar5 + 0x11c) = 0;
local_20[0] = pdVar5;
iVar3 = (**(code **)(*(int *)(g_pFileSystem + 4) + 8))
(g_pFileSystem + 4,param_2,&DAT_002a3e98,&DAT_002a076d);
*(int *)pdVar5 = iVar3;
if (*(int *)local_20[0] == 0) {
ConMsg("CreateFragmentsFromFile: couldn\'t open \'%s\'.\n",param_2);
operator_delete(local_20[0]);
}
else {
*(int *)(local_20[0] + 0x114) = _param_4;
V_strncpy((char *)(local_20[0] + 4),(char *)param_2,0x104);
CUtlVector<CNetChan::dataFragments_s*,CUtlMemory<CNetChan::dataFragments_s*,int>>::
InsertBefore((CUtlVector<CNetChan::dataFragments_s*,CUtlMemory<CNetChan::dataFragments_s*,int>>
*)(param_1 + param_3 * 0x14 + 0xbc),
*(int *)((CUtlVector<CNetChan::dataFragments_s*,CUtlMemory<CNetChan::dataFragments_s*,int>>
*)(param_1 + param_3 * 0x14 + 0xbc) + 0xc),local_20);
local_20[0][0x120] = (dataFragments_s)0x0;
*(int *)(local_20[0] + 0x128) = 0;
*(int *)(local_20[0] + 300) = 0;
*(uint *)(local_20[0] + 0x124) = *(int *)(local_20[0] + 0x10c) + 0xffU >> 8;
uVar2 = uVar4;
}
}
}
else {
ConMsg("CreateFragmentsFromFile: \'%s\' too big (max %i bytes).\n",param_2,0x3ffffff);
}
}
else {
ConMsg("CreateFragmentsFromFile: \'%s\' size exceeds net_maxfilesize limit (%i MB).\n",param_2
,*(int *)(net_maxfilesize._28_4_ + 0x30));
}
}
return uVar2;
}
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.