CModelLoader::LoadModel
0x0019ddf0 · 984 bytes · __thiscall
_ZN12CModelLoader9LoadModelEP7model_tPN12IModelLoader13REFERENCETYPEE
Decompiled
undefined (3 params)
/* CModelLoader::LoadModel(model_t*, IModelLoader::REFERENCETYPE*) */
model_t * __thiscall
CModelLoader::LoadModel(CModelLoader *this,model_t *param_1,REFERENCETYPE *param_2)
{
model_t *pmVar1;
int *piVar2;
int iVar3;
CModelLoader *pCVar4;
int in_GS_OFFSET;
bool bVar5;
longdouble lVar6;
longdouble lVar7;
longdouble lVar8;
model_t local_228 [260];
char local_124 [260];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (param_2 != (REFERENCETYPE *)0x0) {
*(uint *)(param_1 + 0x108) = *(uint *)(param_1 + 0x108) | *(uint *)param_2;
}
iVar3 = Host_GetServerCount();
bVar5 = iVar3 != *(int *)(param_1 + 0x10c);
if (bVar5) {
*(int *)(param_1 + 0x10c) = iVar3;
}
if ((*(int *)(param_1 + 0x110) == 3) && ((*(uint *)(param_1 + 0x108) & 0x10000) == 0)) {
(**(code **)(*g_pMDLCache + 0x28))(g_pMDLCache,*(undefined2 *)(param_1 + 0x134));
if (bVar5) {
Mod_TouchAllData(param_1,iVar3);
}
goto LAB_0019de56;
}
if ((*(uint *)(param_1 + 0x108) & 1) != 0) goto LAB_0019de56;
lVar6 = (longdouble)Plat_FloatTime();
pmVar1 = param_1 + 4;
pCVar4 = this + 0x158;
V_FileBase((char *)pmVar1,(char *)pCVar4,0x40);
if (1 < *(int *)(developer._28_4_ + 0x30)) {
DevMsg("Loading: %s\n",pmVar1);
}
iVar3 = GetTypeFromName(this,(char *)pmVar1);
*(int *)(param_1 + 0x110) = iVar3;
piVar2 = g_pMDLCache;
if (iVar3 == 0) {
*(undefined4 *)(param_1 + 0x110) = 3;
LAB_0019e04a:
piVar2 = g_pMDLCache;
(**(code **)(*g_pMDLCache + 0x68))(g_pMDLCache);
/* try { // try from 0019e05f to 0019e089 has its CatchHandler @ 0019e200 */
lVar7 = (longdouble)Plat_FloatTime();
Studio_LoadModel(this,param_1,bVar5);
lVar8 = (longdouble)Plat_FloatTime();
g_flAccumulatedModelLoadTimeStudio =
(g_flAccumulatedModelLoadTimeStudio - (double)lVar7) + (double)lVar8;
(**(code **)(*piVar2 + 0x6c))(piVar2);
}
else if (iVar3 == 2) {
(**(code **)(*g_pMDLCache + 0x68))(g_pMDLCache);
/* try { // try from 0019e14e to 0019e16f has its CatchHandler @ 0019e1ee */
lVar7 = (longdouble)Plat_FloatTime();
Sprite_LoadModel(this,param_1);
lVar8 = (longdouble)Plat_FloatTime();
g_flAccumulatedModelLoadTimeSprite =
(g_flAccumulatedModelLoadTimeSprite - (double)lVar7) + (double)lVar8;
(**(code **)(*piVar2 + 0x6c))(piVar2);
}
else {
if (iVar3 == 3) goto LAB_0019e04a;
if (iVar3 == 1) {
lVar7 = (longdouble)Plat_FloatTime();
if (pmVar1 != local_228) {
V_strncpy((char *)local_228,(char *)pmVar1,0x104);
}
(**(code **)(*g_pFileSystem + 0x1c))(g_pFileSystem,local_228,&DAT_002a076d,0,0);
if (*(int *)(mat_excludetextures._28_4_ + 0x30) != 0) {
sprintf(local_124,"//MOD/maps/%s_exclude.lst",pCVar4);
(**(code **)(*g_pMaterialSystem + 0x1b4))(g_pMaterialSystem,local_124);
}
NotifyHunkBeginMapLoad((char *)pCVar4);
if (*(int *)(mat_excludetextures._28_4_ + 0x30) != 0) {
(**(code **)(*g_pMaterialSystem + 0x1b8))(g_pMaterialSystem);
}
(**(code **)(*g_pFileSystem + 0x154))(g_pFileSystem);
Map_LoadModel(this,param_1);
(**(code **)(*g_pFileSystem + 0x158))(g_pFileSystem);
lVar8 = (longdouble)Plat_FloatTime();
g_flAccumulatedModelLoadTimeBrush =
(g_flAccumulatedModelLoadTimeBrush - (double)lVar7) + (double)lVar8;
}
}
lVar7 = (longdouble)Plat_FloatTime();
COM_TimestampedLog("Load of %s took %.3f msec",pmVar1,
(double)((float)((double)lVar7 - (double)lVar6) * 1000.0));
g_flAccumulatedModelLoadTime =
(double)(float)((double)lVar7 - (double)lVar6) + g_flAccumulatedModelLoadTime;
LAB_0019de56:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return param_1;
}
/* 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.