Convert the title to wchars to fix non-ASCII.

This commit is contained in:
Unknown W. Brackets 2012-12-03 07:44:29 -08:00
parent 20d05b8dc9
commit ad59c7f46d

View File

@ -40,7 +40,27 @@ void WindowsHost::SetWindowTitle(const char *message)
// Really need a better way to deal with versions.
std::string title = "PPSSPP v0.4 - ";
title += message;
SetWindowText(mainWindow_, title.c_str());
int size = MultiByteToWideChar(CP_UTF8, 0, message, title.size(), NULL, 0);
if (size > 0)
{
wchar_t *utf16_title = new wchar_t[size + 1];
if (utf16_title)
size = MultiByteToWideChar(CP_UTF8, 0, message, title.size(), utf16_title, size);
else
size = 0;
if (size > 0)
{
utf16_title[size] = 0;
SetWindowTextW(mainWindow_, utf16_title);
delete[] utf16_title;
}
}
// Something went wrong, fall back to using the local codepage.
if (size <= 0)
SetWindowTextA(mainWindow_, title.c_str());
}
void WindowsHost::InitSound(PMixer *mixer)