DownloadCache::PersistToDisk
0x0013ca60 · 635 bytes · __thiscall
_ZN13DownloadCache13PersistToDiskEPK14RequestContext
Decompiled
undefined (2 params)
/* DownloadCache::PersistToDisk(RequestContext const*) */
void __thiscall DownloadCache::PersistToDisk(DownloadCache *this,RequestContext *param_1)
{
char cVar1;
IBaseFileSystem *pIVar2;
char *pcVar3;
int iVar4;
KeyValues *pKVar5;
int in_GS_OFFSET;
RequestContext *local_1130;
char local_1124 [260];
char local_1020 [4096];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
pKVar5 = *(KeyValues **)this;
if (pKVar5 == (KeyValues *)0x0) goto LAB_0013cac7;
if (((param_1 != (RequestContext *)0x0) && (*(int *)(param_1 + 0x520) != 0)) &&
(*(int *)(param_1 + 0x514) != 0)) {
if (param_1[2] == (RequestContext)0x0) {
V_strncpy(local_1124,(char *)(param_1 + 0x214),0x104);
}
else {
V_StripExtension((char *)(param_1 + 0x214),local_1124,0x104);
}
local_1130 = param_1 + 0x214;
cVar1 = (**(code **)(g_pFileSystem[1] + 0x28))(g_pFileSystem + 1,local_1124,0);
if (cVar1 == '\0') {
pcVar3 = (char *)CloneString(local_1124);
COM_CreatePath(pcVar3);
if (pcVar3 != (char *)0x0) {
operator_delete__(pcVar3);
}
if (param_1[2] == (RequestContext)0x0) {
iVar4 = (**(code **)(g_pFileSystem[1] + 8))(g_pFileSystem + 1,local_1124,&DAT_002a5c80,0);
if (iVar4 == 0) goto LAB_0013cb35;
(**(code **)(g_pFileSystem[1] + 4))
(g_pFileSystem + 1,*(undefined4 *)(param_1 + 0x520),
*(undefined4 *)(param_1 + 0x514),iVar4);
(**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,iVar4);
}
else {
cVar1 = DecompressBZipToDisk
(local_1124,(char *)local_1130,*(char **)(param_1 + 0x520),
*(int *)(param_1 + 0x514));
if (cVar1 == '\0') {
pKVar5 = *(KeyValues **)this;
goto LAB_0013ca9b;
}
}
GetCacheFilename(this,param_1,local_1020);
if (local_1020[0] != '\0') {
(**(code **)(*g_pFileSystem + 0x40))(g_pFileSystem,local_1020,0);
}
BuildKeyNames(this,(char *)local_1130);
pKVar5 = (KeyValues *)KeyValues::FindKey(*(KeyValues **)this,(char *)(this + 4),false);
if (pKVar5 != (KeyValues *)0x0) {
KeyValues::RemoveSubKey(*(KeyValues **)this,pKVar5);
}
pKVar5 = (KeyValues *)KeyValues::FindKey(*(KeyValues **)this,(char *)(this + 0x144),false);
if (pKVar5 != (KeyValues *)0x0) {
KeyValues::RemoveSubKey(*(KeyValues **)this,pKVar5);
pKVar5 = *(KeyValues **)this;
goto LAB_0013ca9b;
}
}
LAB_0013cb35:
pKVar5 = *(KeyValues **)this;
}
LAB_0013ca9b:
pIVar2 = (IBaseFileSystem *)0x0;
if (g_pFileSystem != (int *)0x0) {
pIVar2 = (IBaseFileSystem *)(g_pFileSystem + 1);
}
KeyValues::SaveToFile(pKVar5,pIVar2,"cache/DownloadCache.db",(char *)0x0);
LAB_0013cac7:
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.