CParticleSystemMgr::PrecacheParticleSystem
0x00bd1b80 · 591 bytes · __thiscall
_ZN18CParticleSystemMgr22PrecacheParticleSystemEiPKc
Decompiled
undefined (3 params)
/* CParticleSystemMgr::PrecacheParticleSystem(int, char const*) */
void __thiscall
CParticleSystemMgr::PrecacheParticleSystem(CParticleSystemMgr *this,int param_1,char *param_2)
{
int iVar1;
int *piVar2;
int iVar3;
CParticleSystemDefinition *this_00;
CParticleSystemDefinition *pCVar4;
int iVar5;
int iVar6;
CParticleSystemMgr *pCVar7;
int iVar8;
CParticleSystemDefinition *pCVar9;
char *pcVar10;
uint local_40;
int local_3c;
int local_30;
ushort local_1e [7];
if (param_2 == (char *)0x0) {
return;
}
if (*param_2 == '\0') {
return;
}
this_00 = (CParticleSystemDefinition *)local_1e;
pCVar4 = this_00;
pcVar10 = param_2;
CUtlSymbolTable::Find((char *)this_00);
local_40 = (uint)local_1e[0];
if (local_40 == 0xffff) {
Warning("Attempted to precache unknown particle system \"%s\"!\n",param_2,pcVar10);
CUtlSymbolTable::Find((char *)this_00);
local_40 = (uint)local_1e[0];
piVar2 = *(int **)(this + 0x8c);
if (local_40 != 0xffff) goto LAB_00bd1bda;
}
else {
piVar2 = *(int **)(this + 0x8c);
this_00 = pCVar4;
LAB_00bd1bda:
if (local_40 < *(ushort *)((int)piVar2 + 0x26)) {
local_3c = *(int *)(*piVar2 + local_40 * 4);
goto joined_r0x00bd1bf3;
}
}
local_3c = 0;
joined_r0x00bd1bf3:
if (param_1 < 0) {
param_1 = ~param_1;
pCVar7 = this + 0x128;
}
else {
pCVar7 = this + 0x114;
}
iVar6 = *(int *)(pCVar7 + 0xc);
pCVar4 = *(CParticleSystemDefinition **)pCVar7;
iVar1 = (param_1 + 1) - iVar6;
if (0 < iVar1) {
local_30 = 0;
do {
iVar8 = *(int *)(pCVar7 + 4);
iVar5 = iVar6 + 1;
if (iVar8 < iVar5) {
iVar3 = *(int *)(pCVar7 + 8);
if (-1 < iVar3) {
if (iVar3 == 0) {
if (iVar8 == 0) {
if (iVar5 < 9) {
iVar3 = 8;
goto LAB_00bd1caf;
}
iVar8 = 8;
}
do {
iVar3 = iVar8;
iVar8 = iVar3 * 2;
} while (iVar8 < iVar5);
*(int *)(pCVar7 + 4) = iVar8;
this_00 = (CParticleSystemDefinition *)(iVar3 << 3);
}
else {
for (iVar3 = (iVar6 / iVar3 + 1) * iVar3; iVar3 < iVar5; iVar3 = (iVar3 + iVar5) / 2) {
}
LAB_00bd1caf:
*(int *)(pCVar7 + 4) = iVar3;
this_00 = (CParticleSystemDefinition *)(iVar3 << 2);
}
if (pCVar4 == (CParticleSystemDefinition *)0x0) {
pCVar4 = malloc((size_t)this_00);
*(CParticleSystemDefinition **)pCVar7 = pCVar4;
}
else {
pCVar9 = pCVar4;
pCVar4 = realloc(pCVar4,(size_t)this_00);
*(CParticleSystemDefinition **)pCVar7 = pCVar4;
iVar5 = *(int *)(pCVar7 + 0xc) + 1;
this_00 = pCVar9;
}
}
}
*(int *)(pCVar7 + 0xc) = iVar5;
iVar8 = iVar6 * 4;
iVar6 = (iVar5 - iVar6) + -1;
*(CParticleSystemDefinition **)(pCVar7 + 0x10) = pCVar4;
if (0 < iVar6) {
this_00 = pCVar4 + iVar8 + 4;
_V_memmove(this_00,pCVar4 + iVar8,iVar6 * 4);
pCVar4 = *(CParticleSystemDefinition **)pCVar7;
}
if (pCVar4 + iVar8 != (CParticleSystemDefinition *)0x0) {
*(undefined4 *)(pCVar4 + iVar8) = 0xffff;
pCVar4 = *(CParticleSystemDefinition **)pCVar7;
}
local_30 = local_30 + 1;
if (local_30 == iVar1) break;
iVar6 = *(int *)(pCVar7 + 0xc);
} while( true );
}
*(uint *)(pCVar4 + param_1 * 4) = local_40;
if (local_3c == 0) {
Warning("Attempted to precache unknown particle system \"%s\"!\n",param_2);
}
else if ((*(byte *)(local_3c + 0x41e) & 1) == 0) {
CParticleSystemDefinition::Precache(this_00);
}
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.