CModelLoader::FindModel
0x0019e220 · 361 bytes · __thiscall
_ZN12CModelLoader9FindModelEPKc
Decompiled
undefined (2 params)
/* CModelLoader::FindModel(char const*) */
undefined4 * __thiscall CModelLoader::FindModel(CModelLoader *this,char *param_1)
{
char cVar1;
ushort uVar2;
undefined4 uVar3;
CMapReslistGenerator *this_00;
long lVar4;
int iVar5;
undefined4 *puVar6;
byte bVar7;
undefined4 *local_30;
undefined4 local_24;
undefined4 *local_20;
bVar7 = 0;
if ((param_1 == (char *)0x0) || (cVar1 = *param_1, cVar1 == '\0')) {
Sys_Error("CModelLoader::FindModel: NULL name");
cVar1 = *param_1;
}
if (cVar1 == '*') {
lVar4 = strtol(param_1 + 1,(char **)0x0,10);
if (*(int *)(this + 100) == 0) {
Sys_Error("bad inline model number %i, worldmodel not yet setup",lVar4);
}
if (((lVar4 < 1) || (*(int *)(this + 100) == 0)) || (*(int *)(this + 0x68) <= lVar4)) {
Sys_Error("bad inline model number %i",lVar4);
}
return (undefined4 *)(lVar4 * 0x14c + *(int *)(this + 0x50));
}
uVar3 = (**(code **)(*g_pFileSystem + 0x94))(g_pFileSystem,param_1);
local_24 = uVar3;
uVar2 = CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Find((CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
*)(this + 4),(Node_t *)&local_24);
if (uVar2 == 0xffff) {
local_30 = (undefined4 *)CUtlMemoryPool::Alloc((CUtlMemoryPool *)(this + 0x20));
puVar6 = local_30;
for (iVar5 = 0x53; iVar5 != 0; iVar5 = iVar5 + -1) {
*puVar6 = 0;
puVar6 = puVar6 + (uint)bVar7 * -2 + 1;
}
*local_30 = uVar3;
V_strncpy((char *)(local_30 + 1),param_1,0x104);
V_RemoveDotSlashes((char *)(local_30 + 1),'/');
local_24 = uVar3;
local_20 = local_30;
CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Insert((CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
*)(this + 4),(Node_t *)&local_24);
}
else {
local_30 = *(undefined4 **)((uint)uVar2 * 0x10 + *(int *)(this + 8) + 0xc);
}
this_00 = (CMapReslistGenerator *)MapReslistGenerator();
CMapReslistGenerator::OnModelPrecached(this_00,param_1);
return local_30;
}
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.