mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-29 20:27:12 +01:00
Handle entirely duplicated joystick product names, as well as vendor and product names that start with the name of the vendor, but with different case (e.g. 8bitdo 8BitDo)
This commit is contained in:
parent
de2001eeee
commit
6318765d54
@ -1356,7 +1356,7 @@ PrefixMatch(const char *a, const char *b)
|
|||||||
{
|
{
|
||||||
int matchlen = 0;
|
int matchlen = 0;
|
||||||
while (*a && *b) {
|
while (*a && *b) {
|
||||||
if (*a++ == *b++) {
|
if (SDL_tolower(*a++) == SDL_tolower(*b++)) {
|
||||||
++matchlen;
|
++matchlen;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
@ -1435,13 +1435,17 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove duplicate manufacturer in the name */
|
/* Remove duplicate manufacturer or product in the name */
|
||||||
for (i = 0; i < (len - 1); ++i) {
|
for (i = 1; i < (len - 1); ++i) {
|
||||||
int matchlen = PrefixMatch(name, &name[i]);
|
int matchlen = PrefixMatch(name, &name[i]);
|
||||||
if (matchlen > 0 && name[matchlen-1] == ' ') {
|
if (matchlen > 0 && name[matchlen-1] == ' ') {
|
||||||
SDL_memmove(name, name+matchlen, len-matchlen+1);
|
SDL_memmove(name, name+matchlen, len-matchlen+1);
|
||||||
len -= matchlen;
|
len -= matchlen;
|
||||||
break;
|
break;
|
||||||
|
} else if (matchlen > 0 && name[matchlen] == ' ') {
|
||||||
|
SDL_memmove(name, name+matchlen+1, len-matchlen);
|
||||||
|
len -= (matchlen + 1);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1772,29 +1776,29 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
|
|||||||
https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py
|
https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py
|
||||||
*/
|
*/
|
||||||
static Uint32 joystick_blacklist[] = {
|
static Uint32 joystick_blacklist[] = {
|
||||||
/* Microsoft Microsoft Wireless Optical Desktop?? 2.10 */
|
/* Microsoft Microsoft Wireless Optical Desktop 2.10 */
|
||||||
/* Microsoft Wireless Desktop - Comfort Edition */
|
/* Microsoft Wireless Desktop - Comfort Edition */
|
||||||
MAKE_VIDPID(0x045e, 0x009d),
|
MAKE_VIDPID(0x045e, 0x009d),
|
||||||
|
|
||||||
/* Microsoft Microsoft?? Digital Media Pro Keyboard */
|
/* Microsoft Microsoft Digital Media Pro Keyboard */
|
||||||
/* Microsoft Corp. Digital Media Pro Keyboard */
|
/* Microsoft Corp. Digital Media Pro Keyboard */
|
||||||
MAKE_VIDPID(0x045e, 0x00b0),
|
MAKE_VIDPID(0x045e, 0x00b0),
|
||||||
|
|
||||||
/* Microsoft Microsoft?? Digital Media Keyboard */
|
/* Microsoft Microsoft Digital Media Keyboard */
|
||||||
/* Microsoft Corp. Digital Media Keyboard 1.0A */
|
/* Microsoft Corp. Digital Media Keyboard 1.0A */
|
||||||
MAKE_VIDPID(0x045e, 0x00b4),
|
MAKE_VIDPID(0x045e, 0x00b4),
|
||||||
|
|
||||||
/* Microsoft Microsoft?? Digital Media Keyboard 3000 */
|
/* Microsoft Microsoft Digital Media Keyboard 3000 */
|
||||||
MAKE_VIDPID(0x045e, 0x0730),
|
MAKE_VIDPID(0x045e, 0x0730),
|
||||||
|
|
||||||
/* Microsoft Microsoft?? 2.4GHz Transceiver v6.0 */
|
/* Microsoft Microsoft 2.4GHz Transceiver v6.0 */
|
||||||
/* Microsoft Microsoft?? 2.4GHz Transceiver v8.0 */
|
/* Microsoft Microsoft 2.4GHz Transceiver v8.0 */
|
||||||
/* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */
|
/* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */
|
||||||
/* Microsoft Wireless Mobile Mouse 1000 */
|
/* Microsoft Wireless Mobile Mouse 1000 */
|
||||||
/* Microsoft Wireless Desktop 3000 */
|
/* Microsoft Wireless Desktop 3000 */
|
||||||
MAKE_VIDPID(0x045e, 0x0745),
|
MAKE_VIDPID(0x045e, 0x0745),
|
||||||
|
|
||||||
/* Microsoft?? SideWinder(TM) 2.4GHz Transceiver */
|
/* Microsoft SideWinder(TM) 2.4GHz Transceiver */
|
||||||
MAKE_VIDPID(0x045e, 0x0748),
|
MAKE_VIDPID(0x045e, 0x0748),
|
||||||
|
|
||||||
/* Microsoft Corp. Wired Keyboard 600 */
|
/* Microsoft Corp. Wired Keyboard 600 */
|
||||||
@ -1806,16 +1810,16 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
|
|||||||
/* Microsoft Corp. Arc Touch Mouse Transceiver */
|
/* Microsoft Corp. Arc Touch Mouse Transceiver */
|
||||||
MAKE_VIDPID(0x045e, 0x0773),
|
MAKE_VIDPID(0x045e, 0x0773),
|
||||||
|
|
||||||
/* Microsoft?? 2.4GHz Transceiver v9.0 */
|
/* Microsoft 2.4GHz Transceiver v9.0 */
|
||||||
/* Microsoft?? Nano Transceiver v2.1 */
|
/* Microsoft Nano Transceiver v2.1 */
|
||||||
/* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */
|
/* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */
|
||||||
MAKE_VIDPID(0x045e, 0x07a5),
|
MAKE_VIDPID(0x045e, 0x07a5),
|
||||||
|
|
||||||
/* Microsoft?? Nano Transceiver v1.0 */
|
/* Microsoft Nano Transceiver v1.0 */
|
||||||
/* Microsoft Wireless Keyboard 800 */
|
/* Microsoft Wireless Keyboard 800 */
|
||||||
MAKE_VIDPID(0x045e, 0x07b2),
|
MAKE_VIDPID(0x045e, 0x07b2),
|
||||||
|
|
||||||
/* Microsoft?? Nano Transceiver v2.0 */
|
/* Microsoft Nano Transceiver v2.0 */
|
||||||
MAKE_VIDPID(0x045e, 0x0800),
|
MAKE_VIDPID(0x045e, 0x0800),
|
||||||
|
|
||||||
MAKE_VIDPID(0x046d, 0xc30a), /* Logitech, Inc. iTouch Composite keboard */
|
MAKE_VIDPID(0x046d, 0xc30a), /* Logitech, Inc. iTouch Composite keboard */
|
||||||
|
Loading…
Reference in New Issue
Block a user