L L4D2node

KeyValues::MakeCopy

0x00b70060 · 336 bytes · __thiscall

_ZNK9KeyValues8MakeCopyEv

Decompiled

undefined (1 param)

/* KeyValues::MakeCopy() const */

KeyValues * __thiscall KeyValues::MakeCopy(KeyValues *this)

{
  uint uVar1;
  char *pcVar2;
  KeyValues *this_00;
  int iVar3;
  size_t sVar4;
  void *pvVar5;
  uint uVar6;
  uint in_stack_ffffffd8;
  
  pcVar2 = (char *)GetName(this);
  this_00 = operator_new((KeyValues *)0x2c,in_stack_ffffffd8);
  Init(this_00,(IKeyValuesSystem *)0x0,false);
                    /* try { // try from 00b700a3 to 00b700a7 has its CatchHandler @ 00b701d3 */
  SetName(this_00,pcVar2);
  this_00[0x10] = this[0x10];
  switch(this[0x10]) {
  case (KeyValues)0x1:
    if (*(char **)(this + 4) != (char *)0x0) {
      iVar3 = _V_strlen(*(char **)(this + 4));
      pvVar5 = operator_new__(iVar3 + 1U);
      *(void **)(this_00 + 4) = pvVar5;
      _V_memcpy(pvVar5,*(void **)(this + 4),iVar3 + 1U);
    }
    break;
  case (KeyValues)0x2:
  case (KeyValues)0x4:
    *(undefined4 *)(this_00 + 0xc) = *(undefined4 *)(this + 0xc);
    break;
  case (KeyValues)0x3:
    *(undefined4 *)(this_00 + 0xc) = *(undefined4 *)(this + 0xc);
    break;
  case (KeyValues)0x5:
    if (*(wchar_t **)(this + 8) != (wchar_t *)0x0) {
      sVar4 = wcslen(*(wchar_t **)(this + 8));
      uVar1 = (sVar4 + 1) * 4;
      uVar6 = uVar1;
      if (0x1fc00000 < sVar4 + 1) {
        uVar6 = 0xffffffff;
      }
      pvVar5 = operator_new__(uVar6);
      *(void **)(this_00 + 8) = pvVar5;
      _V_memcpy(pvVar5,*(void **)(this + 8),uVar1);
    }
    break;
  case (KeyValues)0x6:
    this_00[0xc] = this[0xc];
    this_00[0xd] = this[0xd];
    this_00[0xe] = this[0xe];
    this_00[0xf] = this[0xf];
    break;
  case (KeyValues)0x7:
    pvVar5 = operator_new__(8);
    *(void **)(this_00 + 4) = pvVar5;
    _V_memcpy(pvVar5,*(void **)(this + 4),8);
  }
  CopySubkeys(this,this_00);
  return this_00;
}

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)