From 74e18592fb459c5c3d7c832c81f036c0db8c406d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Mroche=C5=84?= Date: Tue, 31 Oct 2023 21:20:38 +0100 Subject: [PATCH] Support Unicode character set --- src/win32/Win32InputManager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/win32/Win32InputManager.cpp b/src/win32/Win32InputManager.cpp index 7b67dfe..a75dd04 100644 --- a/src/win32/Win32InputManager.cpp +++ b/src/win32/Win32InputManager.cpp @@ -151,7 +151,16 @@ BOOL CALLBACK Win32InputManager::_DIEnumDevCallback(LPCDIDEVICEINSTANCE lpddi, L jsInfo.isXInput = false; jsInfo.productGuid = lpddi->guidProduct; jsInfo.deviceID = lpddi->guidInstance; +#ifdef UNICODE + int length = WideCharToMultiByte(CP_ACP, 0, lpddi->tszInstanceName, -1, nullptr, 0, nullptr, nullptr) - 1; + if (length > 0) + { + jsInfo.vendor.resize(length); + WideCharToMultiByte(CP_ACP, 0, lpddi->tszInstanceName, -1, &(*jsInfo.vendor.begin()), length + 1, nullptr, nullptr); + } +#else jsInfo.vendor = lpddi->tszInstanceName; +#endif jsInfo.devId = _this_->joySticks; _this_->joySticks++;