mirror of https://github.com/libsdl-org/SDL.git
Use the keyboard/mouse vendor if available
Fixes the 8BitDo Micro gamepad so it shows up as "8BitDo HID-compliant mouse" and "8BitDo HID Keyboard Device" in keyboard mode over USB.
This commit is contained in:
parent
a811e0ef0f
commit
fdf72d1e45
|
|
@ -895,17 +895,7 @@ static char *GetDeviceName(HANDLE hDevice, HDEVINFO devinfo, const char *instanc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prod[0]) {
|
if (!prod[0]) {
|
||||||
char *vendor_name = WIN_StringToUTF8W(vend);
|
|
||||||
char *product_name = WIN_StringToUTF8W(prod);
|
|
||||||
if (product_name) {
|
|
||||||
name = SDL_CreateDeviceName(attr.VendorID, attr.ProductID, vendor_name, product_name);
|
|
||||||
}
|
|
||||||
SDL_free(vendor_name);
|
|
||||||
SDL_free(product_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
SP_DEVINFO_DATA data;
|
SP_DEVINFO_DATA data;
|
||||||
SDL_zero(data);
|
SDL_zero(data);
|
||||||
data.cbSize = sizeof(data);
|
data.cbSize = sizeof(data);
|
||||||
|
|
@ -932,13 +922,21 @@ static char *GetDeviceName(HANDLE hDevice, HDEVINFO devinfo, const char *instanc
|
||||||
size = (SDL_arraysize(prod) - 1);
|
size = (SDL_arraysize(prod) - 1);
|
||||||
}
|
}
|
||||||
prod[size] = 0;
|
prod[size] = 0;
|
||||||
|
|
||||||
name = WIN_StringToUTF8W(prod);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prod[0]) {
|
||||||
|
char *vendor_name = vend[0] ? WIN_StringToUTF8W(vend) : NULL;
|
||||||
|
char *product_name = WIN_StringToUTF8W(prod);
|
||||||
|
if (product_name) {
|
||||||
|
name = SDL_CreateDeviceName(attr.VendorID, attr.ProductID, vendor_name, product_name);
|
||||||
|
}
|
||||||
|
SDL_free(vendor_name);
|
||||||
|
SDL_free(product_name);
|
||||||
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue