V_UCS2ToUTF8
0x0004a050 · 192 bytes · __cdecl
_Z12V_UCS2ToUTF8PKtPci
Decompiled
undefined (3 params)
/* V_UCS2ToUTF8(unsigned short const*, char*, int) */
size_t V_UCS2ToUTF8(ushort *param_1,char *param_2,int param_3)
{
ushort *puVar1;
iconv_t __cd;
size_t sVar2;
size_t sVar3;
int iVar4;
size_t local_2c;
size_t local_28;
ushort *local_24;
char *local_20 [4];
*param_2 = '\0';
__cd = iconv_open("UTF-8","UCS-2LE");
if (*param_1 == 0) {
local_2c = 0;
}
else {
iVar4 = 1;
do {
local_2c = iVar4 * 2;
puVar1 = param_1 + iVar4;
iVar4 = iVar4 + 1;
} while (*puVar1 != 0);
}
local_24 = param_1;
local_20[0] = param_2;
sVar3 = 0xffffffff;
if (__cd != (iconv_t)0x0) {
local_28 = param_3 - 1U;
sVar2 = iconv(__cd,(char **)&local_24,&local_2c,local_20,&local_28);
param_2[(param_3 - 1U) - local_28] = '\0';
iconv_close(__cd);
sVar3 = 0;
if (-1 < (int)sVar2) {
sVar3 = local_28;
}
}
param_2[param_3 + -1] = '\0';
return sVar3;
}
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.