CUtlCachedFileData<CModelSoundsCache>::InitSmallBuffer
0x00622810 · 2319 bytes · __thiscall
_ZN18CUtlCachedFileDataI17CModelSoundsCacheE15InitSmallBufferERPviRb
Decompiled
undefined (4 params)
/* CUtlCachedFileData<CModelSoundsCache>::InitSmallBuffer(void*&, int, bool&) */
void __thiscall
CUtlCachedFileData<CModelSoundsCache>::InitSmallBuffer
(CUtlCachedFileData<CModelSoundsCache> *this,void **param_1,int param_2,bool *param_3)
{
char cVar1;
undefined4 uVar2;
uint uVar3;
int iVar4;
CModelSoundsCache *this_00;
int iVar5;
int *piVar6;
int in_GS_OFFSET;
int local_2d4;
int local_2d0;
int local_2cc;
int local_2c8;
int local_2c4;
int local_2c0;
int local_2bc;
int local_2b8;
undefined4 local_2b4;
undefined4 local_2b0;
undefined4 local_2ac;
CModelSoundsCache *local_2a8;
undefined4 local_2a4;
undefined4 local_2a0;
undefined4 local_29c;
undefined4 local_298;
undefined4 local_294;
int local_290 [3];
int local_284;
byte local_27b;
int local_270;
byte local_25c;
undefined4 local_258;
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_20 = *(int *)(in_GS_OFFSET + 0x14);
*param_3 = false;
CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_290,0,0,0);
/* try { // try from 00622883 to 00622af5 has its CatchHandler @ 006231a4 */
(**(code **)(*g_pFullFileSystem + 0x144))(g_pFullFileSystem,*param_1,local_290,0,0);
(**(code **)(g_pFullFileSystem[1] + 0xc))(g_pFullFileSystem + 1,*param_1);
local_2cc = 0;
CUtlBuffer::Get((CUtlBuffer *)local_290,&local_2cc,4);
if (local_2cc == 2) {
if ((local_27b & 1) == 0) {
cVar1 = CUtlBuffer::CheckGet((CUtlBuffer *)local_290,4);
if (cVar1 == '\0') {
iVar5 = 0;
}
else {
if ((local_25c & 1) == 0) {
iVar5 = *(int *)(local_290[0] + (local_284 - local_270));
}
else {
piVar6 = (int *)((local_284 - local_270) + local_290[0]);
if (piVar6 == (int *)0x0) {
piVar6 = &local_2c8;
}
local_2b4 = local_2c8;
local_2b4 = CONCAT31((int3)((uint)local_2c8 >> 8),*(undefined1 *)((int)piVar6 + 3));
local_2b4._2_2_ = (undefined2)((uint)local_2c8 >> 0x10);
local_2b4._0_2_ =
CONCAT11(*(undefined1 *)((int)piVar6 + 2),*(undefined1 *)((int)piVar6 + 3));
local_2b4._3_1_ = (undefined1)((uint)local_2c8 >> 0x18);
local_2b4._0_3_ = CONCAT12(*(undefined1 *)((int)piVar6 + 1),(undefined2)local_2b4);
local_2b4 = CONCAT13((char)*piVar6,(undefined3)local_2b4);
_V_memcpy(&local_2c8,&local_2b4,4);
iVar5 = local_2c8;
}
local_284 = local_284 + 4;
}
}
else {
local_2c8 = 0;
CUtlBuffer::Scanf((CUtlBuffer *)local_290,"%d",&local_2c8);
iVar5 = local_2c8;
}
if (*(int *)(this + 0x54) == iVar5) {
if ((local_27b & 1) == 0) {
/* try { // try from 00622d51 to 00622d55 has its CatchHandler @ 006231a4 */
cVar1 = CUtlBuffer::CheckGet((CUtlBuffer *)local_290,4);
if (cVar1 == '\0') {
iVar5 = 0;
}
else {
if ((local_25c & 1) == 0) {
iVar5 = *(int *)(local_290[0] + (local_284 - local_270));
}
else {
piVar6 = (int *)((local_284 - local_270) + local_290[0]);
if (piVar6 == (int *)0x0) {
piVar6 = &local_2c4;
}
local_2b0 = local_2c4;
local_2b0 = CONCAT31((int3)((uint)local_2c4 >> 8),*(undefined1 *)((int)piVar6 + 3));
local_2b0._2_2_ = (undefined2)((uint)local_2c4 >> 0x10);
local_2b0._0_2_ =
CONCAT11(*(undefined1 *)((int)piVar6 + 2),*(undefined1 *)((int)piVar6 + 3));
local_2b0._3_1_ = (undefined1)((uint)local_2c4 >> 0x18);
local_2b0._0_3_ = CONCAT12(*(undefined1 *)((int)piVar6 + 1),(undefined2)local_2b0);
local_2b0 = CONCAT13((char)*piVar6,(undefined3)local_2b0);
_V_memcpy(&local_2c4,&local_2b0,4);
iVar5 = local_2c4;
}
local_284 = local_284 + 4;
}
}
else {
local_2c4 = 0;
CUtlBuffer::Scanf((CUtlBuffer *)local_290,"%d",&local_2c4);
iVar5 = local_2c4;
}
if ((*(int *)(this + 0x58) == 0) || (*(int *)(this + 0x5c) == iVar5)) {
if ((local_27b & 1) == 0) {
cVar1 = CUtlBuffer::CheckGet((CUtlBuffer *)local_290,4);
if (cVar1 == '\0') {
local_2d4 = 0;
}
else {
if ((local_25c & 1) == 0) {
local_2d4 = *(int *)(local_290[0] + (local_284 - local_270));
}
else {
piVar6 = (int *)((local_284 - local_270) + local_290[0]);
if (piVar6 == (int *)0x0) {
piVar6 = &local_2c0;
}
local_258 = (void *)local_2c0;
local_258 = (void *)CONCAT31((int3)((uint)local_2c0 >> 8),
*(undefined1 *)((int)piVar6 + 3));
local_258._2_2_ = (undefined2)((uint)local_2c0 >> 0x10);
local_258._0_2_ =
CONCAT11(*(undefined1 *)((int)piVar6 + 2),*(undefined1 *)((int)piVar6 + 3));
local_258._3_1_ = (undefined1)((uint)local_2c0 >> 0x18);
local_258._0_3_ = CONCAT12(*(undefined1 *)((int)piVar6 + 1),(undefined2)local_258);
local_258 = (void *)CONCAT13((char)*piVar6,(undefined3)local_258);
_V_memcpy(&local_2c0,&local_258,4);
local_2d4 = local_2c0;
}
local_284 = local_284 + 4;
}
}
else {
local_2c0 = 0;
CUtlBuffer::Scanf((CUtlBuffer *)local_290,"%d",&local_2c0);
local_2d4 = local_2c0;
}
CUtlBuffer::CUtlBuffer((CUtlBuffer *)&local_258,0,0,0);
if (0 < local_2d4) {
local_2d0 = 0;
do {
if ((local_27b & 1) == 0) {
cVar1 = CUtlBuffer::CheckGet((CUtlBuffer *)local_290,4);
if (cVar1 == '\0') {
iVar5 = 0;
}
else {
if ((local_25c & 1) == 0) {
iVar5 = *(int *)(local_290[0] + (local_284 - local_270));
}
else {
piVar6 = (int *)((local_284 - local_270) + local_290[0]);
if (piVar6 == (int *)0x0) {
piVar6 = &local_2bc;
}
local_2ac = local_2bc;
local_2ac = CONCAT31((int3)((uint)local_2bc >> 8),*(undefined1 *)((int)piVar6 + 3)
);
local_2ac._2_2_ = (undefined2)((uint)local_2bc >> 0x10);
local_2ac._0_2_ =
CONCAT11(*(undefined1 *)((int)piVar6 + 2),*(undefined1 *)((int)piVar6 + 3));
local_2ac._3_1_ = (undefined1)((uint)local_2bc >> 0x18);
local_2ac._0_3_ = CONCAT12(*(undefined1 *)((int)piVar6 + 1),(undefined2)local_2ac)
;
local_2ac = CONCAT13((char)*piVar6,(undefined3)local_2ac);
_V_memcpy(&local_2bc,&local_2ac,4);
iVar5 = local_2bc;
}
local_284 = local_284 + 4;
}
}
else {
local_2bc = 0;
/* try { // try from 00622b3d to 00622cee has its CatchHandler @ 006231a0 */
CUtlBuffer::Scanf((CUtlBuffer *)local_290,"%d",&local_2bc);
iVar5 = local_2bc;
}
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,iVar5);
CUtlBuffer::Get((CUtlBuffer *)local_290,local_258,iVar5);
CUtlBuffer::SeekGet((CUtlBuffer *)&local_258,0,0);
CUtlBuffer::SeekPut((CUtlBuffer *)&local_258,0,iVar5);
CUtlBuffer::GetString((CUtlBuffer *)&local_258,local_220,0x200);
local_2a0 = 0;
local_29c = 0;
local_298 = 0xfffffffe;
local_294 = 0xffffffff;
local_2a0 = (**(code **)(*g_pFullFileSystem + 0x94))(g_pFullFileSystem,local_220);
uVar3 = 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_2a0);
uVar3 = uVar3 & 0xffff;
if (uVar3 == 0xffff) {
this_00 = ::operator_new(0x18);
/* try { // try from 00622e2d to 00622e31 has its CatchHandler @ 00623172 */
CModelSoundsCache::CModelSoundsCache(this_00);
local_2a8 = this_00;
/* try { // try from 00622e55 to 00622f8a has its CatchHandler @ 006231a0 */
uVar2 = CUtlVector<CModelSoundsCache*,CUtlMemory<CModelSoundsCache*,int>>::
InsertBefore((CUtlVector<CModelSoundsCache*,CUtlMemory<CModelSoundsCache*,int>>
*)(this + 0x20),*(int *)(this + 0x2c),&local_2a8);
uVar3 = 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_2a0);
uVar3 = uVar3 & 0xffff;
*(undefined4 *)(*(int *)(this + 8) + uVar3 * 0x18 + 0x14) = uVar2;
}
iVar5 = *(int *)(this + 8) + uVar3 * 0x18;
if ((local_243 & 1) == 0) {
/* try { // try from 00622dbb to 00622e23 has its CatchHandler @ 006231a0 */
cVar1 = CUtlBuffer::CheckGet((CUtlBuffer *)&local_258,4);
if (cVar1 != '\0') {
if ((local_224 & 1) == 0) {
iVar4 = *(int *)((int)local_258 + (local_24c - local_238));
}
else {
piVar6 = (int *)((local_24c - local_238) + (int)local_258);
if (piVar6 == (int *)0x0) {
piVar6 = &local_2b8;
}
local_2a4 = local_2b8;
local_2a4 = CONCAT31((int3)((uint)local_2b8 >> 8),*(undefined1 *)((int)piVar6 + 3)
);
local_2a4._2_2_ = (undefined2)((uint)local_2b8 >> 0x10);
local_2a4._0_2_ =
CONCAT11(*(undefined1 *)((int)piVar6 + 2),*(undefined1 *)((int)piVar6 + 3));
local_2a4._3_1_ = (undefined1)((uint)local_2b8 >> 0x18);
local_2a4._0_3_ = CONCAT12(*(undefined1 *)((int)piVar6 + 1),(undefined2)local_2a4)
;
local_2a4 = CONCAT13((char)*piVar6,(undefined3)local_2a4);
_V_memcpy(&local_2b8,&local_2a4,4);
iVar4 = local_2b8;
}
local_24c = local_24c + 4;
*(int *)(iVar5 + 0xc) = iVar4;
goto joined_r0x00622df7;
}
LAB_00622e07:
*(undefined4 *)(iVar5 + 0xc) = 0;
}
else {
local_2b8 = 0;
CUtlBuffer::Scanf((CUtlBuffer *)&local_258,"%d",&local_2b8);
*(int *)(iVar5 + 0xc) = local_2b8;
iVar4 = local_2b8;
joined_r0x00622df7:
if ((iVar4 == -1) && (*(int *)(this + 0x60) == 1)) goto LAB_00622e07;
}
piVar6 = *(int **)(*(int *)(this + 0x20) + *(int *)(iVar5 + 0x14) * 4);
(**(code **)(*piVar6 + 4))(piVar6,(CUtlBuffer *)&local_258);
local_2d0 = local_2d0 + 1;
} while (local_2d0 != local_2d4);
}
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)&local_258);
goto LAB_006228f1;
}
/* try { // try from 00622fb6 to 00623141 has its CatchHandler @ 006231a4 */
uVar2 = CUtlString::Get((CUtlString *)(this + 0x34));
Msg("Discarding repository \'%s\' due to meta checksum change\n",uVar2);
}
else {
uVar2 = CUtlString::Get((CUtlString *)(this + 0x34));
Msg("Discarding repository \'%s\' due to version change\n",uVar2);
}
}
else {
uVar2 = CUtlString::Get((CUtlString *)(this + 0x34));
DevMsg("Discarding repository \'%s\' due to cache system version change\n",uVar2);
}
*param_3 = true;
LAB_006228f1:
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_290);
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.