- switched the Windows backend to use the Windows Unicode API.

With localization for non-Latin languages on the support list the multibyte API doesn't cut it anymore. It neither can handle system text output outside the local code page nor can an ANSI window receive text input outside its own code page.
Similar problems exist for file names. With the multibyte API it is impossible to handle any file containing characters outside the active local code page.

So as of now, everything that may pass along some Unicode text will use the Unicode API with some text conversion functions. The only places where calls to the multibyte API were left are those where known string literals are passed or where the information is not used for anything but comparing it to other return values from the same API.
This commit is contained in:
Christoph Oelckers 2019-02-14 22:22:15 +01:00
commit 868ac5adf8
30 changed files with 325 additions and 228 deletions

View file

@ -400,7 +400,8 @@ void FBasicStartupScreen::NetInit(const char *message, int numplayers)
{
HWND ctl;
SetDlgItemText (NetStartPane, IDC_NETSTARTMESSAGE, message);
std::wstring wmessage = WideString(message);
SetDlgItemTextW (NetStartPane, IDC_NETSTARTMESSAGE, wmessage.c_str());
ctl = GetDlgItem (NetStartPane, IDC_NETSTARTPROGRESS);
if (numplayers == 0)
@ -416,7 +417,7 @@ void FBasicStartupScreen::NetInit(const char *message, int numplayers)
// If we don't set the PBS_MARQUEE style, then the marquee will never show up.
SetWindowLong (ctl, GWL_STYLE, GetWindowLong (ctl, GWL_STYLE) | PBS_MARQUEE);
}
SetDlgItemText (NetStartPane, IDC_NETSTARTCOUNT, "");
SetDlgItemTextW (NetStartPane, IDC_NETSTARTCOUNT, L"");
}
else
{
@ -429,7 +430,7 @@ void FBasicStartupScreen::NetInit(const char *message, int numplayers)
if (numplayers == 1)
{
SendMessage (ctl, PBM_SETPOS, 1, 0);
SetDlgItemText (NetStartPane, IDC_NETSTARTCOUNT, "");
SetDlgItemTextW (NetStartPane, IDC_NETSTARTCOUNT, L"");
}
}
}
@ -510,7 +511,7 @@ void FBasicStartupScreen :: NetProgress(int count)
char buf[16];
mysnprintf (buf, countof(buf), "%d/%d", NetCurPos, NetMaxPos);
SetDlgItemText (NetStartPane, IDC_NETSTARTCOUNT, buf);
SetDlgItemTextA (NetStartPane, IDC_NETSTARTCOUNT, buf);
SendDlgItemMessage (NetStartPane, IDC_NETSTARTPROGRESS, PBM_SETPOS, MIN(NetCurPos, NetMaxPos), 0);
}
}
@ -1194,7 +1195,7 @@ void ST_Endoom()
bool ST_Util_CreateStartupWindow ()
{
StartupScreen = CreateWindowEx (WS_EX_NOPARENTNOTIFY, "STATIC", NULL,
StartupScreen = CreateWindowEx (WS_EX_NOPARENTNOTIFY, L"STATIC", NULL,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SS_OWNERDRAW,
0, 0, 0, 0, Window, NULL, g_hInst, NULL);
if (StartupScreen == NULL)