mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-06 15:30:50 +00:00
Added custom names for some controllers
This commit is contained in:
parent
e029fdbb38
commit
0f52916027
8 changed files with 533 additions and 481 deletions
|
@ -603,6 +603,12 @@ HIDAPI_AddDevice(struct hid_device_info *info)
|
|||
}
|
||||
|
||||
/* Need the device name before getting the driver to know whether to ignore this device */
|
||||
if (!device->name) {
|
||||
const char *name = SDL_GetCustomJoystickName(device->vendor_id, device->product_id);
|
||||
if (name) {
|
||||
device->name = SDL_strdup(name);
|
||||
}
|
||||
}
|
||||
if (!device->name && info->manufacturer_string && info->product_string) {
|
||||
char *manufacturer_string = SDL_iconv_string("UTF-8", "WCHAR_T", (char*)info->manufacturer_string, (SDL_wcslen(info->manufacturer_string)+1)*sizeof(wchar_t));
|
||||
char *product_string = SDL_iconv_string("UTF-8", "WCHAR_T", (char*)info->product_string, (SDL_wcslen(info->product_string)+1)*sizeof(wchar_t));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue