From aeb3d00002aa3097f8a9b2db80d5439c9f54f8fa Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 9 Sep 2022 13:30:53 +1000 Subject: [PATCH] NoGUI/Win32: Fix text input --- src/duckstation-nogui/win32_nogui_platform.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/duckstation-nogui/win32_nogui_platform.cpp b/src/duckstation-nogui/win32_nogui_platform.cpp index 46102a8f9..61387e2b5 100644 --- a/src/duckstation-nogui/win32_nogui_platform.cpp +++ b/src/duckstation-nogui/win32_nogui_platform.cpp @@ -325,10 +325,10 @@ LRESULT CALLBACK Win32NoGUIPlatform::WndProc(HWND hwnd, UINT msg, WPARAM wParam, { if (ImGuiManager::WantsTextInput()) { - const WCHAR utf16[2] = {static_cast(wParam), 0}; + const WCHAR utf16[1] = {static_cast(wParam)}; char utf8[8] = {}; const int utf8_len = - WideCharToMultiByte(CP_UTF8, 0, utf16, sizeof(utf16), utf8, sizeof(utf8) - 1, nullptr, nullptr); + WideCharToMultiByte(CP_UTF8, 0, utf16, std::size(utf16), utf8, sizeof(utf8) - 1, nullptr, nullptr); if (utf8_len > 0) { utf8[utf8_len] = 0;