Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoconfig extension with alternative name/vid/pid #16990

Merged
merged 1 commit into from
Sep 12, 2024

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
27 checks passed
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
Merged to Nintendo Switch Pro Controller.cfg

See libretro/RetroArch#16990
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
Merged to Sony Interactive Entertainment Wireless Controller.cfg

See libretro/RetroArch#16990
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
Merged to Sony Interactive Entertainment DualSense Wireless Controller.cfg

See libretro/RetroArch#16990
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 12, 2024
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 13, 2024
davidhedlund added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Sep 13, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants