CUtlCachedFileData<CModelSoundsCache>::Save
0x0061bb90 · 1455 bytes · __thiscall
_ZN18CUtlCachedFileDataI17CModelSoundsCacheE4SaveEv
Decompiled
undefined (1 param)
/* CUtlCachedFileData<CModelSoundsCache>::Save() */
void __thiscall
CUtlCachedFileData<CModelSoundsCache>::Save(CUtlCachedFileData<CModelSoundsCache> *this)
{
CUtlString *this_00;
int iVar1;
code *pcVar2;
undefined4 *puVar3;
uint uVar4;
char cVar5;
ushort uVar6;
char *pcVar7;
undefined4 uVar8;
int iVar9;
void *pvVar10;
int in_GS_OFFSET;
int local_490;
undefined4 local_488;
uint local_484;
undefined4 local_480;
undefined4 local_47c;
uint local_478;
int local_474;
undefined4 local_470;
undefined4 local_46c;
int local_468;
int local_464;
undefined4 local_460;
char local_45c;
int local_458 [4];
int local_448;
byte local_443;
int local_438;
byte local_424;
char local_420 [512];
char local_220 [512];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
this_00 = (CUtlString *)(this + 0x34);
pcVar7 = (char *)CUtlString::Get(this_00);
V_strncpy(local_420,pcVar7,0x200);
V_StripFilename(local_420);
(**(code **)(*g_pFullFileSystem + 0x48))(g_pFullFileSystem,local_420,&DAT_00c146f4);
pcVar2 = *(code **)(g_pFullFileSystem[1] + 0x28);
uVar8 = CUtlString::Get(this_00);
cVar5 = (*pcVar2)(g_pFullFileSystem + 1,uVar8,&DAT_00c146f4);
if (cVar5 != '\0') {
pcVar2 = *(code **)(g_pFullFileSystem[1] + 0x2c);
uVar8 = CUtlString::Get(this_00);
cVar5 = (*pcVar2)(g_pFullFileSystem + 1,uVar8,&DAT_00c146f4);
if (cVar5 == '\0') {
pcVar2 = *(code **)(g_pFullFileSystem[1] + 0x30);
uVar8 = CUtlString::Get(this_00);
(*pcVar2)(g_pFullFileSystem + 1,uVar8,1,&DAT_00c146f4);
}
}
pcVar2 = *(code **)(g_pFullFileSystem[1] + 8);
uVar8 = CUtlString::Get(this_00);
iVar9 = (*pcVar2)(g_pFullFileSystem + 1,uVar8,&DAT_00c5cbad,0);
if (iVar9 == 0) {
uVar8 = CUtlString::Get(this_00);
Warning("Unable to persist cache \'%s\', check file permissions\n",uVar8);
}
else {
this[100] = (CUtlCachedFileData<CModelSoundsCache>)((byte)this[100] & 0xf7);
local_488 = 2;
(**(code **)(g_pFullFileSystem[1] + 4))(g_pFullFileSystem + 1,&local_488,4,iVar9);
local_488 = *(undefined4 *)(this + 0x54);
(**(code **)(g_pFullFileSystem[1] + 4))(g_pFullFileSystem + 1,&local_488,4,iVar9);
local_488 = *(undefined4 *)(this + 0x5c);
(**(code **)(g_pFullFileSystem[1] + 4))(g_pFullFileSystem + 1,&local_488,4,iVar9);
local_484 = (uint)*(ushort *)(this + 0x16);
(**(code **)(g_pFullFileSystem[1] + 4))(g_pFullFileSystem + 1,&local_484,4,iVar9);
CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_458,0,0,0);
local_45c = '\0';
local_474 = 0;
local_470 = 0;
local_46c = 0;
local_468 = 0;
local_464 = 0;
local_460 = 0;
uVar6 = CUtlRBTree<CUtlCachedFileData<CModelSoundsCache>::ElementType_t,unsigned_short,bool(*)(CUtlCachedFileData<CModelSoundsCache>::ElementType_t_const&,CUtlCachedFileData<CModelSoundsCache>::ElementType_t_const&),CUtlMemory<UtlRBTreeNode_t<CUtlCachedFileData<CModelSoundsCache>::ElementType_t,unsigned_short>,unsigned_short>>
::FirstInorder((CUtlRBTree<CUtlCachedFileData<CModelSoundsCache>::ElementType_t,unsigned_short,bool(*)(CUtlCachedFileData<CModelSoundsCache>::ElementType_t_const&,CUtlCachedFileData<CModelSoundsCache>::ElementType_t_const&),CUtlMemory<UtlRBTreeNode_t<CUtlCachedFileData<CModelSoundsCache>::ElementType_t,unsigned_short>,unsigned_short>>
*)(this + 4));
uVar4 = local_478;
while (local_478 = (uint)uVar6, local_478 != 0xffff) {
local_47c = *(int *)(*(int *)(this + 8) + local_478 * 0x18 + 8);
/* try { // try from 0061bddb to 0061c04a has its CatchHandler @ 0061c14f */
CUtlSortVector<CSortedCacheFile,CSortedCacheFile>::InsertNoSort
((CUtlSortVector<CSortedCacheFile,CSortedCacheFile> *)&local_474,
(CSortedCacheFile *)&local_47c);
uVar6 = CUtlRBTree<CUtlCachedFileData<CModelSoundsCache>::ElementType_t,unsigned_short,bool(*)(CUtlCachedFileData<CModelSoundsCache>::ElementType_t_const&,CUtlCachedFileData<CModelSoundsCache>::ElementType_t_const&),CUtlMemory<UtlRBTreeNode_t<CUtlCachedFileData<CModelSoundsCache>::ElementType_t,unsigned_short>,unsigned_short>>
::NextInorder((CUtlRBTree<CUtlCachedFileData<CModelSoundsCache>::ElementType_t,unsigned_short,bool(*)(CUtlCachedFileData<CModelSoundsCache>::ElementType_t_const&,CUtlCachedFileData<CModelSoundsCache>::ElementType_t_const&),CUtlMemory<UtlRBTreeNode_t<CUtlCachedFileData<CModelSoundsCache>::ElementType_t,unsigned_short>,unsigned_short>>
*)(this + 4),uVar6);
uVar4 = local_478;
}
local_478 = uVar4;
if (local_45c != '\0') {
/* try { // try from 0061c123 to 0061c127 has its CatchHandler @ 0061c14f */
CUtlSortVector<CSortedCacheFile,CSortedCacheFile>::RedoSort(SUB41(&local_474,0));
}
if (0 < local_468) {
local_490 = 0;
do {
iVar1 = *(int *)(this + 8) + (uint)*(ushort *)(local_474 + 4 + local_490 * 8) * 0x18;
CUtlBuffer::SeekPut((CUtlBuffer *)local_458,0,0);
(**(code **)(*g_pFullFileSystem + 0x98))(g_pFullFileSystem,iVar1 + 8,local_220,0x200);
CUtlBuffer::PutString((CUtlBuffer *)local_458,local_220);
uVar8 = *(undefined4 *)(iVar1 + 0xc);
if ((local_443 & 1) == 0) {
local_480 = uVar8;
cVar5 = CUtlBuffer::CheckPut((CUtlBuffer *)local_458,4);
if (cVar5 != '\0') {
if ((local_424 & 1) == 0) {
*(undefined4 *)(local_458[0] + (local_448 - local_438)) = uVar8;
}
else {
pvVar10 = (void *)((local_448 - local_438) + local_458[0]);
if (pvVar10 != (void *)0x0) {
local_47c = CONCAT13((undefined1)local_480,
CONCAT12(local_480._1_1_,
CONCAT11(local_480._2_1_,local_480._3_1_)));
_V_memcpy(pvVar10,&local_47c,4);
}
}
local_448 = local_448 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_458);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)local_458,"%d",uVar8);
}
puVar3 = *(undefined4 **)(*(int *)(this + 0x20) + *(int *)(iVar1 + 0x14) * 4);
(**(code **)*puVar3)(puVar3,(CUtlBuffer *)local_458);
local_47c = local_448;
(**(code **)(g_pFullFileSystem[1] + 4))(g_pFullFileSystem + 1,&local_47c,4,iVar9);
(**(code **)(g_pFullFileSystem[1] + 4))(g_pFullFileSystem + 1,local_458[0],local_47c,iVar9);
local_490 = local_490 + 1;
} while (local_490 < local_468);
}
(**(code **)(g_pFullFileSystem[1] + 0xc))(g_pFullFileSystem + 1,iVar9);
local_468 = 0;
CUtlMemory<CSortedCacheFile,int>::Purge((CUtlMemory<CSortedCacheFile,int> *)&local_474);
local_464 = local_474;
CUtlMemory<CSortedCacheFile,int>::Purge((CUtlMemory<CSortedCacheFile,int> *)&local_474);
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_458);
}
if (((byte)this[100] & 4) != 0) {
SaveManifest(this);
}
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.