libretro / RetroArch

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

Nintendo Classic Controllers on PC #16075

Open erfg12 opened 8 months ago

erfg12 commented 8 months ago

Description

The Nintendo Classic controllers (N64, SNES and NES) do not work properly on Windows and MacOS. On the Switch using RetroArch the controllers work fine, no issues.

The N64 controller is recognized and some defaults are loaded, but the buttons are not recognized.

The SNES controller is not recognized at all.

Both MacOS and Windows recognize the controllers as game input devices, but do not work correctly in RetroArch.

NES Controller - https://www.nintendo.com/us/store/products/nintendo-entertainment-system-controllers/ N64 Controller - https://www.nintendo.com/us/store/products/nintendo-64-controller/ SNES Controller - https://www.nintendo.com/us/store/products/super-nintendo-entertainment-system-controller/

Expected behavior

Should work as regular game controllers same as any other.

Actual behavior

RetroArch does not recognize button input.

Steps to reproduce the bug

  1. Pair one of the 3 controllers to your computer through Bluetooth. Notice that some controllers are cognized, some are not. Button input is not recognized when trying to bind the buttons.

Version/Commit

You can find this information under Information/System Information

Environment information

warmenhoven commented 8 months ago

Dupe of #15143?

odditude42 commented 8 months ago

N64 controller works for me on Windows, although I needed to redo the config:

input_driver = "dinput"
input_device = "Wireless Gamepad"
input_device_display_name = "Switch N64 Controller"
input_vendor_id = "1406"
input_product_id = "8217"
input_b_btn = "1"
input_a_btn = "0"
input_start_btn = "9"
input_select_btn = "10"
input_up_btn = "h0up"
input_down_btn = "h0down"
input_left_btn = "h0left"
input_right_btn = "h0right"
input_l_btn = "4"
input_r_btn = "5"
input_l2_btn = "6"
input_r_x_plus_btn = "8"
input_r_x_minus_btn = "3"
input_r_y_plus_btn = "7"
input_r_y_minus_btn = "2"
input_l_x_plus_axis = "+0"
input_l_x_minus_axis = "-0"
input_l_y_plus_axis = "+1"
input_l_y_minus_axis = "-1"
input_menu_toggle_btn = "12"
input_b_btn_label = "A button"
input_a_btn_label = "B button"
input_start_btn_label = "Start button"
input_select_btn_label = "ZR button"
input_up_btn_label = "D-Pad Up"
input_down_btn_label = "D-Pad Down"
input_left_btn_label = "D-Pad Left"
input_right_btn_label = "D-Pad Right"
input_l_btn_label = "L button"
input_r_btn_label = "R button"
input_l2_btn_label = "Z button"
input_r_x_plus_btn_label = "C Right"
input_r_x_minus_btn_label = "C Left"
input_r_y_minus_btn_label = "C Up"
input_r_y_plus_btn_label = "C Down"
input_l_x_plus_axis_label = "Joystick Right"
input_l_x_minus_axis_label = "Joystick Left"
input_l_y_plus_axis_label = "Joystick Down"
input_l_y_minus_axis_label = "Joystick Up"
input_menu_toggle_btn_label = "Home"
input_y_btn = "11"
input_x_btn = "11"
input_r2_btn = "11"
input_l3_btn = "13"
input_l3_btn_label = "Screenshot"
input_r3_btn = "11"
input_r_x_plus_axis = "+2"
input_r_x_minus_axis = "-2"
input_r_y_plus_axis = "+5"
input_r_y_minus_axis = "-5"
gouchi commented 8 months ago

Here is the diff from the existing joypad autoconfiguration for dinput called N64_Nintendo_Switch_Online.cfg

image

Frostwolfo commented 7 months ago

I'd also like to add that the NSO Genesis Controller - https://www.nintendo.com/us/store/products/sega-genesis-control-pad-114295/ is having the same issue.

Is it possible that a firmware update from Nintendo broke the previous compatibility that these controllers had with RetroArch? I have all the controllers listed in OP up-to-date on their firmware and am suffering the same problem myself.

geogolem commented 6 months ago

im having issues with these as well.. I think the NES, and N64 ones are working properly; however, the SNES one is being recognized as the 6button megadrive one..

yerfspd commented 5 months ago

