CModelRender::FindOrCreateStaticPropColorData
0x00187a00 · 1735 bytes · __thiscall
_ZN12CModelRender31FindOrCreateStaticPropColorDataEt
Decompiled
undefined (2 params)
/* CModelRender::FindOrCreateStaticPropColorData(unsigned short) */
int __thiscall CModelRender::FindOrCreateStaticPropColorData(CModelRender *this,ushort param_1)
{
ModelInstance_t *pMVar1;
int *piVar2;
char cVar3;
int iVar4;
studiohwdata_t *psVar5;
uint *puVar6;
void *pvVar7;
int *piVar8;
undefined4 uVar9;
undefined4 *puVar10;
int iVar11;
int *piVar12;
uint uVar13;
int iVar14;
int iVar15;
int in_GS_OFFSET;
undefined4 local_73c;
int *local_734;
memhandle_t__ *local_71c [45];
undefined4 local_668;
undefined1 local_660;
int *local_64c;
undefined4 local_648;
undefined4 local_644;
undefined4 local_63c;
undefined4 local_638;
undefined4 local_634;
undefined4 local_630;
undefined4 local_5dc;
int *local_584;
undefined4 local_57c;
undefined4 local_578;
undefined4 local_574;
undefined4 local_544;
undefined4 local_540;
undefined4 local_53c;
uint local_534;
int local_530;
int *local_52c;
undefined4 auStack_528 [256];
uint local_128;
undefined1 local_124 [260];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (param_1 != 0xffff) {
pMVar1 = (ModelInstance_t *)((uint)param_1 * 0x108 + *(int *)(this + 0xc));
iVar4 = (**(code **)(**(int **)(this + 8) + 0x30))
(*(int **)(this + 8),*(undefined4 *)(pMVar1 + 0x100),1);
if (iVar4 != 0) goto LAB_00187a73;
psVar5 = (studiohwdata_t *)
(**(code **)(*g_pMDLCache + 0x2c))
(g_pMDLCache,*(undefined2 *)(*(int *)(pMVar1 + 4) + 0x134));
if (psVar5 == (studiohwdata_t *)0x0) {
(**(code **)(*g_pFullFileSystem + 0x98))
(g_pFullFileSystem,*(undefined4 *)(pMVar1 + 4),local_124,0x104);
Sys_Error("g_pMDLCache->GetHardwareData failed for %s\n",local_124);
goto LAB_00187a73;
}
InitColormeshParams(this,pMVar1,psVar5,(colormeshparams_t *)&local_534);
if (0 < (int)local_534) {
local_128 = **(uint **)(pMVar1 + 4);
(**(code **)(**(int **)(this + 8) + 0x14))
(*(int **)(this + 8),
local_530 * 4 * *(int *)(r_staticlight_streams._28_4_ + 0x30) + local_534 * 4,1);
puVar6 = operator_new(0x1c);
iVar4 = *(int *)(r_staticlight_streams._28_4_ + 0x30);
puVar6[4] = 0;
*(byte *)(puVar6 + 5) = (byte)puVar6[5] & 0xf8;
puVar6[6] = local_128;
*puVar6 = local_534;
puVar6[3] = local_530 * 4 * iVar4 + local_534 * 4;
uVar13 = local_534 << 4;
if (0x7f00000 < local_534) {
uVar13 = 0xffffffff;
}
pvVar7 = operator_new__(uVar13);
puVar6[1] = (uint)pvVar7;
_V_memset(pvVar7,0,local_534 << 4);
uVar13 = 0xffffffff;
if (local_534 < 0x1fc00001) {
uVar13 = local_534 * 4;
}
pvVar7 = operator_new__(uVar13);
puVar6[2] = (uint)pvVar7;
local_668 = 0;
local_660 = 0;
local_64c = (int *)0x0;
local_648 = 0;
local_644 = 0;
local_63c = 0;
local_638 = 0;
local_634 = 0xffffffff;
local_630 = 0;
local_584 = (int *)0x0;
local_540 = 0xffffffff;
local_53c = 0;
local_578 = 0;
local_574 = 0;
local_57c = 0;
local_544 = 0;
local_5dc = 0xffffffff;
/* try { // try from 00187c8c to 00187c91 has its CatchHandler @ 001880f8 */
piVar8 = (int *)(**(code **)(*materials + 0x180))(materials);
if (piVar8 != (int *)0x0) {
/* try { // try from 00187ca1 to 00187ca3 has its CatchHandler @ 00188158 */
(**(code **)(*piVar8 + 8))(piVar8);
}
if (0 < (int)local_534) {
iVar15 = 0;
uVar13 = puVar6[1];
LAB_00187cf7:
local_73c = 2;
if (iVar4 < 2) {
local_73c = 8;
}
iVar14 = iVar15 * 0x10;
*(undefined4 *)(uVar13 + iVar14) = 0;
*(int **)(puVar6[1] + 4 + iVar14) = local_52c;
*(undefined4 *)(puVar6[1] + 8 + iVar14) = 0;
*(undefined4 *)(puVar6[1] + 0xc + iVar14) = auStack_528[iVar15];
if (local_52c != (int *)0x0) {
uVar13 = puVar6[1];
/* try { // try from 00187d73 to 00187ee6 has its CatchHandler @ 00188154 */
uVar9 = (**(code **)(*local_52c + 0x1c))(local_52c,auStack_528[iVar15]);
*(undefined4 *)(uVar13 + iVar14 + 8) = uVar9;
puVar10 = (undefined4 *)(puVar6[1] + iVar14);
if (puVar10[2] == -1) {
puVar10[1] = 0;
*(undefined4 *)(puVar6[1] + 8 + iVar14) = 0;
}
else {
uVar9 = (**(code **)(*local_52c + 0x10))(local_52c);
*puVar10 = uVar9;
uVar13 = puVar6[2];
iVar11 = (**(code **)(*local_52c + 0x14))(local_52c);
*(int *)(uVar13 + iVar15 * 4) = iVar11 + *(int *)(puVar6[1] + 8 + iVar14);
}
}
uVar13 = puVar6[1];
local_734 = (int *)(uVar13 + iVar14);
if (*local_734 != 0) goto LAB_00187ce8;
if (g_VBAllocTracker != (int *)0x0) {
(**(code **)(*g_VBAllocTracker + 8))(g_VBAllocTracker,"CColorMeshData::CreateResource");
local_734 = (int *)(puVar6[1] + iVar14);
}
iVar11 = (**(code **)(*piVar8 + 0xe0))(piVar8,local_73c,0,"Lighting Verts",0,0);
*local_734 = iVar11;
if (g_VBAllocTracker != (int *)0x0) {
(**(code **)(*g_VBAllocTracker + 8))(g_VBAllocTracker,0);
}
uVar13 = puVar6[1];
if (*(int *)(uVar13 + iVar14) != 0) goto LAB_00187ce8;
if (puVar6[4] != 0) {
(**(code **)(*g_pFileSystem + 0xc4))(g_pFileSystem,puVar6[4],1);
(**(code **)(*g_pFileSystem + 0xdc))(g_pFileSystem,puVar6[4]);
}
piVar12 = (int *)(**(code **)(*materials + 0x180))(materials);
if (piVar12 != (int *)0x0) {
/* try { // try from 00187ef6 to 00187ef8 has its CatchHandler @ 0018811e */
(**(code **)(*piVar12 + 8))(piVar12);
}
iVar4 = 0;
if (0 < (int)*puVar6) {
do {
puVar10 = (undefined4 *)(iVar4 * 0x10 + puVar6[1]);
piVar2 = (int *)puVar10[1];
if (piVar2 == (int *)0x0) {
(**(code **)(*piVar12 + 0xe4))(piVar12,*puVar10);
}
else {
/* try { // try from 00187f1b to 00187f4a has its CatchHandler @ 00188142 */
(**(code **)(*piVar2 + 0x20))(piVar2,puVar10[2],puVar10[3]);
}
iVar4 = iVar4 + 1;
} while (iVar4 < (int)*puVar6);
}
if ((void *)puVar6[1] != (void *)0x0) {
operator_delete__((void *)puVar6[1]);
}
if ((void *)puVar6[2] != (void *)0x0) {
operator_delete__((void *)puVar6[2]);
}
operator_delete(puVar6);
if ((piVar12 != (int *)0x0) &&
((**(code **)(*piVar12 + 0xc))(piVar12), piVar12 != (int *)0x0)) {
(**(code **)(*piVar12 + 4))(piVar12);
}
puVar6 = (uint *)0x0;
}
LAB_00187f9c:
if ((piVar8 != (int *)0x0) && ((**(code **)(*piVar8 + 0xc))(piVar8), piVar8 != (int *)0x0)) {
(**(code **)(*piVar8 + 4))(piVar8);
}
if ((local_584 != (int *)0x0) &&
(cVar3 = (**(code **)(*local_584 + 0x10))(local_584), cVar3 != '\0')) {
(**(code **)(*local_584 + 0x18))(local_584);
}
if ((local_64c != (int *)0x0) &&
(cVar3 = (**(code **)(*local_64c + 0x10))(local_64c), cVar3 != '\0')) {
(**(code **)(*local_64c + 0x18))(local_64c);
}
if (puVar6 == (uint *)0x0) {
local_71c[0] = (memhandle_t__ *)0x0;
}
else {
(**(code **)(**(int **)(this + 8) + 0x74))
(*(int **)(this + 8),puVar6,puVar6,puVar6[3],0,local_71c);
}
*(memhandle_t__ **)(pMVar1 + 0x100) = local_71c[0];
ProtectColorDataIfQueued(this,local_71c[0]);
iVar4 = (**(code **)(**(int **)(this + 8) + 0x30))
(*(int **)(this + 8),*(undefined4 *)(pMVar1 + 0x100),1);
goto LAB_00187a73;
}
}
iVar4 = 0;
LAB_00187a73:
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return iVar4;
LAB_00187ce8:
iVar15 = iVar15 + 1;
if ((int)local_534 <= iVar15) goto LAB_00187f9c;
goto LAB_00187cf7;
}
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.