CDirector::PostRunScript
0x0087d790 · 606 bytes · __thiscall
_ZN9CDirector13PostRunScriptEv
Decompiled
undefined (1 param)
/* CDirector::PostRunScript() */
void __thiscall CDirector::PostRunScript(CDirector *this)
{
int *piVar1;
int *__ptr;
int iVar2;
undefined4 uVar3;
HSCRIPT__ *pHVar4;
char *pcVar5;
int iVar6;
CDirector *pCVar7;
void *local_28 [2];
ushort local_20;
ushort local_1e;
piVar1 = g_pScriptVM;
if (*(int *)(this + 0x4b8) != -1) {
__ptr = *(int **)(this + 0x4c0);
if ((g_pScriptVM != (int *)0x0) && (0 < *__ptr)) {
iVar6 = 0;
do {
(**(code **)(*piVar1 + 0x4c))(piVar1,*(undefined4 *)__ptr[iVar6 + 1]);
iVar2 = iVar6 * 4;
iVar6 = iVar6 + 1;
**(undefined4 **)(*(int *)(this + 0x4c0) + 4 + iVar2) = 0xffffffff;
__ptr = *(int **)(this + 0x4c0);
} while (iVar6 < *__ptr);
}
if (__ptr != &CUtlVectorUltraConservative<HSCRIPT__**,CUtlVectorUltraConservativeAllocator>::
StaticData()::staticData) {
free(__ptr);
*(undefined4 **)(this + 0x4c0) =
&CUtlVectorUltraConservative<HSCRIPT__**,CUtlVectorUltraConservativeAllocator>::
StaticData()::staticData;
}
if (((*(int *)(this + 0x4b8) != 0) && (piVar1 != (int *)0x0)) && (((byte)this[0x4bc] & 1) == 0))
{
(**(code **)(*piVar1 + 0x44))(piVar1,*(int *)(this + 0x4b8));
}
*(undefined4 *)(this + 0x4b8) = 0xffffffff;
}
piVar1 = g_pScriptVM;
local_28[0] = (void *)0x0;
local_20 = 0;
*(undefined4 *)(this + 0x4bc) = 0;
local_1e = 0;
/* try { // try from 0087d87c to 0087d9ae has its CatchHandler @ 0087da02 */
iVar6 = (**(code **)(*piVar1 + 0x48))(piVar1,"GetDirectorOptions",*(undefined4 *)(this + 0x488),0)
;
if (iVar6 != 0) {
iVar2 = (**(code **)(*g_pScriptVM + 0x50))
(g_pScriptVM,iVar6,0,0,local_28,*(undefined4 *)(this + 0x488),1,local_28);
(**(code **)(*g_pScriptVM + 0x4c))(g_pScriptVM,iVar6);
if (iVar2 == 0) {
if (local_20 == 0x20) {
if ((int)local_28[0] - 1U < 0xfffffffe) {
/* try { // try from 0087d9ea to 0087d9ec has its CatchHandler @ 0087da02 */
uVar3 = (**(code **)(*g_pScriptVM + 0x40))(g_pScriptVM,local_28[0]);
*(undefined4 *)(this + 0x4bc) = 0;
*(undefined4 *)(this + 0x4b8) = uVar3;
}
}
else {
pcVar5 = "unknown_variant_type";
if (local_20 < 0x29) {
pcVar5 = *(char **)(CSWTCH_3966 + (uint)local_20 * 4);
}
Warning("No free conversion of %s variant to HSCRIPT right now\n",pcVar5);
}
}
}
pCVar7 = this + 0x488;
iVar6 = 0;
do {
if (*(int *)(this + iVar6 * 4 + 0x4c4) != 0) {
(**(code **)(*g_pScriptVM + 0x4c))(g_pScriptVM,*(int *)(this + iVar6 * 4 + 0x4c4));
}
uVar3 = (**(code **)(*g_pScriptVM + 0x48))(g_pScriptVM,"Update",*(undefined4 *)pCVar7,1);
*(undefined4 *)(this + iVar6 * 4 + 0x4c4) = uVar3;
pHVar4 = *(HSCRIPT__ **)pCVar7;
if (pHVar4 == (HSCRIPT__ *)&DAT_ffffffff) {
pHVar4 = (HSCRIPT__ *)0x0;
}
CollectGameEventCallbacksInScope(pHVar4);
iVar6 = iVar6 + 1;
pCVar7 = pCVar7 + 0xc;
} while (iVar6 != 4);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
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.