CUtlCachedFileData<CModelSoundsCache>::InitLargeBuffer
0x00621b40 · 1469 bytes · __thiscall
_ZN18CUtlCachedFileDataI17CModelSoundsCacheE15InitLargeBufferERPvRb
Decompiled
undefined (3 params)
/* CUtlCachedFileData<CModelSoundsCache>::InitLargeBuffer(void*&, bool&) */
void __thiscall
CUtlCachedFileData<CModelSoundsCache>::InitLargeBuffer
(CUtlCachedFileData<CModelSoundsCache> *this,void **param_1,bool *param_2)
{
int iVar1;
char cVar2;
undefined4 uVar3;
uint uVar4;
int iVar5;
CModelSoundsCache *this_00;
int *piVar6;
int in_GS_OFFSET;
int local_290;
int local_288;
int local_284;
int local_280;
int local_27c;
int local_278;
int local_274;
CModelSoundsCache *local_270;
undefined4 local_26c;
undefined4 local_268;
undefined4 local_264;
undefined4 local_260;
undefined4 local_25c;
int local_258 [3];
int local_24c;
undefined4 local_248;
undefined1 local_244;
byte local_243;
undefined4 local_23c;
int local_238;
byte local_224;
char local_220 [512];
int local_20;
local_288 = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
*param_2 = false;
(**(code **)g_pFullFileSystem[1])(g_pFullFileSystem + 1,&local_288,4,*param_1);
if (local_288 == 2) {
local_284 = 0;
(**(code **)g_pFullFileSystem[1])(g_pFullFileSystem + 1,&local_284,4,*param_1);
if (*(int *)(this + 0x54) == local_284) {
local_280 = 0;
(**(code **)g_pFullFileSystem[1])(g_pFullFileSystem + 1,&local_280,4,*param_1);
if ((*(int *)(this + 0x58) == 0) || (*(int *)(this + 0x5c) == local_280)) {
local_27c = 0;
(**(code **)g_pFullFileSystem[1])(g_pFullFileSystem + 1,&local_27c,4,*param_1);
CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_258,0,0,0);
if (0 < local_27c) {
local_290 = 0;
do {
local_278 = 0;
(**(code **)g_pFullFileSystem[1])(g_pFullFileSystem + 1,&local_278,4,*param_1);
if (1000000 < local_278) {
uVar3 = CUtlString::Get((CUtlString *)(this + 0x34));
Msg("Discarding repository \'%s\' due to corruption\n",uVar3);
*param_2 = true;
break;
}
local_24c = 0;
local_248 = 0;
local_244 = 0;
local_238 = 0;
local_23c = 0xffffffff;
CUtlBuffer::AddNullTermination((CUtlBuffer *)local_258);
CUtlBuffer::EnsureCapacity((CUtlBuffer *)local_258,local_278);
uVar3 = (**(code **)g_pFullFileSystem[1])
(g_pFullFileSystem + 1,local_258[0],local_278,*param_1);
CUtlBuffer::SeekGet((CUtlBuffer *)local_258,0,0);
CUtlBuffer::SeekPut((CUtlBuffer *)local_258,0,uVar3);
CUtlBuffer::GetString((CUtlBuffer *)local_258,local_220,0x200);
local_268 = 0;
local_264 = 0;
local_260 = 0xfffffffe;
local_25c = 0xffffffff;
local_268 = (**(code **)(*g_pFullFileSystem + 0x94))(g_pFullFileSystem,local_220);
uVar4 = 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>>
::Find((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),(ElementType_t *)&local_268);
uVar4 = uVar4 & 0xffff;
if (uVar4 == 0xffff) {
this_00 = ::operator_new(0x18);
/* try { // try from 00621ff5 to 00621ff9 has its CatchHandler @ 0062213d */
CModelSoundsCache::CModelSoundsCache(this_00);
local_270 = this_00;
/* try { // try from 0062201d to 006220f2 has its CatchHandler @ 00622125 */
uVar3 = CUtlVector<CModelSoundsCache*,CUtlMemory<CModelSoundsCache*,int>>::
InsertBefore((CUtlVector<CModelSoundsCache*,CUtlMemory<CModelSoundsCache*,int>>
*)(this + 0x20),*(int *)(this + 0x2c),&local_270);
uVar4 = 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>>
::Insert((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),(ElementType_t *)&local_268);
uVar4 = uVar4 & 0xffff;
*(undefined4 *)(*(int *)(this + 8) + uVar4 * 0x18 + 0x14) = uVar3;
}
iVar1 = *(int *)(this + 8) + uVar4 * 0x18;
if ((local_243 & 1) == 0) {
cVar2 = CUtlBuffer::CheckGet((CUtlBuffer *)local_258,4);
if (cVar2 != '\0') {
if ((local_224 & 1) == 0) {
iVar5 = *(int *)(local_258[0] + (local_24c - local_238));
}
else {
piVar6 = (int *)((local_24c - local_238) + local_258[0]);
if (piVar6 == (int *)0x0) {
piVar6 = &local_274;
}
local_26c = local_274;
local_26c = CONCAT31((int3)((uint)local_274 >> 8),*(undefined1 *)((int)piVar6 + 3)
);
local_26c._2_2_ = (undefined2)((uint)local_274 >> 0x10);
local_26c._0_2_ =
CONCAT11(*(undefined1 *)((int)piVar6 + 2),*(undefined1 *)((int)piVar6 + 3));
local_26c._3_1_ = (undefined1)((uint)local_274 >> 0x18);
local_26c._0_3_ = CONCAT12(*(undefined1 *)((int)piVar6 + 1),(undefined2)local_26c)
;
local_26c = CONCAT13((char)*piVar6,(undefined3)local_26c);
_V_memcpy(&local_274,&local_26c,4);
iVar5 = local_274;
}
local_24c = local_24c + 4;
*(int *)(iVar1 + 0xc) = iVar5;
goto joined_r0x00621d96;
}
LAB_00621fcc:
*(undefined4 *)(iVar1 + 0xc) = 0;
}
else {
local_274 = 0;
/* try { // try from 00621d85 to 00621feb has its CatchHandler @ 00622125 */
CUtlBuffer::Scanf((CUtlBuffer *)local_258,"%d",&local_274);
*(int *)(iVar1 + 0xc) = local_274;
iVar5 = local_274;
joined_r0x00621d96:
if ((iVar5 == -1) && (*(int *)(this + 0x60) == 1)) goto LAB_00621fcc;
}
piVar6 = *(int **)(*(int *)(this + 0x20) + *(int *)(iVar1 + 0x14) * 4);
(**(code **)(*piVar6 + 4))(piVar6,local_258);
local_290 = local_290 + 1;
} while (local_290 < local_27c);
}
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_258);
}
else {
uVar3 = CUtlString::Get((CUtlString *)(this + 0x34));
Msg("Discarding repository \'%s\' due to meta checksum change\n",uVar3);
*param_2 = true;
}
}
else {
uVar3 = CUtlString::Get((CUtlString *)(this + 0x34));
Msg("Discarding repository \'%s\' due to version change\n",uVar3);
*param_2 = true;
}
}
else {
uVar3 = CUtlString::Get((CUtlString *)(this + 0x34));
DevMsg("Discarding repository \'%s\' due to cache system version change\n",uVar3);
*param_2 = true;
}
(**(code **)(g_pFullFileSystem[1] + 0xc))(g_pFullFileSystem + 1,*param_1);
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.