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 <lists/file_list.h>
|
||||||
#include <file/file_path.h>
|
#include <file/file_path.h>
|
||||||
#include <string/stdstring.h>
|
#include <string/stdstring.h>
|
||||||
|
#include <encodings/utf.h>
|
||||||
#include <features/features_cpu.h>
|
#include <features/features_cpu.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@ -1034,16 +1035,14 @@ static bool accessibility_speak_windows(int speed,
|
|||||||
#ifdef HAVE_NVDA
|
#ifdef HAVE_NVDA
|
||||||
else if (USE_NVDA)
|
else if (USE_NVDA)
|
||||||
{
|
{
|
||||||
long res;
|
wchar_t *wc = utf8_to_utf16_string_alloc(speak_text);
|
||||||
const size_t cSize = strlen(speak_text)+1;
|
long res = nvdaController_testIfRunning_func();
|
||||||
wchar_t *wc;
|
|
||||||
res = nvdaController_testIfRunning_func();
|
|
||||||
wc = malloc(sizeof(wchar_t) * cSize);
|
|
||||||
mbstowcs(wc, speak_text, cSize);
|
|
||||||
|
|
||||||
if (res != 0)
|
if (!wc || res != 0)
|
||||||
{
|
{
|
||||||
RARCH_LOG("Error communicating with NVDA\n");
|
RARCH_LOG("Error communicating with NVDA\n");
|
||||||
|
if (wc)
|
||||||
|
free(wc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1053,6 +1052,7 @@ static bool accessibility_speak_windows(int speed,
|
|||||||
nvdaController_brailleMessage_func(wc);
|
nvdaController_brailleMessage_func(wc);
|
||||||
else
|
else
|
||||||
nvdaController_speakText_func(wc);
|
nvdaController_speakText_func(wc);
|
||||||
|
free(wc);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SAPI
|
#ifdef HAVE_SAPI
|
||||||
@ -1076,12 +1076,16 @@ static bool accessibility_speak_windows(int speed,
|
|||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
wchar_t wtext[1200];
|
wchar_t *wc = utf8_to_utf16_string_alloc(speak_text);
|
||||||
|
|
||||||
snprintf(cmd, sizeof(cmd),
|
snprintf(cmd, sizeof(cmd),
|
||||||
"<rate speed=\"%s\"/><volume level=\"80\"/><lang langid=\"%s\"/>%s", speeds[speed], langid, speak_text);
|
"<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
|
#endif
|
||||||
|
@ -80,7 +80,7 @@ static void xfonts_render_msg(
|
|||||||
const struct font_params *params)
|
const struct font_params *params)
|
||||||
{
|
{
|
||||||
float x, y;
|
float x, y;
|
||||||
wchar_t str[PATH_MAX_LENGTH];
|
wchar_t *wc = NULL;
|
||||||
xfonts_t *xfonts = (xfonts_t*)data;
|
xfonts_t *xfonts = (xfonts_t*)data;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
float video_msg_pos_x = settings->floats.video_msg_pos_x;
|
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,
|
d3d8_device_get_backbuffer(xfonts->d3d->dev,
|
||||||
-1, 0, D3DBACKBUFFER_TYPE_MONO, &xfonts->surf);
|
-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
|
#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
|
#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
|
#endif
|
||||||
|
free(wc);
|
||||||
|
}
|
||||||
d3d8_surface_free(xfonts->surf);
|
d3d8_surface_free(xfonts->surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user