L L4D2node

KeyValues::SetWString

0x0024e680 · 168 bytes · __thiscall

_ZN9KeyValues10SetWStringEPKcPKw

Decompiled

undefined (3 params)

/* KeyValues::SetWString(char const*, wchar_t const*) */

void __thiscall KeyValues::SetWString(KeyValues *this,char *param_1,wchar_t *param_2)

{
  uint uVar1;
  int iVar2;
  size_t sVar3;
  uint uVar4;
  void *pvVar5;
  
  iVar2 = FindKey(this,param_1,true);
  if (iVar2 != 0) {
    if (*(void **)(iVar2 + 8) != (void *)0x0) {
      operator_delete__(*(void **)(iVar2 + 8));
    }
    if (*(void **)(iVar2 + 4) != (void *)0x0) {
      operator_delete__(*(void **)(iVar2 + 4));
    }
    *(undefined4 *)(iVar2 + 4) = 0;
    if (param_2 == (wchar_t *)0x0) {
      param_2 = L"";
    }
    sVar3 = wcslen(param_2);
    uVar1 = sVar3 + 1;
    if (uVar1 < 0x1fc00001) {
      uVar4 = uVar1 * 4;
    }
    else {
      uVar4 = 0xffffffff;
    }
    pvVar5 = operator_new__(uVar4);
    *(void **)(iVar2 + 8) = pvVar5;
    _V_memcpy(pvVar5,param_2,uVar1 * 4);
    *(undefined1 *)(iVar2 + 0x10) = 5;
  }
  return;
}

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)