From 3aab5a996a39da6a4b591fec2c22699cb057b5cd Mon Sep 17 00:00:00 2001 From: Alexpux Date: Tue, 18 Nov 2014 00:05:50 +0300 Subject: [PATCH 10/10] Unicode fix. --- src/win32/Win32InputManager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/win32/Win32InputManager.cpp b/src/win32/Win32InputManager.cpp index fedc5ee..17df9b0 100644 --- a/src/win32/Win32InputManager.cpp +++ b/src/win32/Win32InputManager.cpp @@ -152,7 +152,17 @@ BOOL CALLBACK Win32InputManager::_DIEnumDevCallback(LPCDIDEVICEINSTANCE lpddi, L jsInfo.isXInput = false; jsInfo.productGuid = lpddi->guidProduct; jsInfo.deviceID = lpddi->guidInstance; +#if UNICODE + //convert from wide char to narrow char array + char ch[260]; + char pDefaultChar = ' '; + WideCharToMultiByte(CP_ACP,0,lpddi->tszInstanceName,-1, ch,260,&pDefaultChar, NULL); + + //A std:string using the char* constructor. + std::string ss(ch); +#else jsInfo.vendor = lpddi->tszInstanceName; +#endif jsInfo.devId = _this_->joySticks; _this_->joySticks++; -- 2.9.0