KeyValues::RecursiveCopyKeyValues
0x00b6fd80 · 575 bytes · __thiscall
_ZN9KeyValues22RecursiveCopyKeyValuesERS_
Decompiled
undefined (2 params)
/* KeyValues::RecursiveCopyKeyValues(KeyValues&) */
void __thiscall KeyValues::RecursiveCopyKeyValues(KeyValues *this,KeyValues *param_1)
{
float fVar1;
undefined4 uVar2;
KeyValues *pKVar3;
int iVar4;
char *pcVar5;
void *pvVar6;
int in_GS_OFFSET;
KeyValues *in_stack_fffffeb8;
KeyValues local_120 [256];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (param_1 == (KeyValues *)0x0) {
*(undefined4 *)this = 0xffffffff;
if (iRam00000020 == 0) goto LAB_00b6fe80;
goto LAB_00b6fdb4;
}
*(undefined4 *)this = *(undefined4 *)param_1;
if (*(int *)(param_1 + 0x20) != 0) goto LAB_00b6fdb4;
LAB_00b6fe80:
this[0x10] = param_1[0x10];
switch(param_1[0x10]) {
case (KeyValues)0x1:
if (*(char **)(param_1 + 4) != (char *)0x0) {
iVar4 = _V_strlen(*(char **)(param_1 + 4));
pcVar5 = operator_new__(iVar4 + 1U);
*(char **)(this + 4) = pcVar5;
in_stack_fffffeb8 = *(KeyValues **)(param_1 + 4);
V_strncpy(pcVar5,(char *)in_stack_fffffeb8,iVar4 + 1U);
}
break;
case (KeyValues)0x2:
uVar2 = *(undefined4 *)(param_1 + 0xc);
*(undefined4 *)(this + 0xc) = uVar2;
V_snprintf((char *)local_120,0x100,"%d",uVar2);
goto LAB_00b6ff44;
case (KeyValues)0x3:
fVar1 = *(float *)(param_1 + 0xc);
*(float *)(this + 0xc) = fVar1;
V_snprintf((char *)local_120,0x100,"%f",(double)fVar1);
LAB_00b6ff44:
in_stack_fffffeb8 = local_120;
iVar4 = _V_strlen((char *)in_stack_fffffeb8);
pcVar5 = operator_new__(iVar4 + 1U);
*(char **)(this + 4) = pcVar5;
V_strncpy(pcVar5,(char *)in_stack_fffffeb8,iVar4 + 1U);
break;
case (KeyValues)0x4:
*(undefined4 *)(this + 0xc) = *(undefined4 *)(param_1 + 0xc);
break;
case (KeyValues)0x6:
this[0xc] = param_1[0xc];
this[0xd] = param_1[0xd];
this[0xe] = param_1[0xe];
this[0xf] = param_1[0xf];
break;
case (KeyValues)0x7:
pvVar6 = operator_new__(8);
*(void **)(this + 4) = pvVar6;
in_stack_fffffeb8 = *(KeyValues **)(param_1 + 4);
_V_memcpy(pvVar6,in_stack_fffffeb8,8);
}
if (*(int *)(param_1 + 0x20) != 0) {
LAB_00b6fdb4:
pKVar3 = operator_new((KeyValues *)0x2c,(uint)in_stack_fffffeb8);
Init(pKVar3,*(IKeyValuesSystem **)(this + 0x14),false);
/* try { // try from 00b6fde4 to 00b6fde8 has its CatchHandler @ 00b6ffe0 */
SetName(pKVar3,(char *)0x0);
*(KeyValues **)(this + 0x20) = pKVar3;
in_stack_fffffeb8 = *(KeyValues **)(param_1 + 0x20);
RecursiveCopyKeyValues(pKVar3,in_stack_fffffeb8);
}
if (*(int *)(param_1 + 0x1c) != 0) {
pKVar3 = operator_new((KeyValues *)0x2c,(uint)in_stack_fffffeb8);
Init(pKVar3,*(IKeyValuesSystem **)(this + 0x14),false);
/* try { // try from 00b6fe32 to 00b6fe36 has its CatchHandler @ 00b6fff2 */
SetName(pKVar3,(char *)0x0);
*(KeyValues **)(this + 0x1c) = pKVar3;
RecursiveCopyKeyValues(pKVar3,*(KeyValues **)(param_1 + 0x1c));
}
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.