CMatchExtL4D::LoadGameModesFromFile
0x00034da0 · 627 bytes · __thiscall
_ZN12CMatchExtL4D21LoadGameModesFromFileEPKc
Decompiled
undefined (2 params)
/* CMatchExtL4D::LoadGameModesFromFile(char const*) */
void __thiscall CMatchExtL4D::LoadGameModesFromFile(CMatchExtL4D *this,char *param_1)
{
char cVar1;
KeyValues *pKVar2;
KeyValues *pKVar3;
char *pcVar4;
undefined4 uVar5;
int iVar6;
char *__nptr;
long lVar7;
IBaseFileSystem *pIVar8;
undefined *puVar9;
int in_GS_OFFSET;
longlong lVar10;
int local_134;
CFmtStrN<256> local_12c [5];
char local_127 [263];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
pKVar2 = (KeyValues *)KeyValues::FindKey(*(KeyValues **)(this + 4),"GameModes",true);
if (pKVar2 != (KeyValues *)0x0) {
pIVar8 = (IBaseFileSystem *)0x0;
if (g_pFullFileSystem != 0) {
pIVar8 = (IBaseFileSystem *)(g_pFullFileSystem + 4);
}
cVar1 = KeyValues::LoadFromFile(pKVar2,pIVar8,param_1,(char *)0x0);
if (cVar1 == '\0') {
Warning("CMatchExtL4D: Unabled to load game modes from \"%s\".\n",param_1);
}
else {
pKVar2 = (KeyValues *)KeyValues::GetFirstTrueSubKey(pKVar2);
local_134 = 0;
while (pKVar2 != (KeyValues *)0x0) {
pKVar3 = (KeyValues *)KeyValues::GetNextTrueSubKey(pKVar2);
lVar10 = KeyValues::GetUint64((char *)pKVar2,0xb0b8f);
if (lVar10 != 0) {
KeyValues::SetUint64((char *)pKVar2,0xb0b8f);
}
pcVar4 = (char *)KeyValues::GetName(pKVar2);
uVar5 = KeyValues::GetString(pKVar2,"base",pcVar4);
iVar6 = StringAfterPrefix(pcVar4,"team");
puVar9 = &DAT_000afc16;
if (iVar6 == 0) {
puVar9 = &DAT_000b2b65;
}
CFmtStrN<256>::CFmtStrN(local_12c,"%s%s",puVar9,uVar5);
iVar6 = _V_stricmp(local_127,pcVar4);
if (iVar6 == 0) {
LAB_00034edf:
iVar6 = 0;
}
else {
KeyValues::SetInt(pKVar2,"mutation",1);
__nptr = (char *)StringAfterPrefix(pcVar4,"mutation");
if (__nptr == (char *)0x0) {
pcVar4 = (char *)StringAfterPrefix(pcVar4,"community");
if ((pcVar4 == (char *)0x0) || (lVar7 = strtol(pcVar4,(char **)0x0,10), 5 < lVar7 - 1U))
goto LAB_00034f64;
goto LAB_00034edf;
}
lVar7 = strtol(__nptr,(char **)0x0,10);
if (lVar7 - 1U < 0x14) goto LAB_00034edf;
LAB_00034f64:
iVar6 = 1;
}
KeyValues::SetInt(pKVar2,"addon",iVar6);
local_134 = local_134 + 1;
pKVar2 = pKVar3;
}
DevMsg("\tLoaded %d game modes.\n",local_134);
}
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.