KeyValues::GetWString
0x0024e790 · 405 bytes · __thiscall
_ZN9KeyValues10GetWStringEPKcPKw
Decompiled
undefined (3 params)
/* KeyValues::GetWString(char const*, wchar_t const*) */
wchar_t * __thiscall KeyValues::GetWString(KeyValues *this,char *param_1,wchar_t *param_2)
{
uint uVar1;
int iVar2;
int iVar3;
uint uVar4;
wchar_t *pwVar5;
wchar_t local_11c [67];
iVar2 = FindKey(this,param_1,false);
if (iVar2 == 0) {
switchD_0024e7ce_caseD_0:
return param_2;
}
switch(*(undefined1 *)(iVar2 + 0x10)) {
default:
goto switchD_0024e7ce_caseD_0;
case 1:
iVar3 = _V_strlen(*(char **)(iVar2 + 4));
uVar1 = (iVar3 + 1U) * 4;
uVar4 = uVar1;
if (0x1fc00000 < iVar3 + 1U) {
uVar4 = 0xffffffff;
}
pwVar5 = operator_new__(uVar4);
iVar3 = V_UTF8ToUnicode(*(char **)(iVar2 + 4),pwVar5,uVar1);
if (iVar3 < 0) {
if (pwVar5 == (wchar_t *)0x0) {
return param_2;
}
operator_delete__(pwVar5);
return param_2;
}
SetWString(this,param_1,pwVar5);
if (pwVar5 != (wchar_t *)0x0) {
operator_delete__(pwVar5);
}
goto switchD_0024e7ce_caseD_5;
case 2:
case 4:
swprintf(local_11c,0x40,L"%d",*(undefined4 *)(iVar2 + 0xc));
break;
case 3:
swprintf(local_11c,0x40,L"%f",(double)*(float *)(iVar2 + 0xc));
break;
case 5:
goto switchD_0024e7ce_caseD_5;
case 7:
swprintf(local_11c,0x40,L"%lld",**(undefined4 **)(iVar2 + 4),(*(undefined4 **)(iVar2 + 4))[1]);
}
SetWString(this,param_1,local_11c);
switchD_0024e7ce_caseD_5:
return *(wchar_t **)(iVar2 + 8);
}
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.