mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Fixed bug 4024 - remove trailing comma of Controller mappings
because it reports an error "Unexpected controller element"
This commit is contained in:
parent
8a19ff3e2d
commit
ede0fc4f4c
@ -995,6 +995,17 @@ static ControllerMapping_t *SDL_CreateMappingForAndroidController(const char *na
|
||||
if (axis_mask & (1 << SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) {
|
||||
SDL_strlcat(mapping_string, "righttrigger:a5,", sizeof(mapping_string));
|
||||
}
|
||||
|
||||
/* Remove trailing comma */
|
||||
{
|
||||
int pos = strlen(mapping_string) - 1;
|
||||
if (pos >= 0) {
|
||||
if (mapping_string[pos] == ',') {
|
||||
mapping_string[pos] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SDL_PrivateAddMappingForGUID(guid, mapping_string,
|
||||
&existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
|
||||
}
|
||||
@ -1015,7 +1026,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);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@ def save_controller(line):
|
||||
bindings = sorted(match.group(4).split(","))
|
||||
if (bindings[0] == ""):
|
||||
bindings.pop(0)
|
||||
entry.extend(",".join(bindings) + ",")
|
||||
entry.extend(",".join(bindings))
|
||||
entry.append(match.group(5))
|
||||
controllers.append(entry)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user