mirror of
https://github.com/libretro/RetroArch
synced 2025-03-21 13:20:52 +00:00
Go through utf8 to utf16 functions
This commit is contained in:
parent
0946604627
commit
035d7dad12
@ -32,6 +32,7 @@
|
||||
#include <lists/file_list.h>
|
||||
#include <file/file_path.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <encodings/utf.h>
|
||||
#include <features/features_cpu.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -1034,16 +1035,14 @@ static bool accessibility_speak_windows(int speed,
|
||||
#ifdef HAVE_NVDA
|
||||
else if (USE_NVDA)
|
||||
{
|
||||
long res;
|
||||
const size_t cSize = strlen(speak_text)+1;
|
||||
wchar_t *wc;
|
||||
res = nvdaController_testIfRunning_func();
|
||||
wc = malloc(sizeof(wchar_t) * cSize);
|
||||
mbstowcs(wc, speak_text, cSize);
|
||||
wchar_t *wc = utf8_to_utf16_string_alloc(speak_text);
|
||||
long res = nvdaController_testIfRunning_func();
|
||||
|
||||
if (res != 0)
|
||||
if (!wc || res != 0)
|
||||
{
|
||||
RARCH_LOG("Error communicating with NVDA\n");
|
||||
if (wc)
|
||||
free(wc);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1053,6 +1052,7 @@ static bool accessibility_speak_windows(int speed,
|
||||
nvdaController_brailleMessage_func(wc);
|
||||
else
|
||||
nvdaController_speakText_func(wc);
|
||||
free(wc);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SAPI
|
||||
@ -1076,12 +1076,16 @@ static bool accessibility_speak_windows(int speed,
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
wchar_t wtext[1200];
|
||||
wchar_t *wc = utf8_to_utf16_string_alloc(speak_text);
|
||||
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"<rate speed=\"%s\"/><volume level=\"80\"/><lang langid=\"%s\"/>%s", speeds[speed], langid, speak_text);
|
||||
mbstowcs(wtext, speak_text, sizeof(wtext));
|
||||
|
||||
hr = ISpVoice_Speak(pVoice, wtext, SPF_ASYNC /*SVSFlagsAsync*/, NULL);
|
||||
if (!wc)
|
||||
return false;
|
||||
|
||||
hr = ISpVoice_Speak(pVoice, wc, SPF_ASYNC /*SVSFlagsAsync*/, NULL);
|
||||
free(wc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -80,7 +80,7 @@ static void xfonts_render_msg(
|
||||
const struct font_params *params)
|
||||
{
|
||||
float x, y;
|
||||
wchar_t str[PATH_MAX_LENGTH];
|
||||
wchar_t *wc = NULL;
|
||||
xfonts_t *xfonts = (xfonts_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
float video_msg_pos_x = settings->floats.video_msg_pos_x;
|
||||
@ -100,13 +100,19 @@ static void xfonts_render_msg(
|
||||
d3d8_device_get_backbuffer(xfonts->d3d->dev,
|
||||
-1, 0, D3DBACKBUFFER_TYPE_MONO, &xfonts->surf);
|
||||
|
||||
mbstowcs(str, msg, sizeof(str) / sizeof(wchar_t));
|
||||
wc = utf8_to_utf16_string_alloc(msg);
|
||||
|
||||
if (wc)
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
xfonts->debug_font->TextOut(xfonts->surf, str, (unsigned)-1, x, y);
|
||||
xfonts->debug_font->TextOut(xfonts->surf,
|
||||
wc, (unsigned)-1, x, y);
|
||||
#else
|
||||
XFONT_TextOut(xfonts->debug_font, xfonts->surf, str, (unsigned)-1, x, y);
|
||||
XFONT_TextOut(xfonts->debug_font, xfonts->surf,
|
||||
wc, (unsigned)-1, x, y);
|
||||
#endif
|
||||
free(wc);
|
||||
}
|
||||
d3d8_surface_free(xfonts->surf);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user