the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "PS3Strings.h"
3
4uint8_t *mallocAndCreateUTF8ArrayFromString(int iID)
5{
6 int result;
7 l10n_conv_t cd;
8 LPCWSTR wchString=app.GetString(iID);
9 size_t src_len,dst_len;
10 int iLen=wcslen(wchString);
11 src_len=sizeof(WCHAR)*(iLen);
12
13 if( (cd = l10n_get_converter( L10N_UTF16, L10N_UTF8 )) == -1 )
14 {
15 app.DebugPrintf("l10n_get_converter: no such converter\n");
16 return NULL;
17 }
18
19 l10n_convert_str( cd, wchString, &src_len, NULL, &dst_len );
20 uint8_t *strUtf8=(uint8_t *)malloc(dst_len);
21 memset(strUtf8,0,dst_len);
22
23 result = l10n_convert_str( cd, wchString, &src_len, strUtf8, &dst_len );
24 if( result != ConversionOK )
25 {
26 app.DebugPrintf("l10n_convert: conversion error : 0x%x\n", result);
27 return NULL;
28 }
29
30 return strUtf8;
31}