libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.17k stars 1.82k forks source link

Joypad autoconfig does not ignore unconfigured controllers #15030

Open alkazar opened 1 year ago

alkazar commented 1 year ago

Description

When using joypad autoconfig, unconfigured controllers can take the top ports.

Expected behavior

Unconfigured controllers should be ignored when assigning ports with autoconfig.

Actual behavior

If you have a configured and unconfigured controller, the unconfigured controller can become player 1, and the configured controller can become player 2, rendering most games unplayable.

Steps to reproduce the bug

  1. connect a controller with an autoconfig profile
  2. connect a second controller without an autoconfig profile
  3. start any game
  4. notice that the configured controller is assigned to player 2

The results may depend on the combination of controllers used.

Bisect Results

Did not do.

Version/Commit

Unknown. Inspecting the code (task_autodetect.c), this appears to be how the joypad autoconfig functionality works/was designed. There does not appear to be a feedback mechanism to reassign ports after application of autoconfig.

Environment information

Additional notes

I expect that this behaviour exists because it was assumed that you can either a) configure the controller, or b) disconnect it. However, this is not possible (or annoying) for my use cases. I have two.

1) I have a Logitech steering wheel which is detected by RetroArch as an unconfigured controller and causes this problem. The workaround is to unplug the steering wheel from my computer. This can be tedious as I have to go in the back of my TV unit anytime I need to unplug or plug it in. It is dark and frustrating to plug in the USB sometimes due to the USB superposition problem :)

2) Using RetroArch from Steam with Steam Input. There is currently no way to configure RetroArch to work with my Steam Controller AND my Xbox controllers with joypad autoconfig. I can only get one or the other working. This is because Steam Input creates additional virtual controllers, duplicating the original controller interface. BUT Steam Input is required in order for my Steam Controller to function.

Looking through the code, I see no obvious and easy way to skip unconfigured controllers, but maybe someone more experienced with the code has some ideas they could share?

If this is not something that is desired for the default behaviour, perhaps it could be made a configuration option to skip unconfigured controllers.

hizzlekizzle commented 1 year ago

It's not feasible to make an autoconfig profile for it?

Nevertheless, you can change which device is allocated to which spot by going to settings > input > port X controls and changing the device index.

alkazar commented 1 year ago

Thank you for the reply and the suggestion.

It's not feasible to make an autoconfig profile for it?

Creating an autoconfig profile for these controllers does not change the nature of the problem. These are essentially controllers which I cannot remove from the system, but which I cannot or do not want to use.

Nevertheless, you can change which device is allocated to which spot by going to settings > input > port X controls and changing the device index.

The solution needs to be automated. I have users which cannot be expected to make a config change every time an emulator starts. Unless I am missing something, it doesn't seem possible to automatically determine which controllers are unconfigured and change the ports automatically with a script. This all needs to work dynamically as I don't know which controllers will be used ahead of time.

hizzlekizzle commented 1 year ago

Hmm, yeah, we don't have any method for blocklisting pads from enumeration. It might be feasible to add a feature that looks for a flag (which users could manually add via text editor) in autoconfig profiles that would then prevent enumerating any matching devices, but there's nothing like that right now.

alkazar commented 1 year ago

I think it would be preferable to block all unconfigured pads from enumeration. Having to create a configuration for all possible unknown controllers would be difficult. But the behaviour could be controlled by a configuration option.

I'll start poking around, but would appreciate advice from anyone experienced with the code base on how it could be implemented cleanly.