Bindings should have a trailing comma, so the CRC can be appended

This commit is contained in:
Sam Lantinga 2022-10-25 16:13:50 -07:00
parent b6cf889af4
commit e837debc25
1 changed files with 1 additions and 11 deletions

View File

@ -1330,7 +1330,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const
/* The Linux driver xpad.c maps the wireless dpad to buttons */
SDL_bool existing;
mapping = SDL_PrivateAddMappingForGUID(guid,
"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3",
"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
&existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
} else if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box") || SDL_strstr(name, "XBOX")) {
mapping = s_pXInputMapping;
@ -1420,16 +1420,6 @@ static ControllerMapping_t *SDL_PrivateGenerateAutomaticControllerMapping(const
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "lefttrigger", &raw_map->lefttrigger);
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "righttrigger", &raw_map->righttrigger);
/* Remove trailing comma */
{
int pos = (int)SDL_strlen(mapping) - 1;
if (pos >= 0) {
if (mapping[pos] == ',') {
mapping[pos] = '\0';
}
}
}
return SDL_PrivateAddMappingForGUID(guid, mapping,
&existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
}