CModelLoader::Studio_LoadModel
0x0019ab80 · 772 bytes · __thiscall
_ZN12CModelLoader16Studio_LoadModelEP7model_tb
Decompiled
undefined (3 params)
/* CModelLoader::Studio_LoadModel(model_t*, bool) */
void __thiscall CModelLoader::Studio_LoadModel(CModelLoader *this,model_t *param_1,bool param_2)
{
uint uVar1;
code *pcVar2;
int *piVar3;
char cVar4;
char cVar5;
undefined2 uVar6;
uint uVar7;
undefined4 uVar8;
undefined4 uVar9;
int iVar10;
int iVar11;
longdouble lVar12;
longdouble lVar13;
undefined4 local_22c;
undefined4 local_21c [131];
if (*(int *)(mod_touchalldata._28_4_ + 0x30) == 0) {
param_2 = false;
}
uVar1 = *(uint *)(param_1 + 0x108);
*(uint *)(param_1 + 0x108) = uVar1 & 0xfffeffff | 1;
uVar7 = uVar1 >> 0x10 & 1;
cVar4 = (char)uVar7;
if (uVar7 == 0) {
uVar6 = (**(code **)(*g_pMDLCache + 0x18))(g_pMDLCache,param_1 + 4);
piVar3 = g_pMDLCache;
*(undefined2 *)(param_1 + 0x134) = uVar6;
(**(code **)(*piVar3 + 0x4c))(piVar3,uVar6,param_1);
InitStudioModelState(param_1);
}
uVar8 = (**(code **)(*g_pMDLCache + 0x28))(g_pMDLCache,*(undefined2 *)(param_1 + 0x134));
if ((*(int *)(phys2_preload_models._28_4_ + 0x30) != 0) && (g_pPhysics2 != (int *)0x0)) {
pcVar2 = *(code **)(*g_pPhysics2 + 0x70);
uVar9 = (**(code **)(*g_pMDLCache + 0x60))(g_pMDLCache,*(undefined2 *)(param_1 + 0x134));
cVar5 = (*pcVar2)(g_pPhysics2,uVar9);
if (cVar5 != '\0') {
if (g_pPhysics2ResourceManager != (int *)0x0) {
local_22c = (**(code **)(*g_pPhysics2ResourceManager + 0x58))(g_pPhysics2ResourceManager);
(**(code **)(*g_pPhysics2ResourceManager + 0x54))(g_pPhysics2ResourceManager,param_1 + 4);
}
/* try { // try from 0019ac9a to 0019ac9c has its CatchHandler @ 0019ae84 */
(**(code **)(*g_pMDLCache + 0x34))(g_pMDLCache,*(undefined2 *)(param_1 + 0x134),1);
if (g_pPhysics2ResourceManager != (int *)0x0) {
(**(code **)(*g_pPhysics2ResourceManager + 0x54))(g_pPhysics2ResourceManager,local_22c);
}
}
}
if ((cVar4 == '\0') && (uVar1 != 0x10)) {
lVar12 = (longdouble)Plat_FloatTime();
(**(code **)(*g_pMDLCache + 0x78))(g_pMDLCache,*(undefined2 *)(param_1 + 0x134),param_2);
lVar13 = (longdouble)Plat_FloatTime();
if (param_2 == false) {
g_flAccumulatedModelLoadTimeVCollideAsync =
((double)lVar13 + g_flAccumulatedModelLoadTimeVCollideAsync) - (double)lVar12;
}
else {
g_flAccumulatedModelLoadTimeVCollideSync =
((double)lVar13 + g_flAccumulatedModelLoadTimeVCollideSync) - (double)lVar12;
}
}
lVar12 = (longdouble)Plat_FloatTime();
iVar10 = (**(code **)(*g_pStudioRender + 0xa0))(g_pStudioRender,uVar8,0x80,local_21c);
if (iVar10 < 1) {
if (iVar10 == 0) goto LAB_0019ad2f;
}
else {
iVar11 = 0;
do {
piVar3 = (int *)local_21c[iVar11];
iVar11 = iVar11 + 1;
(**(code **)(*piVar3 + 0x30))(piVar3);
} while (iVar11 != iVar10);
}
*(uint *)(param_1 + 0x108) = *(uint *)(param_1 + 0x108) | 0x20000;
LAB_0019ad2f:
lVar13 = (longdouble)Plat_FloatTime();
g_flAccumulatedModelLoadTimeMaterialNamesOnly =
(g_flAccumulatedModelLoadTimeMaterialNamesOnly - (double)lVar12) + (double)lVar13;
if ((param_2 == false) && (cVar4 == '\0')) {
return;
}
iVar10 = Host_GetServerCount();
Mod_TouchAllData(param_1,iVar10);
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.