Copy for me what geogolem is saying. My NSO N64 controller is detected properly but my NSO SNES controller is detected as a "Switch Megadrive Fighting Pad 6B". I'm running RetroArch 1.17.0 on Windows 10 64-bit (although I've had the issue on older versions of RetroArch since I got the NSO controllers late summer 2023).

I believe there's an easy fix for at least the NSO SNES controller. Go to C:\RetroArch-Win64\autoconfig\dinput and open both MD_Gen_Fighting_Pad_6B_Switch_Online.cfg and SNES_Nintendo_Switch_Online.cfg with Notepad. The problem is that line 6 (input_product_id = "8215") is the same in both files.

If I archive MD_Gen_Fighting_Pad_6B_Switch_Online.cfg into MD_Gen_Fighting_Pad_6B_Switch_Online.zip and delete MD_Gen_Fighting_Pad_6B_Switch_Online.cfg then my NSO SNES controller immediately detects properly as a "Switch SNES Controller" and Super Mario World is perfect and awesome. This appears to mean RetroArch resolves the conflict by using the profile that's first in alphabetical order.

There are obviously problems with this. One is if you have a "Switch Megadrive Fighting Pad 6B" it won't have an autoconfig profile available. I don't own that controller so I don't know for sure the correct input_product_id value to fix that profile. The other is that every time you update your controller profiles (RetroArch>Main Menu>Online Updater>Update Controller Profiles) you will add back the offending MD_Gen_Fighting_Pad_6B_Switch_Online.cfg file to C:\RetroArch-Win64\autoconfig\dinput and you'll have to recreate this workaround.

warmenhoven commented 5 months ago

This appears to mean RetroArch resolves the conflict by using the profile that's first in alphabetical order.

That's not quite how it works.

There are two things it checks: vendor/product ids, and the device name (input_device in the .cfg). Each value is given a weighting, so if the vendor/product matches, it gets 3 points; if the device name matches, it gets 2 points. It checks each .cfg file for the controller driver and chooses the one with the highest weight (affinity), or the first to get an affinity of 5. In the event of a tie it chooses the first it found, which I think will always be first alphabetically.

In the case of the NSO controllers, when I checked, several of them (most?) have the same vendor/product ids, so the input_device name is relied upon heavily. If that's not set up correctly in the .cfg to match what the device/driver are reporting the name as, it won't match and will fall back to first alphabetically.

In the hid driver, the name for the MD/Gen pad is "MD/Gen Control Pad", whereas in the dinput driver it's "Wireless Gamepad", which seems wrong. The SNES controller dinput cfg name is "SNES Controller", which seems right, so not sure why it wouldn't be picked up. With the hid driver, when I tested, it did differentiate each correctly.

One other note is that the NSO controllers report different ids/names depending on if they are USB vs bluetooth and the .cfg I think is only set up for bluetooth.

yerfspd commented 5 months ago

@warmenhoven Thanks. Further testing of my own confirms that the hid controller driver in RetroArch on macOS seems to detect the NSO SNES controller properly even though vendor and products ids are identical in both the NSO SNES and NSO Megadrive/Genesis hid autoconfig profiles.

Back on Windows 10 the NSO SNES controller is giving me identical vendor and product ids (the same ones that are in the dinput autoconfig profile) as well as behavior using either USB or Bluetooth.

geogolem commented 5 months ago

About a month ago I posted in response to this issue as I was trying to troubleshoot my issue. Below are my findings etc.

In retroarch on Windows if you change the driver to sdl2 and use the latest version of the SDL2.dll you shouldn't have issues.. i think.. at least that is how i solved it..

When I initially did this the 6button megadrive controller would only function as a 3 button despite being recognized as the 6 button controller. There was a recent pull request merged in SDL2 that added in the extra button capability: https://github.com/libsdl-org/SDL/pull/9225

This is in the latest 2.30.2 of SDL2

With DInput on Windows there is an issue differentiating between devices with same PID/VID. There is an existing issue discussing this problem here: https://github.com/libretro/RetroArch/issues/13520

Regarding the buttons not being properly mapped etc. I submitted another PR which was merged here: https://github.com/libretro/retroarch-joypad-autoconfig/pull/1119

which should also make autoconfig work in retroarch with SDL2..