Script_SpawnEntityGroupFromTable
0x00b46f90 · 722 bytes · __cdecl
_ZL32Script_SpawnEntityGroupFromTableP9HSCRIPT__
Decompiled
undefined (1 param)
/* Script_SpawnEntityGroupFromTable(HSCRIPT__*) */
undefined4 Script_SpawnEntityGroupFromTable(HSCRIPT__ *param_1)
{
code *pcVar1;
int iVar2;
int *piVar3;
HSCRIPT__ *pHVar4;
undefined4 *puVar5;
undefined4 uVar6;
int iVar7;
int *piVar8;
int iVar9;
undefined4 uVar10;
int iVar11;
int iVar12;
int in_GS_OFFSET;
int *apiStack_90 [2];
HSCRIPT__ *local_88;
int aiStack_84 [4];
HSCRIPT__ *local_74;
int local_70;
undefined4 *local_6c;
undefined4 *local_68;
undefined4 *local_64;
undefined4 *local_60;
undefined4 local_50 [2];
undefined2 local_48;
ushort local_46;
undefined4 local_44;
undefined4 local_40;
undefined2 local_3c;
ushort local_3a;
undefined4 local_38;
undefined4 local_34;
undefined2 local_30;
ushort local_2e;
undefined4 local_2c;
undefined4 local_28;
undefined2 local_24;
ushort local_22;
int local_20;
local_48 = 0;
local_46 = 0;
local_50[0] = 0;
local_44 = 0;
local_38 = 0;
local_74 = param_1;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
local_2c = 0;
local_3c = 0;
local_3a = 0;
local_30 = 0;
local_2e = 0;
local_24 = 0;
local_22 = 0;
apiStack_90[1] = g_pScriptVM;
local_64 = &local_44;
local_60 = local_50;
local_6c = &local_2c;
local_68 = &local_38;
local_88 = param_1;
/* try { // try from 00b4701e to 00b471b6 has its CatchHandler @ 00b47266 */
apiStack_90[0] = (int *)0xb47024;
local_70 = (**(code **)(*g_pScriptVM + 0x88))();
iVar2 = -(local_70 * 0x10 + 0x10);
aiStack_84[3] = (int)&local_70 + iVar2;
if (local_70 < 1) {
iVar12 = 0;
}
else {
local_64 = &local_44;
iVar9 = 0;
local_60 = local_50;
uVar10 = 0;
local_6c = &local_2c;
local_68 = &local_38;
iVar12 = 0;
do {
while( true ) {
puVar5 = local_64;
iVar7 = *g_pScriptVM;
*(undefined4 *)((int)aiStack_84 + iVar2) = uVar10;
*(undefined4 **)((int)aiStack_84 + iVar2 + 8) = puVar5;
puVar5 = local_60;
pHVar4 = local_74;
*(int **)((int)apiStack_90 + iVar2 + 4) = g_pScriptVM;
*(HSCRIPT__ **)((int)aiStack_84 + iVar2 + -4) = pHVar4;
*(undefined4 **)((int)aiStack_84 + iVar2 + 4) = puVar5;
pcVar1 = *(code **)(iVar7 + 0x8c);
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb4711c;
uVar10 = (*pcVar1)();
iVar7 = *g_pScriptVM;
*(undefined4 **)((int)aiStack_84 + iVar2 + 8) = local_6c;
puVar5 = local_68;
*(undefined4 *)((int)aiStack_84 + iVar2) = 0;
*(int **)((int)apiStack_90 + iVar2 + 4) = g_pScriptVM;
*(undefined4 **)((int)aiStack_84 + iVar2 + 4) = puVar5;
*(undefined4 *)((int)aiStack_84 + iVar2 + -4) = local_44;
pcVar1 = *(code **)(iVar7 + 0x8c);
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb4714b;
(*pcVar1)();
*(undefined4 *)((int)aiStack_84 + iVar2 + -4) = local_2c;
*(undefined4 *)((int)apiStack_90 + iVar2 + 4) = local_38;
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb4715d;
iVar7 = ScriptCreateEntityFromTable
(*(char **)((int)apiStack_90 + iVar2 + 4),
*(HSCRIPT__ **)((int)aiStack_84 + iVar2 + -4));
uVar6 = local_38;
if (iVar7 != 0) break;
*(char **)((int)apiStack_90 + iVar2 + 4) = "Failed to spawn group entity %s\n";
*(undefined4 *)((int)aiStack_84 + iVar2 + -4) = uVar6;
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb47178;
Msg();
iVar9 = iVar9 + 1;
if (iVar9 == local_70) goto LAB_00b47188;
}
iVar11 = iVar12 + 1;
piVar8 = (int *)(iVar12 * 0x10 + aiStack_84[3]);
*piVar8 = iVar7;
piVar3 = g_pScriptVM;
piVar8[1] = 0;
piVar8[2] = 0;
iVar12 = *piVar3;
*(undefined4 **)((int)aiStack_84 + iVar2 + -4) = local_60;
*(int **)((int)apiStack_90 + iVar2 + 4) = piVar3;
pcVar1 = *(code **)(iVar12 + 0x9c);
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb470a2;
(*pcVar1)();
puVar5 = local_64;
iVar12 = *g_pScriptVM;
*(int **)((int)apiStack_90 + iVar2 + 4) = g_pScriptVM;
*(undefined4 **)((int)aiStack_84 + iVar2 + -4) = puVar5;
pcVar1 = *(code **)(iVar12 + 0x9c);
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb470b9;
(*pcVar1)();
puVar5 = local_68;
iVar12 = *g_pScriptVM;
*(int **)((int)apiStack_90 + iVar2 + 4) = g_pScriptVM;
*(undefined4 **)((int)aiStack_84 + iVar2 + -4) = puVar5;
pcVar1 = *(code **)(iVar12 + 0x9c);
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb470d0;
(*pcVar1)();
puVar5 = local_6c;
iVar12 = *g_pScriptVM;
*(int **)((int)apiStack_90 + iVar2 + 4) = g_pScriptVM;
*(undefined4 **)((int)aiStack_84 + iVar2 + -4) = puVar5;
pcVar1 = *(code **)(iVar12 + 0x9c);
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb470e7;
(*pcVar1)();
iVar9 = iVar9 + 1;
iVar12 = iVar11;
} while (iVar9 != local_70);
}
LAB_00b47188:
iVar9 = aiStack_84[3];
*(undefined4 *)((int)aiStack_84 + iVar2) = 1;
*(int *)((int)apiStack_90 + iVar2 + 4) = iVar12;
*(int *)((int)aiStack_84 + iVar2 + -4) = iVar9;
local_64 = &local_44;
local_60 = local_50;
local_6c = &local_2c;
local_68 = &local_38;
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb471b7;
SpawnHierarchicalList
(*(int *)((int)apiStack_90 + iVar2 + 4),
*(HierarchicalSpawn_t **)((int)aiStack_84 + iVar2 + -4),
*(bool *)((int)aiStack_84 + iVar2));
if ((local_22 & 1) != 0) {
*(undefined4 *)((int)apiStack_90 + iVar2 + 4) = local_2c;
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb471c8;
free(*(void **)((int)apiStack_90 + iVar2 + 4));
local_22 = local_22 & 0xfffe;
}
local_2c = 0;
local_28 = 0;
local_24 = 0;
if ((local_2e & 1) != 0) {
*(undefined4 *)((int)apiStack_90 + iVar2 + 4) = local_38;
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb471f2;
free(*(void **)((int)apiStack_90 + iVar2 + 4));
local_2e = local_2e & 0xfffe;
}
local_38 = 0;
local_34 = 0;
local_30 = 0;
if ((local_3a & 1) != 0) {
*(undefined4 *)((int)apiStack_90 + iVar2 + 4) = local_44;
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb4721c;
free(*(void **)((int)apiStack_90 + iVar2 + 4));
local_3a = local_3a & 0xfffe;
}
local_44 = 0;
local_40 = 0;
local_3c = 0;
if ((local_46 & 1) != 0) {
*(undefined4 *)((int)apiStack_90 + iVar2 + 4) = local_50[0];
*(undefined4 *)((int)apiStack_90 + iVar2) = 0xb47246;
free(*(void **)((int)apiStack_90 + iVar2 + 4));
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
*(undefined **)((int)apiStack_90 + iVar2) = &UNK_00b472a1;
__stack_chk_fail();
}
return 1;
}
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.