L L4D2node

KeyValues::MergeFrom

0x00045dc0 · 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_00046248:
            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_00046286:
            pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
            if (pKVar8 != (KeyValues *)0x0) goto LAB_00046280;
            pKVar7 = *(KeyValues **)(param_1 + 0x20);
            while( true ) {
              if (pKVar7 == (KeyValues *)0x0) {
                return;
              }
              if (pKVar7[0x10] != (KeyValues)0x0) break;
              pKVar7 = *(KeyValues **)(pKVar7 + 0x1c);
            }
            goto LAB_000461c8;
          }
          pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
          if (pKVar8 == (KeyValues *)0x0) {
LAB_000461c8:
            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_00046209;
                  } while (iVar5 != iVar2);
                  *(undefined4 *)(iVar6 + 0x1c) = *(undefined4 *)(iVar5 + 0x1c);
                }
LAB_00046209:
                *(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_00046020:
              pcVar4 = (char *)GetName(pKVar8);
              iVar5 = FindKey(this,pcVar4,false);
              if (iVar5 != 0) {
                MergeFrom((KeyValues *)iVar5,pKVar8,2);
              }
LAB_00046066:
              pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
              if (pKVar8 != (KeyValues *)0x0) goto LAB_00046060;
              pKVar7 = *(KeyValues **)(param_1 + 0x20);
              while( true ) {
                if (pKVar7 == (KeyValues *)0x0) {
                  return;
                }
                if (pKVar7[0x10] != (KeyValues)0x0) break;
                pKVar7 = *(KeyValues **)(pKVar7 + 0x1c);
              }
              goto LAB_00045fa8;
            }
            pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
            if (pKVar8 == (KeyValues *)0x0) {
LAB_00045fa8:
              do {
                pcVar4 = (char *)GetName(pKVar7);
                iVar5 = FindKey(this,pcVar4,false);
                if (iVar5 == 0) goto LAB_0004600e;
                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_00045ff8;
                    }
                  } while (iVar5 != iVar2);
                  *(undefined4 *)(iVar6 + 0x1c) = *(undefined4 *)(iVar5 + 0x1c);
                  *(undefined4 *)(iVar5 + 0x1c) = 0;
                  deleteThis();
                }
LAB_00045ff8:
                pKVar7 = *(KeyValues **)(pKVar7 + 0x1c);
                while( true ) {
                  if (pKVar7 == (KeyValues *)0x0) {
                    return;
                  }
                  if (pKVar7[0x10] != (KeyValues)0x0) break;
LAB_0004600e:
                  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_00045ee8:
            pcVar4 = (char *)GetName(pKVar8);
            iVar5 = FindKey(this,pcVar4,false);
            if (iVar5 != 0) {
              MergeFrom((KeyValues *)iVar5,pKVar8,3);
            }
LAB_00045f26:
            pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
            if (pKVar8 != (KeyValues *)0x0) goto LAB_00045f20;
            pKVar7 = *(KeyValues **)(param_1 + 0x20);
            while( true ) {
              if (pKVar7 == (KeyValues *)0x0) {
                return;
              }
              if (pKVar7[0x10] != (KeyValues)0x0) break;
              pKVar7 = *(KeyValues **)(pKVar7 + 0x1c);
            }
            goto LAB_00045e40;
          }
          pKVar8 = *(KeyValues **)(pKVar8 + 0x1c);
          if (pKVar8 == (KeyValues *)0x0) {
LAB_00045e40:
            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_00045e82;
                  } while (iVar5 != iVar2);
                  *(undefined4 *)(iVar6 + 0x1c) = *(undefined4 *)(iVar5 + 0x1c);
                }
LAB_00045e82:
                *(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_00046280:
  if (pKVar8[0x10] == (KeyValues)0x0) goto LAB_00046248;
  goto LAB_00046286;
LAB_00046060:
  if (pKVar8[0x10] == (KeyValues)0x0) goto LAB_00046020;
  goto LAB_00046066;
LAB_00045f20:
  if (pKVar8[0x10] == (KeyValues)0x0) goto LAB_00045ee8;
  goto LAB_00045f26;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)