Skip to content

Commit

Permalink
Merge pull request #90 from pmrochen/master
Browse files Browse the repository at this point in the history
Support Unicode character set
  • Loading branch information
Ybalrid authored Nov 1, 2023
2 parents ac3b722 + 74e1859 commit 8ed3270
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/win32/Win32InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down

0 comments on commit 8ed3270

Please sign in to comment.