CPureServerWhitelist::LoadFromKeyValues
0x001d7c10 · 889 bytes · __thiscall
_ZN20CPureServerWhitelist17LoadFromKeyValuesEP9KeyValues
Decompiled
undefined (2 params)
/* CPureServerWhitelist::LoadFromKeyValues(KeyValues*) */
undefined4 __thiscall
CPureServerWhitelist::LoadFromKeyValues(CPureServerWhitelist *this,KeyValues *param_1)
{
int iVar1;
short sVar2;
bool bVar3;
CCommand CVar4;
KeyValues *this_00;
char *pcVar5;
char *pcVar6;
int iVar7;
int iVar8;
CUtlRBTree<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int,CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int>,int>>
*this_01;
int in_GS_OFFSET;
CCommand local_255;
CCommand *local_24c;
char *local_248 [2];
int local_240 [3];
int local_234;
char local_228 [260];
char local_124 [260];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
this_00 = (KeyValues *)KeyValues::GetFirstValue(param_1);
do {
if (this_00 == (KeyValues *)0x0) {
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return 1;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
pcVar5 = (char *)KeyValues::GetName(this_00);
pcVar6 = (char *)KeyValues::GetString(this_00,(char *)0x0,"");
if ((pcVar6 != (char *)0x0) && (pcVar5 != (char *)0x0)) {
V_strncpy(local_228,pcVar5,0x104);
V_FixSlashes(local_228,'/');
CSplitString::CSplitString((CSplitString *)local_240,pcVar6,"+");
if (local_234 < 1) {
LAB_001d7d9f:
local_255 = (CCommand)0x0;
CVar4 = (CCommand)0x0;
}
else {
iVar8 = 0;
local_255 = (CCommand)0x0;
bVar3 = false;
CVar4 = (CCommand)0x0;
do {
while( true ) {
iVar1 = iVar8 * 4;
/* try { // try from 001d7d43 to 001d7f73 has its CatchHandler @ 001d7f95 */
iVar7 = _V_stricmp(*(char **)(local_240[0] + iVar8 * 4),"from_steam");
if (iVar7 != 0) break;
bVar3 = true;
LAB_001d7d1d:
iVar8 = iVar8 + 1;
if (local_234 <= iVar8) goto LAB_001d7d7f;
}
iVar7 = _V_stricmp(*(char **)(local_240[0] + iVar1),"allow_from_disk");
if (iVar7 != 0) {
iVar7 = _V_stricmp(*(char **)(local_240[0] + iVar1),"check_crc");
if (iVar7 == 0) {
local_255 = (CCommand)0x1;
}
else {
Warning("Unknown modifier in whitelist file: %s.\n",
*(undefined4 *)(local_240[0] + iVar1));
}
goto LAB_001d7d1d;
}
iVar8 = iVar8 + 1;
CVar4 = (CCommand)0x1;
} while (iVar8 < local_234);
LAB_001d7d7f:
if (bVar3) {
if (((bool)CVar4) || (local_255 != (CCommand)0x0)) {
Warning("Whitelist: from_steam not compatible with other modifiers (used on %s).\n",
local_228);
Warning(" Other markers removed.\n");
}
goto LAB_001d7d9f;
}
}
local_24c = operator_new(4);
sVar2 = *(short *)this;
*(short *)this = sVar2 + 1;
*(short *)(local_24c + 2) = sVar2;
*local_24c = CVar4;
local_24c[1] = local_255;
pcVar5 = (char *)V_UnqualifiedFileName(local_228);
iVar8 = _V_stricmp(pcVar5,"...");
this_01 = (CUtlRBTree<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int,CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int>,int>>
*)(this + 0x2c);
if (iVar8 == 0) {
LAB_001d7e1c:
V_ExtractFilePath(local_228,local_124,0x104);
}
else {
iVar8 = _V_stricmp(pcVar5,"*.*");
this_01 = (CUtlRBTree<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int,CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int>,int>>
*)(this + 8);
if (iVar8 == 0) {
this_01 = (CUtlRBTree<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int,CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int>,int>>
*)(this + 0x50);
}
if ((this_01 ==
(CUtlRBTree<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int,CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int>,int>>
*)(this + 0x2c)) ||
(this_01 ==
(CUtlRBTree<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int,CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int>,int>>
*)(this + 0x50))) goto LAB_001d7e1c;
V_strncpy(local_124,local_228,0x104);
}
V_FixSlashes(local_124,'/');
local_248[0] = local_124;
iVar8 = CUtlRBTree<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int,CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CPureServerWhitelist::CCommand*,int>::Node_t,int>,int>>
::Find(this_01,(Node_t *)local_248);
if (iVar8 == -1) {
CUtlDict<CPureServerWhitelist::CCommand*,int>::Insert
((CUtlDict<CPureServerWhitelist::CCommand*,int> *)this_01,local_124,&local_24c);
}
else {
Error("Pure server whitelist entry \'%s\' is a duplicate.\n",local_124);
}
CSplitString::~CSplitString((CSplitString *)local_240);
}
this_00 = (KeyValues *)KeyValues::GetNextValue(this_00);
} 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.