mirror of
https://github.com/libretro/ppsspp.git
synced 2025-01-20 23:54:48 +00:00
Convert FormatMessage() to utf-8 to fix locale.
Otherwise we get non-utf-8 garbage if the user isn't in a Latin codepage.
This commit is contained in:
parent
32fc4c7676
commit
42fe8ee32e
@ -15,6 +15,7 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "util/text/utf8.h"
|
||||
#include "Common.h"
|
||||
|
||||
#include <string.h>
|
||||
@ -44,14 +45,17 @@ const char *GetLastErrorMsg()
|
||||
}
|
||||
|
||||
const char *GetStringErrorMsg(int errCode) {
|
||||
static const size_t buff_size = 255;
|
||||
static const size_t buff_size = 1023;
|
||||
#ifndef _XBOX
|
||||
#ifdef _WIN32
|
||||
static __declspec(thread) char err_str[buff_size] = {};
|
||||
static __declspec(thread) wchar_t err_strw[buff_size] = {};
|
||||
|
||||
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errCode,
|
||||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errCode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
err_str, buff_size, NULL);
|
||||
err_strw, buff_size, NULL);
|
||||
|
||||
static __declspec(thread) char err_str[buff_size] = {};
|
||||
snprintf(err_str, buff_size, ConvertWStringToUTF8(err_strw).c_str());
|
||||
#else
|
||||
static __thread char err_str[buff_size] = {};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user