KeyValues::RecursiveLoadFromBuffer
0x0024f370 · 2311 bytes · __thiscall
_ZN9KeyValues23RecursiveLoadFromBufferEPKcR10CUtlBuffer
Decompiled
undefined (3 params)
/* KeyValues::RecursiveLoadFromBuffer(char const*, CUtlBuffer&) */
void __thiscall
KeyValues::RecursiveLoadFromBuffer(KeyValues *this,char *param_1,CUtlBuffer *param_2)
{
KeyValues *pKVar1;
uint uVar2;
int iVar3;
long lVar4;
int iVar5;
void *pvVar6;
char *pcVar7;
KeyValues *this_00;
uint uVar8;
uint uVar9;
int *piVar10;
uint *puVar11;
KeyValues *pKVar12;
uint uVar13;
undefined4 uVar14;
char cVar15;
int iVar16;
uint uVar17;
float fVar18;
double dVar19;
char local_35;
bool local_26;
bool local_25;
char *local_24;
char *local_20 [4];
if (this == (KeyValues *)0x0) {
uVar14 = 0xffffffff;
}
else {
uVar14 = *(undefined4 *)this;
}
if (DAT_003f41a4 < 0x40) {
(&g_KeyValuesErrorStack)[DAT_003f41a4] = uVar14;
}
iVar16 = DAT_003f41a4 + 1;
if (DAT_003f41a8 < iVar16) {
DAT_003f41a8 = DAT_003f41a4;
}
if (100 < DAT_003f41a4) {
pcVar7 = "RecursiveLoadFromBuffer: recursion overflow";
DAT_003f41a4 = iVar16;
uVar14 = DAT_003f41a0;
/* try { // try from 0024f8b8 to 0024f95b has its CatchHandler @ 0024fcd5 */
Warning("KeyValues Error: %s in file %s\n","RecursiveLoadFromBuffer: recursion overflow",
DAT_003f41a0);
iVar16 = 0;
if (0 < DAT_003f41a8) {
LAB_0024f903:
do {
if ((iVar16 < 0x40) && ((&g_KeyValuesErrorStack)[iVar16] != -1)) {
if (DAT_003f41a4 <= iVar16) {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))
(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a9,pcVar7,uVar14);
iVar16 = iVar16 + 1;
if (DAT_003f41a8 <= iVar16) break;
goto LAB_0024f903;
}
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a4,pcVar7,uVar14);
}
iVar16 = iVar16 + 1;
} while (iVar16 < DAT_003f41a8);
}
Warning("\n",pcVar7,uVar14);
DAT_003f41a4 = DAT_003f41a4 + -1;
return;
}
if (iVar16 < 0x40) {
(&g_KeyValuesErrorStack)[iVar16] = 0xffffffff;
}
DAT_003f41a4 = DAT_003f41a4 + 2;
if (DAT_003f41a8 < DAT_003f41a4) {
DAT_003f41a8 = iVar16;
}
while (pcVar7 = (char *)ReadToken(this,param_2,&local_26,&local_25), uVar14 = DAT_003f41a0,
pcVar7 != (char *)0x0) {
if (*pcVar7 == '\0') {
pcVar7 = "RecursiveLoadFromBuffer: got empty keyname";
Warning("KeyValues Error: %s in file %s\n","RecursiveLoadFromBuffer: got empty keyname",
DAT_003f41a0);
iVar16 = 0;
if (0 < DAT_003f41a8) {
do {
if ((iVar16 < 0x40) && ((&g_KeyValuesErrorStack)[iVar16] != -1)) {
if (iVar16 < DAT_003f41a4) {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))
(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a4,pcVar7,uVar14);
}
else {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))
(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a9,pcVar7,uVar14);
}
}
iVar16 = iVar16 + 1;
} while (iVar16 < DAT_003f41a8);
}
goto LAB_0024f7e0;
}
if ((*pcVar7 == '}') && (local_26 == false)) goto LAB_0024f7ec;
this_00 = (KeyValues *)CreateKey(this,pcVar7);
if (this_00 == (KeyValues *)0x0) {
pcVar7 = "RecursiveLoadFromBuffer: got NULL key";
uVar14 = DAT_003f41a0;
Warning("KeyValues Error: %s in file %s\n","RecursiveLoadFromBuffer: got NULL key",
DAT_003f41a0);
iVar16 = 0;
if (0 < DAT_003f41a8) {
do {
if ((iVar16 < 0x40) && ((&g_KeyValuesErrorStack)[iVar16] != -1)) {
if (iVar16 < DAT_003f41a4) {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))
(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a4,pcVar7,uVar14);
}
else {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))
(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a9,pcVar7,uVar14);
}
}
iVar16 = iVar16 + 1;
} while (iVar16 < DAT_003f41a8);
}
goto LAB_0024f7e0;
}
if (iVar16 < 0x40) {
(&g_KeyValuesErrorStack)[iVar16] = *(undefined4 *)this_00;
}
pcVar7 = (char *)ReadToken(this,param_2,&local_26,&local_25);
if (local_25 != false) {
if (pcVar7 != (char *)0x0) {
/* try { // try from 0024f3ef to 0024f7eb has its CatchHandler @ 0024fcec */
local_35 = EvaluateConditional(this,pcVar7);
pcVar7 = (char *)ReadToken(this,param_2,&local_26,&local_25);
goto LAB_0024f416;
}
LAB_0024f760:
pcVar7 = "RecursiveLoadFromBuffer: got NULL key";
uVar14 = DAT_003f41a0;
Warning("KeyValues Error: %s in file %s\n","RecursiveLoadFromBuffer: got NULL key",
DAT_003f41a0);
iVar16 = 0;
if (0 < DAT_003f41a8) goto LAB_0024f790;
goto LAB_0024f7e0;
}
local_35 = '\x01';
LAB_0024f416:
if (pcVar7 == (char *)0x0) goto LAB_0024f760;
uVar14 = DAT_003f41a0;
if (*pcVar7 == '}') {
if (local_26 == false) {
pcVar7 = "RecursiveLoadFromBuffer: got } in key";
Warning("KeyValues Error: %s in file %s\n","RecursiveLoadFromBuffer: got } in key",
DAT_003f41a0);
iVar16 = 0;
if (0 < DAT_003f41a8) {
do {
if ((iVar16 < 0x40) && ((&g_KeyValuesErrorStack)[iVar16] != -1)) {
if (iVar16 < DAT_003f41a4) {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))
(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a4,pcVar7,uVar14);
}
else {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))
(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a9,pcVar7,uVar14);
}
}
iVar16 = iVar16 + 1;
} while (iVar16 < DAT_003f41a8);
}
goto LAB_0024f7e0;
}
LAB_0024f431:
if (local_25 != false) {
pcVar7 = "RecursiveLoadFromBuffer: got conditional between key and value";
Warning("KeyValues Error: %s in file %s\n",
"RecursiveLoadFromBuffer: got conditional between key and value",DAT_003f41a0);
iVar16 = 0;
if (0 < DAT_003f41a8) {
do {
if ((iVar16 < 0x40) && ((&g_KeyValuesErrorStack)[iVar16] != -1)) {
if (iVar16 < DAT_003f41a4) {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))
(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a4,pcVar7,uVar14);
}
else {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))
(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a9,pcVar7,uVar14);
}
}
iVar16 = iVar16 + 1;
} while (iVar16 < DAT_003f41a8);
}
goto LAB_0024f7e0;
}
if (*(void **)(this_00 + 4) != (void *)0x0) {
operator_delete__(*(void **)(this_00 + 4));
*(undefined4 *)(this_00 + 4) = 0;
}
iVar3 = _V_strlen(pcVar7);
lVar4 = strtol(pcVar7,&local_24,10);
dVar19 = strtod(pcVar7,local_20);
fVar18 = (float)dVar19;
if ((1 < iVar3) && (iVar5 = tolower((int)pcVar7[1]), iVar5 == 0x78)) {
fVar18 = 0.0;
local_20[0] = pcVar7;
}
if (*pcVar7 == '\0') {
LAB_0024f4e6:
this_00[0x10] = (KeyValues)0x1;
pvVar6 = operator_new__(iVar3 + 1U);
*(void **)(this_00 + 4) = pvVar6;
_V_memcpy(pvVar6,pcVar7,iVar3 + 1U);
}
else if (((iVar3 == 0x12) && (*pcVar7 == '0')) && (pcVar7[1] == 'x')) {
iVar3 = 2;
uVar8 = 0;
uVar13 = 0;
do {
cVar15 = pcVar7[iVar3];
if (cVar15 < 'a') {
if ('@' < cVar15) {
cVar15 = cVar15 + -7;
}
}
else {
cVar15 = cVar15 + -0x27;
}
uVar2 = uVar8 >> 0x1c;
uVar17 = (int)cVar15 - 0x30;
uVar9 = uVar8 * 0x10;
uVar8 = uVar9 + uVar17;
uVar13 = (uVar13 << 4 | uVar2) + ((int)uVar17 >> 0x1f) + (uint)CARRY4(uVar9,uVar17);
iVar3 = iVar3 + 1;
} while (iVar3 != 0x12);
puVar11 = operator_new__(8);
*(uint **)(this_00 + 4) = puVar11;
*puVar11 = uVar8;
puVar11[1] = uVar13;
this_00[0x10] = (KeyValues)0x7;
}
else if ((local_24 < local_20[0]) && (pcVar7 + iVar3 == local_20[0])) {
this_00[0x10] = (KeyValues)0x3;
*(float *)(this_00 + 0xc) = fVar18;
}
else {
if (pcVar7 + iVar3 != local_24) goto LAB_0024f4e6;
this_00[0x10] = (KeyValues)0x2;
*(long *)(this_00 + 0xc) = lVar4;
}
uVar14 = *(undefined4 *)(param_2 + 0xc);
pcVar7 = (char *)ReadToken(this,param_2,&local_26,&local_25);
if (local_25 == false) {
CUtlBuffer::SeekGet(param_2,0,uVar14);
}
else {
local_35 = EvaluateConditional(this,pcVar7);
}
}
else {
if ((*pcVar7 != '{') || (local_26 != false)) goto LAB_0024f431;
if (iVar16 < 0x40) {
(&g_KeyValuesErrorStack)[iVar16] = 0xffffffff;
}
RecursiveLoadFromBuffer(this_00,param_1,param_2);
}
if (local_35 == '\0') {
pKVar1 = *(KeyValues **)(this + 0x20);
if (this_00 == *(KeyValues **)(this + 0x20)) {
*(undefined4 *)(this + 0x20) = *(undefined4 *)(this_00 + 0x1c);
}
else {
do {
pKVar12 = pKVar1;
pKVar1 = *(KeyValues **)(pKVar12 + 0x1c);
if (pKVar1 == (KeyValues *)0x0) goto LAB_0024f632;
} while (this_00 != pKVar1);
*(undefined4 *)(pKVar12 + 0x1c) = *(undefined4 *)(this_00 + 0x1c);
}
LAB_0024f632:
*(undefined4 *)(this_00 + 0x1c) = 0;
deleteThis();
}
}
pcVar7 = "RecursiveLoadFromBuffer: got EOF instead of keyname";
Warning("KeyValues Error: %s in file %s\n","RecursiveLoadFromBuffer: got EOF instead of keyname",
DAT_003f41a0);
iVar16 = 0;
if (0 < DAT_003f41a8) {
do {
if ((iVar16 < 0x40) && ((&g_KeyValuesErrorStack)[iVar16] != -1)) {
if (iVar16 < DAT_003f41a4) {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a4,pcVar7,uVar14);
}
else {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a9,pcVar7,uVar14);
}
}
iVar16 = iVar16 + 1;
} while (iVar16 < DAT_003f41a8);
}
goto LAB_0024f7e0;
while( true ) {
if (iVar16 < DAT_003f41a4) {
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a4,pcVar7,uVar14);
goto LAB_0024f7d3;
}
/* try { // try from 0024f970 to 0024fca7 has its CatchHandler @ 0024fcec */
piVar10 = (int *)KeyValuesSystem();
pcVar7 = (char *)(**(code **)(*piVar10 + 0x18))(piVar10,(&g_KeyValuesErrorStack)[iVar16]);
Warning(&DAT_002cc2a9,pcVar7,uVar14);
iVar16 = iVar16 + 1;
if (DAT_003f41a8 <= iVar16) break;
LAB_0024f790:
if ((0x3f < iVar16) || ((&g_KeyValuesErrorStack)[iVar16] == -1)) {
LAB_0024f7d3:
iVar16 = iVar16 + 1;
if (DAT_003f41a8 <= iVar16) break;
goto LAB_0024f790;
}
}
LAB_0024f7e0:
Warning("\n",pcVar7,uVar14);
LAB_0024f7ec:
DAT_003f41a4 = DAT_003f41a4 + -2;
return;
}
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.