CGameEventManager::LoadEventsFromFile
0x00165c80 · 819 bytes · __thiscall
_ZN17CGameEventManager18LoadEventsFromFileEPKc
Decompiled
undefined (2 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CGameEventManager::LoadEventsFromFile(char const*) */
undefined4 __thiscall CGameEventManager::LoadEventsFromFile(CGameEventManager *this,char *param_1)
{
CGameEventManager *pCVar1;
uint uVar2;
char cVar3;
uint uVar4;
KeyValues *this_00;
IBaseFileSystem *pIVar5;
KeyValues *this_01;
int iVar6;
undefined4 uVar7;
CGameEventManager *pCVar8;
short local_26;
CGameEventManager *local_24;
char *local_20;
local_20 = "CGameEventManager";
pCVar1 = this + 0x9c;
local_24 = pCVar1;
if (_SetSeed != 0) {
if (CTelemetryLock::CTelemetryLock(void*,char_const*)::s_bNameSet == '\0') {
(**(code **)(_SetSeed + 0x5c))
(_SetSeed,pCVar1,&CTelemetryLock::CTelemetryLock(void*,char_const*)::tm_fmt,
"CGameEventManager");
CTelemetryLock::CTelemetryLock(void*,char_const*)::s_bNameSet = '\x01';
if (_SetSeed == 0) goto LAB_00165d3e;
}
(**(code **)(_SetSeed + 0x60))
(_SetSeed,0,0,0,"/data/src/public/tier0/vprof_telemetry.h",0x3eb,local_24,
&CTelemetryLock::CTelemetryLock(void*,char_const*)::tm_fmt,&DAT_002c48a3,local_20);
}
LAB_00165d3e:
/* try { // try from 00165d3e to 00165d42 has its CatchHandler @ 0016601e */
uVar4 = ThreadGetCurrentId();
if (uVar4 != *(uint *)(this + 0x9c)) {
LOCK();
uVar2 = *(uint *)pCVar1;
if (uVar2 == 0) {
*(uint *)pCVar1 = uVar4;
}
UNLOCK();
if (uVar2 != 0) {
/* try { // try from 00165f1c to 00165f20 has its CatchHandler @ 0016601e */
CThreadFastMutex::Lock((uint)pCVar1,uVar4);
goto LAB_00165d6d;
}
}
*(int *)(this + 0xa0) = *(int *)(this + 0xa0) + 1;
LAB_00165d6d:
/* try { // try from 00165db4 to 00165e2e has its CatchHandler @ 00166022 */
if ((_SetSeed != 0) &&
((**(code **)(_SetSeed + 100))
(_SetSeed,0,0,"/data/src/public/tier0/vprof_telemetry.h",0x3f3,
&CTelemetryLock::Locked()::tm_fmt,local_24,0), _SetSeed != 0)) {
(**(code **)(_SetSeed + 0x6c))
(_SetSeed,local_24,2,"/data/src/public/tier0/vprof_telemetry.h",0x3f4,
&CTelemetryLock::Locked()::tm_fmt,"%s Locked",local_20);
}
pCVar8 = this + 0x2c;
CUtlSymbolTable::Find((char *)&local_26);
if (local_26 == -1) {
/* try { // try from 00165f96 to 00165fb3 has its CatchHandler @ 00166022 */
CUtlSymbolTable::AddString((char *)&local_26);
pCVar8 = *(CGameEventManager **)(this + 0x70);
CUtlVector<CUtlSymbol,CUtlMemory<CUtlSymbol,int>>::InsertBefore
((CUtlVector<CUtlSymbol,CUtlMemory<CUtlSymbol,int>> *)(this + 100),(int)pCVar8,
(CUtlSymbol *)&local_26);
}
this_00 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pCVar8);
/* try { // try from 00165e4b to 00165e4f has its CatchHandler @ 00165fd5 */
KeyValues::KeyValues(this_00,param_1,(IKeyValuesSystem *)0x0,false);
pIVar5 = (IBaseFileSystem *)0x0;
if (g_pFileSystem != 0) {
pIVar5 = (IBaseFileSystem *)(g_pFileSystem + 4);
}
/* try { // try from 00165e76 to 00165e7a has its CatchHandler @ 00166026 */
cVar3 = KeyValues::LoadFromFile(this_00,pIVar5,param_1,"GAME");
uVar7 = 0;
if (cVar3 != '\0') {
/* try { // try from 00165f33 to 00165f67 has its CatchHandler @ 00166026 */
for (this_01 = (KeyValues *)KeyValues::GetFirstSubKey(this_00); this_01 != (KeyValues *)0x0;
this_01 = (KeyValues *)KeyValues::GetNextKey(this_01)) {
iVar6 = KeyValues::GetDataType(this_01,(char *)0x0);
if (iVar6 == 0) {
RegisterEvent(this,this_01);
}
}
if (*(int *)(net_showevents._28_4_ + 0x30) != 0) {
/* try { // try from 00165fce to 00165fd2 has its CatchHandler @ 00166026 */
DevMsg("Event System loaded %i events from file %s.\n",*(undefined4 *)(this + 0x10),param_1);
}
uVar7 = *(undefined4 *)(this + 0x10);
}
if (this_00 != (KeyValues *)0x0) {
KeyValues::deleteThis();
}
*(int *)(this + 0xa0) = *(int *)(this + 0xa0) + -1;
if (*(int *)(this + 0xa0) == 0) {
LOCK();
*(uint *)pCVar1 = 0;
UNLOCK();
}
if ((local_24 != (CGameEventManager *)0x0) && (_SetSeed != 0)) {
(**(code **)(_SetSeed + 0x6c))
(_SetSeed,local_24,1,"/data/src/public/tier0/vprof_telemetry.h",0x3fa,
&CTelemetryLock::Unlocked()::tm_fmt,"%s Released",local_20);
}
return uVar7;
}
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.