CDirector::RunScript
0x0087da20 · 475 bytes · __thiscall
_ZN9CDirector9RunScriptEPKcNS_14ScriptLevels_tEb
Decompiled
undefined (4 params)
/* CDirector::RunScript(char const*, CDirector::ScriptLevels_t, bool) */
void __thiscall CDirector::RunScript(CDirector *this,char *param_1,int param_3,char param_4)
{
int iVar1;
HSCRIPT__ *pHVar2;
char cVar3;
char *pcVar4;
char *pcVar5;
int in_GS_OFFSET;
char local_420;
char local_41f [1023];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
UTIL_LogPrintf("CDirector::RunScript, %s, level: %d\n",param_1,param_3);
if (*(int *)(this + 0x488) == -1) {
(**(code **)(*(int *)this + 0x48))(this);
}
V_strncpy(&local_420,param_1,0x3ff);
pcVar5 = &local_420;
cVar3 = local_420;
LAB_0087dab0:
do {
if (cVar3 == '\0') {
LAB_0087dab4:
PostRunScript(this);
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return;
}
iVar1 = (int)cVar3;
pcVar4 = pcVar5;
if ((0x17 < iVar1 - 9U) || ((1 << ((byte)(iVar1 - 9U) & 0x1f) & 0x80001fU) == 0)) {
while ((iVar1 = isalnum(iVar1), iVar1 != 0 || (cVar3 == '_'))) {
pcVar4 = pcVar4 + 1;
cVar3 = *pcVar4;
if (cVar3 == '\0') break;
iVar1 = (int)cVar3;
}
if (pcVar5 == pcVar4) {
DevWarning("Bad character in script list (%s)\n",param_1);
goto LAB_0087dab4;
}
*pcVar4 = '\0';
pHVar2 = *(HSCRIPT__ **)(this + param_3 * 0xc + 0x488);
if (pHVar2 == (HSCRIPT__ *)&DAT_ffffffff) {
pHVar2 = (HSCRIPT__ *)0x0;
}
VScriptServerRunScript(pcVar5,pHVar2,true);
if (param_4 != '\0') {
pHVar2 = *(HSCRIPT__ **)(this + param_3 * 0xc + 0x488);
if (*(HSCRIPT__ **)(this + param_3 * 0xc + 0x488) == (HSCRIPT__ *)&DAT_ffffffff) {
pHVar2 = (HSCRIPT__ *)0x0;
}
VScriptServerRunScriptForAllAddons(pcVar5,pHVar2,false);
}
if (cVar3 == '.') {
cVar3 = ' ';
DevWarning("File extension found in script list (%s)\nScript names should not contain extensions.\n"
,param_1);
}
*pcVar4 = cVar3;
pcVar5 = pcVar4;
goto LAB_0087dab0;
}
cVar3 = pcVar5[1];
pcVar5 = pcVar5 + 1;
} while( true );
}
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.