L L4D2node

V_UCS2ToUnicode

0x0025dfb0 · 158 bytes · __cdecl

_Z15V_UCS2ToUnicodePKtPwi

Decompiled

undefined (3 params)

/* V_UCS2ToUnicode(unsigned short const*, wchar_t*, int) */

int V_UCS2ToUnicode(ushort *param_1,wchar_t *param_2,int param_3)

{
  iconv_t __cd;
  size_t sVar1;
  int iVar2;
  size_t local_2c;
  size_t local_28;
  ushort *local_24;
  wchar_t *local_20 [4];
  
  *param_2 = L'\0';
  __cd = iconv_open("UCS-4LE","UCS-2LE");
  local_2c = param_3;
  local_28 = param_3;
  local_20[0] = param_2;
  local_24 = param_1;
  if (__cd == (iconv_t)0x0) {
    iVar2 = -1;
  }
  else {
    sVar1 = iconv(__cd,(char **)&local_24,&local_2c,(char **)local_20,&local_28);
    iconv_close(__cd);
    iVar2 = param_3;
    if ((int)sVar1 < 0) {
      iVar2 = 0;
    }
  }
  *(undefined4 *)((int)param_2 + ((param_3 & 0xfffffffcU) - 4)) = 0;
  return iVar2;
}

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)