mirror of https://github.com/encounter/SDL.git
Fixed manufacturer/product name deduplication for the Razer Raiju Tournament Edition controller
This commit is contained in:
parent
56b91ea720
commit
4ea64fee9f
|
@ -1972,16 +1972,22 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove duplicate manufacturer or product in the name */
|
/* Remove duplicate manufacturer or product in the name
|
||||||
|
* e.g. Razer Razer Raiju Tournament Edition Wired
|
||||||
|
*/
|
||||||
for (i = 1; 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] == ' ') {
|
while (matchlen > 0) {
|
||||||
SDL_memmove(name, name+matchlen, len-matchlen+1);
|
if (name[matchlen] == ' ') {
|
||||||
break;
|
|
||||||
} else if (matchlen > 0 && name[matchlen] == ' ') {
|
|
||||||
SDL_memmove(name, name + matchlen + 1, len - matchlen);
|
SDL_memmove(name, name + matchlen + 1, len - matchlen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
--matchlen;
|
||||||
|
}
|
||||||
|
if (matchlen > 0) {
|
||||||
|
/* We matched the manufacturer's name and removed it */
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
|
|
Loading…
Reference in New Issue