CPooledVBAllocator_ColorMesh::Init
0x00189380 · 1067 bytes · __cdecl
_ZN28CPooledVBAllocator_ColorMesh4InitEyi
Decompiled
undefined (2 params)
/* CPooledVBAllocator_ColorMesh::Init(unsigned long long, int) */
bool CPooledVBAllocator_ColorMesh::Init(ulonglong param_1,int param_2)
{
char cVar1;
int *piVar2;
int *piVar3;
int iVar4;
undefined4 *puVar5;
int iVar6;
undefined4 *puVar7;
bool bVar8;
byte bVar9;
undefined4 in_stack_00000010;
undefined4 local_204 [18];
undefined4 local_1bc;
int local_168;
int local_164;
ushort *local_160;
int local_154;
int *local_150;
int local_14c;
char local_148;
ushort *local_144;
int local_138;
int *local_134;
undefined4 local_130;
int local_12c;
int local_128;
int local_124;
undefined4 local_120;
undefined4 local_11c;
undefined4 local_118;
undefined1 local_114;
undefined4 local_110 [19];
undefined4 local_c4;
uint local_c0;
undefined4 local_bc;
undefined4 local_b0;
undefined4 local_ac;
undefined4 local_a8;
undefined4 local_a4 [8];
undefined4 local_84 [6];
int *local_6c;
undefined1 local_68;
undefined4 local_64;
undefined4 local_60;
undefined4 local_5c;
undefined4 local_58;
undefined4 local_54;
undefined4 local_50;
undefined4 local_4c [8];
undefined4 local_2c;
int local_28;
int local_24;
bVar9 = 0;
cVar1 = CheckIsClear((CPooledVBAllocator_ColorMesh *)param_1);
bVar8 = false;
if (cVar1 != '\0') {
if (g_VBAllocTracker != (int *)0x0) {
(**(code **)(*g_VBAllocTracker + 8))(g_VBAllocTracker,"CPooledVBAllocator_ColorMesh::Init");
}
piVar2 = (int *)(**(code **)(*materials + 0x180))(materials);
if (piVar2 != (int *)0x0) {
/* try { // try from 001893df to 001893e1 has its CatchHandler @ 001897b9 */
(**(code **)(*piVar2 + 8))(piVar2);
}
/* try { // try from 0018940d to 00189412 has its CatchHandler @ 00189803 */
piVar3 = (int *)(**(code **)(*piVar2 + 0xe0))(piVar2,param_1._4_4_,param_2,"Lighting Verts",0,0)
;
*(int **)((CPooledVBAllocator_ColorMesh *)param_1 + 4) = piVar3;
if (piVar3 != (int *)0x0) {
local_148 = '\0';
local_134 = (int *)0x0;
local_130 = 0;
local_12c = 0;
local_124 = 0;
local_120 = 0;
local_11c = 0xffffffff;
local_118 = 0;
local_6c = (int *)0x0;
local_28 = -1;
local_24 = 0;
local_60 = 0;
local_5c = 0;
local_64 = 0;
local_2c = 0;
local_c4 = 0xffffffff;
local_14c = 10;
/* try { // try from 001894d1 to 00189644 has its CatchHandler @ 001897d5 */
local_150 = piVar3;
(**(code **)(*piVar3 + 0x30))(piVar3,10);
(**(code **)(*local_150 + 0x4c))(local_150,in_stack_00000010,0,local_204);
local_6c = piVar3;
local_68 = 0;
puVar5 = local_204;
puVar7 = local_110;
for (iVar4 = 0x29; iVar4 != 0; iVar4 = iVar4 + -1) {
*puVar7 = *puVar5;
puVar5 = puVar5 + (uint)bVar9 * -2 + 1;
puVar7 = puVar7 + (uint)bVar9 * -2 + 1;
}
local_134 = piVar3 + 1;
local_12c = 0;
local_130 = 0;
local_114 = 0;
local_128 = local_168;
local_144 = local_160;
local_124 = 0;
local_60 = 0;
local_138 = local_154;
local_c0 = ~-(uint)(local_c0 == 0) & 2;
if (local_28 == -1) {
local_2c = 0;
local_24 = local_168;
local_28 = local_164;
}
local_5c = 0;
local_58 = local_bc;
local_54 = local_b0;
puVar5 = local_a4;
do {
puVar7 = puVar5 + 1;
puVar5[0x16] = *puVar5;
puVar5 = puVar7;
} while (puVar7 != local_84);
*(undefined4 *)((CPooledVBAllocator_ColorMesh *)param_1 + 0x1c) = 0;
local_50 = local_ac;
*(undefined4 *)((CPooledVBAllocator_ColorMesh *)param_1 + 0xc) = in_stack_00000010;
*(undefined4 *)((CPooledVBAllocator_ColorMesh *)param_1 + 8) = local_a8;
*(undefined4 *)((CPooledVBAllocator_ColorMesh *)param_1 + 0x10) = local_1bc;
iVar4 = 0;
if (local_148 != '\0') {
if (local_14c == 4) {
iVar4 = -2;
}
else if (local_14c == 6) {
iVar4 = -6;
}
if (local_154 != 0) {
iVar6 = 0;
if (iVar4 < 1) {
iVar6 = iVar4;
}
if (iVar6 != 0) {
switch(local_14c) {
case 0:
case 9:
local_124 = 0;
break;
default:
GenerateSequentialIndexBuffer(local_160,iVar6,local_168);
break;
case 4:
GenerateLineStripIndexBuffer(local_160,iVar6,local_168);
break;
case 5:
GenerateLineLoopIndexBuffer(local_160,iVar6,local_168);
break;
case 6:
GeneratePolygonIndexBuffer(local_160,(int)local_160,iVar6);
break;
case 7:
/* try { // try from 00189733 to 001897ac has its CatchHandler @ 001897d5 */
GenerateQuadIndexBuffer(local_160,iVar6,local_168);
}
local_124 = local_138 * iVar6 + local_124;
if (local_12c < local_124) {
local_12c = local_124;
}
}
}
}
(**(code **)(*local_150 + 0x58))(local_150,local_60,local_12c,local_204);
}
if (g_VBAllocTracker != (int *)0x0) {
/* try { // try from 0018965b to 0018965d has its CatchHandler @ 00189803 */
(**(code **)(*g_VBAllocTracker + 8))(g_VBAllocTracker,0);
}
bVar8 = *(int *)((CPooledVBAllocator_ColorMesh *)param_1 + 4) != 0;
if ((piVar2 != (int *)0x0) && ((**(code **)(*piVar2 + 0xc))(piVar2), piVar2 != (int *)0x0)) {
(**(code **)(*piVar2 + 4))(piVar2);
}
}
return bVar8;
}
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.