Skip to content

Autoconfig extension with alternative name/vid/pid#16990

Merged
LibretroAdmin merged 1 commit intolibretro:masterfrom
zoltanvb:autoconfig_alternatives
Sep 12, 2024
Merged

Autoconfig extension with alternative name/vid/pid#16990
LibretroAdmin merged 1 commit intolibretro:masterfrom
zoltanvb:autoconfig_alternatives

Conversation

@zoltanvb
Copy link
Contributor

Description

There may be several variants of a controller, where name and/or vid:pid is different, but their button layout is exactly the same (for one example, Microsoft X-Box pad v1 (US) and Microsoft X-Box pad v2 (US) in udev).

Allow up to 9 alternative values in the autoconfig file for the 3 config entries used for identification, e.g.:

input_device_alt1
input_vendor_id_alt1
input_product_id_alt1

The matching against the alternative identifiers is done exactly the same way as for primary identifiers (affinity calculation).

Note: contrary to the linked request, there is only one display name supported. The reason is that this way, code changes are quite limited and do not spread to any other function. Since this PR just enables reducing number of autoconfig files, I wanted to keep changes and future code maintenance increase to a minimum.

Omitting the display name will keep the name contained in input_device (whichever alternative matched). Change is not driver specific and is valid for any controller driver. Existing driver limitations still apply (i.e. linuxraw driver can not extract vid:pid).

Autoconfig file generation does not change. Any merge of matching autoconfigs must be done manually. Existing autoconfigs are good as-is.

Test supplied using test input driver:
retroarch --appendconfig tests-other/testinput_alternative_autoconfig.cfg\|tests-other/all_binds_empty.cfg

Related Issues

Closes #16907

Reviewers

@davidhedlund
@RobLoach (in case verify_duplicate_profiles CI script would be incompatible with this)

If there are several variants of a controller, but their button
layout is exactly the same, allow alternative identifiers, e.g.:
input_device_alt1
input_vendor_id_alt3
input_product_id_alt9
@davidhedlund
Copy link
Contributor

davidhedlund commented Sep 11, 2024

Thank you very much, as always, Zoltanvb. You have been instrumental in helping me achieve my goals!:

There's just one last detail to address in the "[IMPORTANT feature request]: Support multiple input_device, input_device_display_name..." issue. Please ensure that you can accommodate alternative input_device_display_name variables.

@LibretroAdmin LibretroAdmin merged commit 05844c6 into libretro:master Sep 12, 2024
This was referenced Sep 12, 2024
@landfillbaby
Copy link

landfillbaby commented Sep 17, 2024

just to clarify, if for example a .cfg provides

input_device
input_vendor_id
input_product_id

input_vendor_id_alt1
input_product_id_alt1

but not input_device_alt1, does it use input_device for matching when a device matching input_vendor_id_alt1 and input_product_id_alt1 is connected, or no?

in other words, do i ned to provide input_device_alt1 when it would be the same as input_device?

@zoltanvb
Copy link
Contributor Author

Yes, input_device_alt1 is needed. Each set of (input_device, input_vendor_id, input_product_id) is treated as a separate entity.

@zoltanvb zoltanvb deleted the autoconfig_alternatives branch October 23, 2024 16:57
Sunderland93 pushed a commit to Sunderland93/RetroArch that referenced this pull request Dec 26, 2024
If there are several variants of a controller, but their button
layout is exactly the same, allow alternative identifiers, e.g.:
input_device_alt1
input_vendor_id_alt3
input_product_id_alt9
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Nov 12, 2025
…roller.cfg

* Merge Sony_DualShock_4_Controller.cfg (v1) and v2 by using alternative vid/pid: libretro/RetroArch#16990
* The merged autoconfigs makes the Sony DualShock 4 Controller v1 use correct mappings
  - Sony_DualShock_4_Controller.cfg file used `input_menu_toggle_btn = "109"` which is now set to `input_menu_toggle_btn = "110"` in `Wireless Controller.cfg`: Changes the menu button from the Touchpad (does not work at all) to the PS button.
  - Sony_DualShock_4_Controller.cfg file used `input_select_btn = "4"` which is now set to `input_select_btn = "109"` in `Wireless Controller.cfg`
* Renamed the controller to the official name generated by RetroArch.
* Added " Trigger" to the labels for the triggers.
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Nov 12, 2025
Merged `Sony_DualShock_4_Controller.cfg` to `Wireless Controller.cfg`; Merged Sony_DualShock_4_Controller.cfg (v1) and v2 by using alternative vid/pid: libretro/RetroArch#16990

See commit
* d6b8ed1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[IMPORTANT feature request]: Support multiple input_device, input_device_display_name, input_vendor_id, and input_product_id variables

4 participants