KeyValues::MergeFrom
0x00250fb0 · 1232 bytes · __thiscall
_ZN9KeyValues9MergeFromEPS_NS_18MergeKeyValuesOp_tE
Decompiled
undefined (3 params)
/* KeyValues::MergeFrom(KeyValues*, KeyValues::MergeKeyValuesOp_t) */
void __thiscall KeyValues::MergeFrom(KeyValues *this,KeyValues *param_1,int param_3)
{
KeyValues KVar1;
int iVar2;
undefined4 uVar3;
char *pcVar4;
int iVar5;
int iVar6;
KeyValues *pKVar7;
KeyValues *pKVar8;
if ((param_1 != (KeyValues *)0x0) && (this != (KeyValues *)0x0)) {
if (param_3 == 1) {
pKVar7 = *(KeyValues **)(param_1 + 0x20);
if (pKVar7 != (KeyValues *)0x0) {
KVar1 = pKVar7[0x10];
pKVar8 = pKVar7;
do {
if (KVar1 == (KeyValues)0x0) {
LAB_00251438:
pcVar4 = (char *)GetName(pKVar8);
iVar5 = FindKey(this,pcVar4,false);
if (iVar5 == 0) {
uVar3 = MakeCopy(pKVar8);
iVar5 = *(int *)(this + 0x20);
if (iVar5 == 0) {
*(undefined4 *)(this + 0x20) = uVar3;
}
else {
for (iVar2 = *(int *)(iVar5 + 0x1c); iVar2 != 0; iVar2 = *(int *)(iVar2 + 0x1c)) {
iVar5 = iVar2;
}
*(undefined4 *)(iVar5 + 0x1c) = uVar3;
}
}
else {
MergeFrom((KeyValues *)iVar5,pKVar8,1);
}
LAB_00251476:
pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
if (pKVar8 != (KeyValues *)0x0) goto LAB_00251470;
pKVar7 = *(KeyValues **)(param_1 + 0x20);
while( true ) {
if (pKVar7 == (KeyValues *)0x0) {
return;
}
if (pKVar7[0x10] != (KeyValues)0x0) break;
pKVar7 = *(KeyValues **)(pKVar7 + 0x1c);
}
goto LAB_002513b8;
}
pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
if (pKVar8 == (KeyValues *)0x0) {
LAB_002513b8:
do {
pcVar4 = (char *)GetName(pKVar7);
iVar5 = FindKey(this,pcVar4,false);
if (iVar5 != 0) {
iVar2 = *(int *)(this + 0x20);
if (iVar5 == *(int *)(this + 0x20)) {
*(undefined4 *)(this + 0x20) = *(undefined4 *)(iVar5 + 0x1c);
}
else {
do {
iVar6 = iVar2;
iVar2 = *(int *)(iVar6 + 0x1c);
if (iVar2 == 0) goto LAB_002513f9;
} while (iVar5 != iVar2);
*(undefined4 *)(iVar6 + 0x1c) = *(undefined4 *)(iVar5 + 0x1c);
}
LAB_002513f9:
*(undefined4 *)(iVar5 + 0x1c) = 0;
deleteThis();
}
uVar3 = MakeCopy(pKVar7);
iVar5 = *(int *)(this + 0x20);
if (iVar5 == 0) {
*(undefined4 *)(this + 0x20) = uVar3;
}
else {
for (iVar2 = *(int *)(iVar5 + 0x1c); iVar2 != 0; iVar2 = *(int *)(iVar2 + 0x1c)) {
iVar5 = iVar2;
}
*(undefined4 *)(iVar5 + 0x1c) = uVar3;
}
do {
pKVar7 = *(KeyValues **)(pKVar7 + 0x1c);
if (pKVar7 == (KeyValues *)0x0) {
return;
}
} while (pKVar7[0x10] == (KeyValues)0x0);
} while( true );
}
KVar1 = pKVar8[0x10];
} while( true );
}
}
else {
if (param_3 < 2) {
if (param_3 != 0) {
return;
}
uVar3 = FindKey(param_1,"Update",false);
MergeFrom(this,uVar3,1);
uVar3 = FindKey(param_1,"Delete",false);
MergeFrom(this,uVar3,2);
param_1 = (KeyValues *)FindKey(param_1,"Borrow",false);
if (param_1 == (KeyValues *)0x0) {
return;
}
}
else {
if (param_3 == 2) {
pKVar7 = *(KeyValues **)(param_1 + 0x20);
if (pKVar7 == (KeyValues *)0x0) {
return;
}
KVar1 = pKVar7[0x10];
pKVar8 = pKVar7;
do {
if (KVar1 == (KeyValues)0x0) {
LAB_00251210:
pcVar4 = (char *)GetName(pKVar8);
iVar5 = FindKey(this,pcVar4,false);
if (iVar5 != 0) {
MergeFrom((KeyValues *)iVar5,pKVar8,2);
}
LAB_00251256:
pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
if (pKVar8 != (KeyValues *)0x0) goto LAB_00251250;
pKVar7 = *(KeyValues **)(param_1 + 0x20);
while( true ) {
if (pKVar7 == (KeyValues *)0x0) {
return;
}
if (pKVar7[0x10] != (KeyValues)0x0) break;
pKVar7 = *(KeyValues **)(pKVar7 + 0x1c);
}
goto LAB_00251198;
}
pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
if (pKVar8 == (KeyValues *)0x0) {
LAB_00251198:
do {
pcVar4 = (char *)GetName(pKVar7);
iVar5 = FindKey(this,pcVar4,false);
if (iVar5 == 0) goto LAB_002511fe;
iVar2 = *(int *)(this + 0x20);
if (iVar5 == *(int *)(this + 0x20)) {
*(undefined4 *)(this + 0x20) = *(undefined4 *)(iVar5 + 0x1c);
*(undefined4 *)(iVar5 + 0x1c) = 0;
deleteThis();
}
else {
do {
iVar6 = iVar2;
iVar2 = *(int *)(iVar6 + 0x1c);
if (iVar2 == 0) {
*(undefined4 *)(iVar5 + 0x1c) = 0;
deleteThis();
goto LAB_002511e8;
}
} while (iVar5 != iVar2);
*(undefined4 *)(iVar6 + 0x1c) = *(undefined4 *)(iVar5 + 0x1c);
*(undefined4 *)(iVar5 + 0x1c) = 0;
deleteThis();
}
LAB_002511e8:
pKVar7 = *(KeyValues **)(pKVar7 + 0x1c);
while( true ) {
if (pKVar7 == (KeyValues *)0x0) {
return;
}
if (pKVar7[0x10] != (KeyValues)0x0) break;
LAB_002511fe:
pKVar7 = *(KeyValues **)(pKVar7 + 0x1c);
}
} while( true );
}
KVar1 = pKVar8[0x10];
} while( true );
}
if (param_3 != 3) {
return;
}
}
pKVar7 = *(KeyValues **)(param_1 + 0x20);
if (pKVar7 != (KeyValues *)0x0) {
KVar1 = pKVar7[0x10];
pKVar8 = pKVar7;
do {
if (KVar1 == (KeyValues)0x0) {
LAB_002510d8:
pcVar4 = (char *)GetName(pKVar8);
iVar5 = FindKey(this,pcVar4,false);
if (iVar5 != 0) {
MergeFrom((KeyValues *)iVar5,pKVar8,3);
}
LAB_00251116:
pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
if (pKVar8 != (KeyValues *)0x0) goto LAB_00251110;
pKVar7 = *(KeyValues **)(param_1 + 0x20);
while( true ) {
if (pKVar7 == (KeyValues *)0x0) {
return;
}
if (pKVar7[0x10] != (KeyValues)0x0) break;
pKVar7 = *(KeyValues **)(pKVar7 + 0x1c);
}
goto LAB_00251030;
}
pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
if (pKVar8 == (KeyValues *)0x0) {
LAB_00251030:
do {
pcVar4 = (char *)GetName(pKVar7);
iVar5 = FindKey(this,pcVar4,false);
if (iVar5 != 0) {
iVar2 = *(int *)(this + 0x20);
if (iVar5 == *(int *)(this + 0x20)) {
*(undefined4 *)(this + 0x20) = *(undefined4 *)(iVar5 + 0x1c);
}
else {
do {
iVar6 = iVar2;
iVar2 = *(int *)(iVar6 + 0x1c);
if (iVar2 == 0) goto LAB_00251072;
} while (iVar5 != iVar2);
*(undefined4 *)(iVar6 + 0x1c) = *(undefined4 *)(iVar5 + 0x1c);
}
LAB_00251072:
*(undefined4 *)(iVar5 + 0x1c) = 0;
deleteThis();
uVar3 = MakeCopy(pKVar7);
iVar5 = *(int *)(this + 0x20);
if (iVar5 == 0) {
*(undefined4 *)(this + 0x20) = uVar3;
}
else {
for (iVar2 = *(int *)(iVar5 + 0x1c); iVar2 != 0; iVar2 = *(int *)(iVar2 + 0x1c)) {
iVar5 = iVar2;
}
*(undefined4 *)(iVar5 + 0x1c) = uVar3;
}
}
do {
pKVar7 = *(KeyValues **)(pKVar7 + 0x1c);
if (pKVar7 == (KeyValues *)0x0) {
return;
}
} while (pKVar7[0x10] == (KeyValues)0x0);
} while( true );
}
KVar1 = pKVar8[0x10];
} while( true );
}
}
}
return;
LAB_00251470:
if (pKVar8[0x10] == (KeyValues)0x0) goto LAB_00251438;
goto LAB_00251476;
LAB_00251250:
if (pKVar8[0x10] == (KeyValues)0x0) goto LAB_00251210;
goto LAB_00251256;
LAB_00251110:
if (pKVar8[0x10] == (KeyValues)0x0) goto LAB_002510d8;
goto LAB_00251116;
}
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.