Skip to content

Commit

Permalink
Add Nintendo Switch Online controllers for hid
Browse files Browse the repository at this point in the history
  • Loading branch information
warmenhoven committed Jan 18, 2024
1 parent 0bf9607 commit 48c75d7
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 0 deletions.
42 changes: 42 additions & 0 deletions hid/MD_Gen_Control_Pad_Switch_Online.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
input_driver = "hid"
input_device = "MD/Gen Control Pad"
input_device_display_name = "Switch Megadrive/Genesis Control Pad"

input_vendor_id = "1406"
input_product_id = "8215"

input_b_btn = "0"
input_y_btn = "1"
input_select_btn = "7"
input_start_btn = "9"
input_up_btn = "h0up"
input_down_btn = "h0down"
input_left_btn = "h0left"
input_right_btn = "h0right"
input_a_btn = "5"
input_x_btn = "2"
input_l_btn = "6"
input_r_btn = "4"
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 = "B"
input_y_btn_label = "A"
input_select_btn_label = "Mode"
input_start_btn_label = "Start"
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_a_btn_label = "C"
input_x_btn_label = "Y"
input_l_btn_label = "X"
input_r_btn_label = "Z"
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"
50 changes: 50 additions & 0 deletions hid/N64_Nintendo_Switch_Online.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
input_driver = "hid"
input_device = "N64 Controller"
input_device_display_name = "Switch N64 Controller"

input_vendor_id = "1406"
input_product_id = "8217"

input_b_btn = "1"
input_a_btn = "0"
input_y_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"
input_y_btn_label = "B"
input_start_btn_label = "Start"
input_select_btn_label = "ZR"
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"
input_r_btn_label = "R"
input_l2_btn_label = "Z"
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"
36 changes: 36 additions & 0 deletions hid/SNES_Nintendo_Switch_Online.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
input_driver = "hid"
input_device = "SNES Controller"
input_device_display_name = "Switch SNES Controller"

input_vendor_id = "1406"
input_product_id = "8215"

input_b_btn = "0"
input_a_btn = "1"
input_y_btn = "2"
input_x_btn = "3"
input_l_btn = "4"
input_r_btn = "5"
input_l2_btn = "6"
input_select_btn = "8"
input_start_btn = "9"
input_r2_btn = "15"
input_up_btn = "h0up"
input_down_btn = "h0down"
input_left_btn = "h0left"
input_right_btn = "h0right"

input_b_btn_label = "B"
input_y_btn_label = "Y"
input_select_btn_label = "SELECT"
input_start_btn_label = "START"
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_a_btn_label = "A"
input_x_btn_label = "X"
input_l_btn_label = "L"
input_r_btn_label = "R"
input_l2_btn_label = "ZL"
input_r2_btn_label = "ZR"

4 comments on commit 48c75d7

@BlindMeander
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I use RetroArch on an iPad and I've tried everything but can't seem to get the SNES controller to work. I've used your config file, copied and pasted it in both hid (where it appeared to already be) and mfi files, but that didn't change anything. I'm at a loss. I was wondering if you knew how to configure it properly. I figured since you created the cfg file, you're probably more clued up than me! :) Thanks

@warmenhoven
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BlindMeander I wasn't able to get it to work on my iPad really at all. It doesn't show up as a proper mfi device on macOS nor on iOS, so on macOS it needs to use the hid input driver. On my iPad despite choosing the hid driver it still wasn't registering key presses correctly. I didn't spend time digging into exactly where it's failing with the hid driver though.

@BlindMeander
Copy link

@BlindMeander BlindMeander commented on 48c75d7 Feb 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After digging into it a little more, I thought a solution might be to have the retroarch app support the controller input remapping feature on iOS (Settings > General > Game controller > SNES Controller > Add Game). The retroarch app would need to appear when selecting 'Add Game'. I don't know if that might solve the problem...

@warmenhoven
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BlindMeander I finally figured out what the problem with the mfi driver was. The NSO controllers show up as microGamepads but have a more complete set of buttons than the microGamepad has an API for, so it's necessary to use the physicalInputProfile if it's available. I have a PR which works for me.

Please sign in to comment.