KeyValues::ReadToken
0x0024bf80 · 665 bytes · __thiscall
_ZN9KeyValues9ReadTokenER10CUtlBufferRbS2_
Decompiled
undefined (4 params)
/* KeyValues::ReadToken(CUtlBuffer&, bool&, bool&) */
undefined1 * __thiscall
KeyValues::ReadToken(KeyValues *this,CUtlBuffer *param_1,bool *param_2,bool *param_3)
{
undefined4 *puVar1;
bool bVar2;
bool bVar3;
char cVar4;
char *pcVar5;
int *piVar6;
CUtlCharConversion *pCVar7;
int iVar8;
int iVar9;
undefined4 uVar10;
*param_2 = false;
*param_3 = false;
if (param_1[0x14] == (CUtlBuffer)0x0) {
do {
CUtlBuffer::EatWhiteSpace(param_1);
if (param_1[0x14] != (CUtlBuffer)0x0) {
return (undefined1 *)0x0;
}
cVar4 = CUtlBuffer::EatCPPComment(param_1);
} while (cVar4 != '\0');
pcVar5 = (char *)CUtlBuffer::PeekGet(param_1,1,0);
if (pcVar5 != (char *)0x0) {
cVar4 = *pcVar5;
if (cVar4 == '\"') {
*param_2 = true;
if (this[0x11] == (KeyValues)0x0) {
pCVar7 = (CUtlCharConversion *)GetNoEscCharConversion();
}
else {
pCVar7 = (CUtlCharConversion *)GetCStringCharConversion();
}
CUtlBuffer::GetDelimitedString(param_1,pCVar7,&s_pTokenBuf,0x400);
return &s_pTokenBuf;
}
if ((cVar4 == '}') || (cVar4 == '{')) {
DAT_003f46a1 = 0;
s_pTokenBuf = cVar4;
CUtlBuffer::SeekGet(param_1,1,1);
return &s_pTokenBuf;
}
bVar3 = false;
iVar8 = 0;
bVar2 = false;
while ((((pcVar5 = (char *)CUtlBuffer::PeekGet(param_1,1,0), pcVar5 != (char *)0x0 &&
(cVar4 = *pcVar5, cVar4 != '\0')) && (cVar4 != '{')) &&
((cVar4 != '\"' && (cVar4 != '}'))))) {
if (cVar4 == '[') {
bVar3 = true;
}
else {
if (cVar4 == ']') {
if (!bVar3) goto LAB_0024c07e;
bVar3 = false;
*param_3 = true;
cVar4 = *pcVar5;
}
if ((((int)cVar4 - 9U < 0x18) &&
((1 << ((byte)((int)cVar4 - 9U) & 0x1f) & 0x80001fU) != 0)) && (!bVar3)) break;
}
LAB_0024c07e:
if (iVar8 < 0x3ff) {
(&s_pTokenBuf)[iVar8] = cVar4;
iVar8 = iVar8 + 1;
}
else if (!bVar2) {
pcVar5 = " ReadToken overflow";
iVar9 = 0;
uVar10 = DAT_003f41a0;
Warning("KeyValues Error: %s in file %s\n"," ReadToken overflow",DAT_003f41a0);
if (0 < DAT_003f41a8) {
do {
while ((0x3f < iVar9 || ((&g_KeyValuesErrorStack)[iVar9] == -1))) {
LAB_0024c128:
iVar9 = iVar9 + 1;
if (DAT_003f41a8 <= iVar9) goto LAB_0024c180;
}
if (iVar9 < DAT_003f41a4) {
piVar6 = (int *)KeyValuesSystem();
pcVar5 = (char *)(**(code **)(*piVar6 + 0x18))
(piVar6,(&g_KeyValuesErrorStack)[iVar9]);
Warning(&DAT_002cc2a4,pcVar5,uVar10);
goto LAB_0024c128;
}
piVar6 = (int *)KeyValuesSystem();
puVar1 = &g_KeyValuesErrorStack + iVar9;
iVar9 = iVar9 + 1;
pcVar5 = (char *)(**(code **)(*piVar6 + 0x18))(piVar6,*puVar1);
Warning(&DAT_002cc2a9,pcVar5,uVar10);
} while (iVar9 < DAT_003f41a8);
}
LAB_0024c180:
bVar2 = true;
Warning("\n",pcVar5,uVar10);
}
CUtlBuffer::SeekGet(param_1,1,1);
}
(&s_pTokenBuf)[iVar8] = 0;
return &s_pTokenBuf;
}
}
return (undefined1 *)0x0;
}
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.