PrecachePlayerModelAndMaterials
0x009c88f0 · 1259 bytes · __cdecl
_Z31PrecachePlayerModelAndMaterialsP14CBaseAnimatingPKcS2_P10CUtlVectorIS2_10CUtlMemoryIS2_iEE
Decompiled
undefined (4 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* PrecachePlayerModelAndMaterials(CBaseAnimating*, char const*, char const*, CUtlVector<char
const*, CUtlMemory<char const*, int> >*) */
void PrecachePlayerModelAndMaterials
(CBaseAnimating *param_1,char *param_2,char *param_3,CUtlVector *param_4)
{
uint *puVar1;
char cVar2;
KeyValues *this;
char *pcVar3;
size_t sVar4;
char *pcVar5;
int iVar6;
int iVar7;
int *piVar8;
int in_GS_OFFSET;
int local_170;
char *local_160;
undefined4 local_15c;
undefined4 local_158;
undefined4 local_154;
undefined4 local_150;
KeyValues *local_14c;
undefined4 local_148;
undefined4 local_144;
undefined4 local_140;
undefined4 local_13c;
undefined4 local_138;
undefined4 local_134;
undefined **local_130;
undefined1 local_12c;
char local_12b [263];
undefined4 local_24;
int local_20;
local_15c = 0;
local_158 = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (_towlower == (KeyValues *)0x0) {
local_14c = (KeyValues *)0x0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_15c,0,0,0,0,"/data/src/game/server/terror/terrorplayer.cpp",0x5ad,
&PrecachePlayerModelAndMaterials(CBaseAnimating*,char_const*,char_const*,CUtlVector<char_const*,CUtlMemory<char_const*,int>>*)
::tm_fmt,"(%s)%s","ZOMBIE","PrecachePlayerModelAndMaterials");
local_14c = _towlower;
}
iVar6 = _DAT_0105db00;
local_154 = local_15c;
local_150 = local_158;
/* try { // try from 009c8ce0 to 009c8d44 has its CatchHandler @ 009c8e15 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar7 = ThreadGetCurrentId(), iVar6 == iVar7)) {
if (*(char **)_DAT_0105d15c != "PrecachePlayerModelAndMaterials") {
_DAT_0105d15c =
(KeyValues *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd17538,(char *)0x0,0xc0db47);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + *(int *)(_DAT_0105d15c + 0x70) * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
local_148 = 0xc1800000;
local_144 = 0xc1800000;
local_140 = 0xc1500000;
local_13c = 0x41800000;
local_138 = 0x41800000;
local_134 = 0x42960000;
/* try { // try from 009c8a1b to 009c8b54 has its CatchHandler @ 009c8e0c */
this = (KeyValues *)CTerrorGameRules::GetMissionCurrentMap((KeyValues **)0x0);
if (((this == (KeyValues *)0x0) ||
(pcVar3 = (char *)KeyValues::GetString(this,param_3,""), pcVar3 == (char *)0x0)) ||
(*pcVar3 == '\0')) {
pcVar3 = param_2;
}
CBaseEntity::PrecacheModel(pcVar3);
pcVar5 = (char *)(filesystem + 4);
cVar2 = (**(code **)(*(int *)(filesystem + 4) + 0x28))(pcVar5,pcVar3,0);
if (cVar2 == '\0') {
pcVar5 = "Couldn\'t precache %s\n";
/* try { // try from 009c8d9e to 009c8dc6 has its CatchHandler @ 009c8e0c */
Warning("Couldn\'t precache %s\n",pcVar3);
}
else if (param_4 != (CUtlVector *)0x0) {
(**(code **)(*engine + 0x154))(engine,pcVar3,&local_148,&local_13c);
pcVar5 = (char *)param_1;
(**(code **)(*(int *)param_1 + 0x70))(param_1,pcVar3);
piVar8 = *(int **)(param_1 + 0x13e0);
if (piVar8 == (int *)0x0) {
pcVar5 = (char *)param_1;
iVar6 = CBaseEntity::GetModel((CBaseEntity *)param_1);
if (iVar6 != 0) {
pcVar5 = (char *)param_1;
CBaseAnimating::LockStudioHdr(param_1);
}
piVar8 = *(int **)(param_1 + 0x13e0);
if (piVar8 == (int *)0x0) goto LAB_009c8c59;
}
iVar6 = *piVar8;
if (iVar6 != 0) {
sVar4 = strlen(pcVar3);
pcVar5 = operator_new__(sVar4 + 1);
strcpy(pcVar5,pcVar3);
pcVar3 = *(char **)(param_4 + 0xc);
local_160 = pcVar5;
CUtlVector<char_const*,CUtlMemory<char_const*,int>>::InsertBefore
((CUtlVector<char_const*,CUtlMemory<char_const*,int>> *)param_4,(int)pcVar3,
&local_160);
pcVar5 = (char *)param_4;
if (0 < *(int *)(iVar6 + 0xcc)) {
local_170 = 0;
do {
piVar8 = (int *)(local_170 * 0x40 + *(int *)(iVar6 + 0xd0) + iVar6);
pcVar5 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pcVar3);
pcVar3 = "vmt";
/* try { // try from 009c8b76 to 009c8b7a has its CatchHandler @ 009c8dda */
KeyValues::KeyValues((KeyValues *)pcVar5,"vmt",(IKeyValuesSystem *)0x0,false);
iVar7 = 0;
if (0 < *(int *)(iVar6 + 0xd4)) {
do {
local_12b[0] = '\0';
local_24 = 0;
local_130 = &PTR_InitQuietTruncation_00d1b050;
local_12c = 1;
/* try { // try from 009c8be8 to 009c8c3f has its CatchHandler @ 009c8e0c */
CFmtStrN<260>::sprintf
((CFmtStrN<260> *)&local_130,"materials/%s%s.vmt",
*(int *)(iVar6 + iVar7 * 4 + *(int *)(iVar6 + 0xd8)) + iVar6,
*piVar8 + (int)piVar8);
pcVar3 = local_12b;
cVar2 = (**(code **)(*(int *)(filesystem + 4) + 0x28))(filesystem + 4,pcVar3,0);
if (cVar2 != '\0') {
pcVar3 = local_12b;
(**(code **)(*engine + 0x160))(engine);
break;
}
iVar7 = iVar7 + 1;
} while (iVar7 < *(int *)(iVar6 + 0xd4));
}
KeyValues::deleteThis();
local_170 = local_170 + 1;
} while (local_170 < *(int *)(iVar6 + 0xcc));
}
}
}
LAB_009c8c59:
iVar6 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar7 = ThreadGetCurrentId(pcVar5), iVar6 == iVar7)) {
pcVar5 = (char *)_DAT_0105d15c;
cVar2 = CVProfNode::ExitScope();
if (cVar2 != '\0') {
_DAT_0105d15c = *(KeyValues **)(_DAT_0105d15c + 100);
}
DAT_0105d158 = _DAT_0105d15c == (KeyValues *)0x105d160;
}
if (local_14c != (KeyValues *)0x0) {
pcVar5 = (char *)local_14c;
(**(code **)(local_14c + 0x54))(local_14c,local_154,local_150,0,0,0);
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail(pcVar5);
}
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.