DownloadManager::Queue
0x0013d470 · 1054 bytes · __thiscall
_ZN15DownloadManager5QueueEPKcS1_
Decompiled
undefined (3 params)
/* DownloadManager::Queue(char const*, char const*) */
void __thiscall DownloadManager::Queue(DownloadManager *this,char *param_1,char *param_2)
{
code *pcVar1;
bool bVar2;
char cVar3;
int iVar4;
char *pcVar5;
undefined4 uVar6;
RequestContext *pRVar7;
byte bVar8;
RequestContext **local_30;
RequestContext *local_20 [4];
bVar8 = 0;
if ((param_2 != (char *)0x0) && (DAT_003b7f64 < 2)) {
if ((param_1 == (char *)0x0) ||
((iVar4 = V_strnicmp(param_1,"http://",7), iVar4 != 0 &&
(iVar4 = V_strnicmp(param_1,"https://",8), iVar4 != 0)))) {
bVar2 = false;
}
else {
bVar2 = true;
}
cVar3 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x28))(g_pFileSystem + 4,param_2,0);
if (((((((cVar3 == '\0') || (cVar3 = CL_ShouldRedownloadFile(param_2), cVar3 != '\0')) &&
(iVar4 = _V_strstr(param_2,"//"), iVar4 == 0)) &&
((iVar4 = _V_strstr(param_2,"\\\\"), iVar4 == 0 &&
(iVar4 = _V_strstr(param_2,":"), iVar4 == 0)))) &&
((iVar4 = _V_strstr(param_2,"lua/"), iVar4 == 0 &&
((iVar4 = _V_strstr(param_2,"gamemodes/"), iVar4 == 0 &&
(iVar4 = _V_strstr(param_2,"addons/"), iVar4 == 0)))))) &&
(pcVar5 = strstr(param_2,".."), pcVar5 == (char *)0x0)) &&
(cVar3 = CNetChan::IsValidFileForTransfer(param_2), cVar3 != '\0')) {
if (bVar2) {
pcVar1 = *(code **)(*(int *)(g_pFileSystem + 4) + 0x28);
uVar6 = va("%s.bz2",param_2);
cVar3 = (*pcVar1)(g_pFileSystem + 4,uVar6,0);
if (cVar3 == '\0') {
*(int *)(this + 0x30) = *(int *)(this + 0x30) + 1;
if (TheDownloadCache == (DownloadCache *)0x0) {
TheDownloadCache = operator_new(0x284);
*(undefined4 *)TheDownloadCache = 0;
DownloadCache::Init(TheDownloadCache);
}
local_20[0] = operator_new(0x530);
CUtlVector<RequestContext*,CUtlMemory<RequestContext*,int>>::InsertBefore
((CUtlVector<RequestContext*,CUtlMemory<RequestContext*,int>> *)this,
*(int *)(this + 0xc),local_20);
pRVar7 = local_20[0];
for (iVar4 = 0x14c; iVar4 != 0; iVar4 = iVar4 + -1) {
*(undefined4 *)pRVar7 = 0;
pRVar7 = pRVar7 + (uint)bVar8 * -8 + 4;
}
*(undefined4 *)(local_20[0] + 8) = 0;
V_strncpy((char *)(local_20[0] + 0x114),com_gamedir,0x100);
V_strncpy((char *)(local_20[0] + 0x214),param_2,0x100);
V_strncat((char *)(local_20[0] + 0x214),".bz2",0x100,-1);
V_FixSlashes((char *)(local_20[0] + 0x214),'/');
local_20[0][2] = (RequestContext)0x1;
local_20[0][3] = (RequestContext)0x1;
V_strncpy((char *)(local_20[0] + 0x14),param_1,0x100);
V_strncat((char *)(local_20[0] + 0x14),"/",0x100,-1);
}
}
local_30 = local_20;
*(int *)(this + 0x30) = *(int *)(this + 0x30) + 1;
if (TheDownloadCache == (DownloadCache *)0x0) {
TheDownloadCache = operator_new(0x284);
*(undefined4 *)TheDownloadCache = 0;
DownloadCache::Init(TheDownloadCache);
}
local_20[0] = operator_new(0x530);
CUtlVector<RequestContext*,CUtlMemory<RequestContext*,int>>::InsertBefore
((CUtlVector<RequestContext*,CUtlMemory<RequestContext*,int>> *)this,
*(int *)(this + 0xc),local_30);
pRVar7 = local_20[0];
for (iVar4 = 0x14c; iVar4 != 0; iVar4 = iVar4 + -1) {
*(undefined4 *)pRVar7 = 0;
pRVar7 = pRVar7 + (uint)bVar8 * -8 + 4;
}
*(undefined4 *)(local_20[0] + 8) = 0;
V_strncpy((char *)(local_20[0] + 0x114),com_gamedir,0x100);
V_strncpy((char *)(local_20[0] + 0x214),param_2,0x100);
V_FixSlashes((char *)(local_20[0] + 0x214),'/');
if (bVar2) {
local_20[0][3] = (RequestContext)0x1;
V_strncpy((char *)(local_20[0] + 0x14),param_1,0x100);
V_strncat((char *)(local_20[0] + 0x14),"/",0x100,-1);
}
else {
local_20[0][3] = (RequestContext)0x0;
}
}
}
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.