L L4D2node

V_UTF8ToUnicode

0x0025dd20 · 179 bytes · __cdecl

_Z15V_UTF8ToUnicodePKcPwi

Decompiled

undefined (3 params)

/* V_UTF8ToUnicode(char const*, wchar_t*, int) */

size_t V_UTF8ToUnicode(char *param_1,wchar_t *param_2,int param_3)

{
  iconv_t __cd;
  size_t sVar1;
  size_t sVar2;
  size_t sVar3;
  size_t local_2c;
  size_t local_28;
  char *local_24;
  wchar_t *local_20 [4];
  
  sVar3 = 0;
  if (param_1 != (char *)0x0) {
    *param_2 = L'\0';
    __cd = iconv_open("UTF-32LE","UTF-8");
    local_2c = param_3;
    sVar1 = strlen(param_1);
    local_24 = param_1;
    local_20[0] = param_2;
    sVar3 = 0xffffffff;
    if (__cd != (iconv_t)0x0) {
      local_28 = sVar1 + 1;
      sVar2 = iconv(__cd,&local_24,&local_28,(char **)local_20,&local_2c);
      iconv_close(__cd);
      sVar3 = 0;
      if (-1 < (int)sVar2) {
        sVar3 = sVar1 + 1;
      }
    }
    *(undefined4 *)((int)param_2 + ((param_3 & 0xfffffffcU) - 4)) = 0;
  }
  return sVar3;
}

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)