mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-20 22:35:41 +00:00
Restore compatibility with older GameCube mappings
Restore the original button values for GameCube controllers, but swap labeled mappings to positional while loading mappings Fixes https://github.com/libsdl-org/SDL/issues/12847
This commit is contained in:
@@ -478,6 +478,17 @@ static void CommitBindingElement(const char *binding, bool force)
|
||||
mapping = NULL;
|
||||
}
|
||||
|
||||
if (mapping && SDL_GetGamepadType(controller->gamepad) == SDL_GAMEPAD_TYPE_GAMECUBE) {
|
||||
if (SDL_strstr(mapping, "face:") == NULL) {
|
||||
char *new_mapping = NULL;
|
||||
SDL_asprintf(&new_mapping, "%sface:axby,", mapping);
|
||||
if (new_mapping) {
|
||||
SDL_free(mapping);
|
||||
mapping = new_mapping;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the controller generates multiple events for a single element, pick the best one */
|
||||
if (!force && binding_advance_time) {
|
||||
char *current = GetElementBinding(mapping, binding_element);
|
||||
|
||||
Reference in New Issue
Block a user