wiredopposite / OGX-Mini

RP2040 USB gamepad emulation for multiple platforms.
MIT License
89 stars 5 forks source link

Nintendo Switch output modes #5

Open Invictaz opened 4 months ago

Invictaz commented 4 months ago

There isn't any real solution right now for Nintendo Switch unhacked consoles.

We have sys-con but it requires a hacked console.

https://github.com/cathery/sys-con

And we have https://github.com/gdsports/NSGadget_Teensy

But it requires a Teensy. Not a much cheaper Pico.

There is

https://github.com/juan518munoz/PicoSwitch-WirelessGamepadAdapter

But it is bluetooth and not usb input

I hope you can use these projects and the Dekunukem documentation to have Nintendo Switch output.

Apparently there is a whitelist

https://switchbrew.org/wiki/USB_services#HidGamepad

Also it might be that the adapter only works on the dock because of power limitations. The dock is 15 volts 39 watt and the Switch only 5 volts. Maybe the power requirements are met with an Y cable.

ImSammy6 commented 3 months ago

The description says it supports switch, does it not work for you?

Actually it seems like that was added after you posted this

Invictaz commented 3 months ago

~The description says it supports switch, does it not work for you?~

Actually it seems like that was added after you posted this

I understand your question. However, the 0.2.0 version added various Switch controllers as input, not changed the output to Switch.

It depends on the game how the adapter should output as not all Switch games accept a Pro Controller Maybe it is needed to emulate 2 joycons. Therefore I would like to keep the discussion open on Switch output.

Invictaz commented 3 months ago

I double checked. The emulated Switch controller is not a pro controller so it cannot be remapped in the Switch menu. See https://github.com/jfedor2/hid-remapper/issues/118 for screenshots.

The 8Bitdo adapter 2 connected directly to a Switch does emulate a Switch Pro, however if you connect a 8bitdo Pro 2 via the OGX-Mini it cannot be in Switch output mode (view+LB). Only in right + view mode. Not sure why.

wiredopposite commented 3 months ago

I honestly don't know that much about the joycons and which games require them, I'm not even sure they're connectable via USB. If not then emulating them is not an option for the Pico. I also don't know how the 8bitdo behaves when switching modes so it could get handled incorrectly if it's not in Xinput mode, I'll add that to the readme.

Both the NSGadget_Teensy and PicoSwitch-WirelessGamepadAdapter are doing the same thing as the OGX-Mini, they're emulating a basic wired non-pro gamepad. I do plan on improving Switch support (similar to 8bitdo) after I iron out some issues with PS3, I have a hardware USB sniffer coming soon so that'll make it way easier for me.

Invictaz commented 3 months ago

The Switch Pro is 057e 2009

The joycons support usb when connected to this handle. It's a couple of dollars in a lot of marketplaces and second hand stores.

Nintendo-Switch-JoyCon-Grip-Chargeable-01

There is information on how the Joycons both as L+R can work

https://github.com/libsdl-org/SDL/blob/main/src/joystick/hidapi/SDL_hidapi_switch.c

https://source.chromium.org/chromium/chromium/src/+/main:device/gamepad/nintendo_controller.h

Type USB Vendor ID 057E Vendor Name Nintendo Co., Ltd Device ID 200E Device Name Joy-Con Charging Grip

I will reply to the other soon

Invictaz commented 3 months ago

There are some games that don't support the Switch Pro. Most known one is Super Mario Party.

1) Super Mario Party

2) The World Ends with You

3) Ring Fit

4) Nintendo Labo

5) Just Dance Series

6) 1-2-Switch

7) Pokémon: Let's Go, Pikachu! and Let's Go, Eevee!

8) The Stretchers (Doesn't support Multiplayer mode)

9) Clubhouse Games: 51 Worldwide Classics (Doesn't support Motion-Based Games EXP: darts, bowling)

10) Resident Evil Revelations 1 & 2 (Doesn't support Gyro aiming)

11) Astral Chain (Doesn't support Multiplayer Mode)

12) SEGA AGES Virtua Racing (Doesn't support Multiplayer mode)

13) Fitness Boxing 1 and 2

14) Jump Rope Challenge

Invictaz commented 3 months ago

Here is the output of the 8bitdo pro 2 adapter in Nintendo Switch mode (Select + L1)

LSUSB -d

ubuntu@ubuntu:~/Downloads/xone$ lsusb -d 057e:2009 Bus 001 Device 027: ID 057e:2009 Nintendo Co., Ltd Pro Controller DMESG

 8781.416949] i915 0000:00:02.0: [drm] HPD interrupt storm detected on connector HDMI-A-3: switching from hotplug detection to polling
[12279.162834] usb 1-4: USB disconnect, device number 18
[12294.548277] usb 1-3: USB disconnect, device number 3
[12302.632451] usb 1-4: new full-speed USB device number 19 using xhci_hcd
[12302.782576] usb 1-4: New USB device found, idVendor=2dc8, idProduct=3106, bcdDevice= 1.00
[12302.782588] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12302.782594] usb 1-4: Product: 8BitDo Receiver
[12302.782599] usb 1-4: Manufacturer: 8BitDo
[12302.782603] usb 1-4: SerialNumber: E417D8743AB1
[12303.181994] usb 1-4: USB disconnect, device number 19
[12303.488452] usb 1-4: new full-speed USB device number 20 using xhci_hcd
[12303.638534] usb 1-4: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.14
[12303.638546] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12303.638552] usb 1-4: Product: Controller
[12303.638556] usb 1-4: Manufacturer: 8BitDo
[12303.638561] usb 1-4: SerialNumber: E417D8743AB1
[12304.039159] usb 1-4: USB disconnect, device number 20
[12304.352471] usb 1-4: new full-speed USB device number 21 using xhci_hcd
[12304.502425] usb 1-4: New USB device found, idVendor=057e, idProduct=2009, bcdDevice= 2.10
[12304.502437] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12304.502443] usb 1-4: Product: Pro Controller
[12304.502448] usb 1-4: Manufacturer: Nintendo Co., Ltd.
[12304.502452] usb 1-4: SerialNumber: E417D8743AB1
[12304.506169] input: Nintendo Co., Ltd. Pro Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:057E:2009.0026/input/input66
[12304.506815] hid-generic 0003:057E:2009.0026: input,hidraw8: USB HID v1.11 Joystick [Nintendo Co., Ltd. Pro Controller] on usb-0000:00:14.0-4/input0
[12305.102230] usb 1-4: USB disconnect, device number 21
[12305.428495] usb 1-4: new full-speed USB device number 22 using xhci_hcd
[12305.577463] usb 1-4: New USB device found, idVendor=054c, idProduct=0cda, bcdDevice= 1.00
[12305.577476] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[12305.577482] usb 1-4: Product: Controller
[12305.577486] usb 1-4: Manufacturer: Sony Interactive Entertainment
[12305.579793] input: Sony Interactive Entertainment Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:054C:0CDA.0027/input/input67
[12305.580243] hid-generic 0003:054C:0CDA.0027: input,hidraw8: USB HID v1.11 Gamepad [Sony Interactive Entertainment Controller] on usb-0000:00:14.0-4/input0
[12305.581349] input: Sony Interactive Entertainment Controller Consumer Control as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1/0003:054C:0CDA.0028/input/input68
[12305.640785] input: Sony Interactive Entertainment Controller System Control as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1/0003:054C:0CDA.0028/input/input69
[12305.641143] hid-generic 0003:054C:0CDA.0028: input,hidraw9: USB HID v1.10 Device [Sony Interactive Entertainment Controller] on usb-0000:00:14.0-4/input1
[12306.574867] usb 1-4: USB disconnect, device number 22
[12306.956520] usb 1-4: new full-speed USB device number 23 using xhci_hcd
[12307.106505] usb 1-4: New USB device found, idVendor=057e, idProduct=2009, bcdDevice= 2.10
[12307.106517] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12307.106523] usb 1-4: Product: Pro Controller
[12307.106528] usb 1-4: Manufacturer: Nintendo Co., Ltd.
[12307.106532] usb 1-4: SerialNumber: E417D8743AB1
[12307.110058] input: Nintendo Co., Ltd. Pro Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:057E:2009.0029/input/input70
[12307.168950] hid-generic 0003:057E:2009.0029: input,hidraw8: USB HID v1.11 Joystick [Nintendo Co., Ltd. Pro Controller] on usb-0000:00:14.0-4/input0
[12308.301745] usb 1-4: USB disconnect, device number 23
[12308.624545] usb 1-4: new full-speed USB device number 24 using xhci_hcd
[12308.774362] usb 1-4: New USB device found, idVendor=2dc8, idProduct=3107, bcdDevice= 2.00
[12308.774374] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12308.774380] usb 1-4: Product: IDLE
[12308.774385] usb 1-4: Manufacturer: 8BitDo
[12308.774389] usb 1-4: SerialNumber: E417D8743AB1
[12308.777847] hid-generic 0003:2DC8:3107.002A: hiddev1,hidraw8: USB HID v1.10 Device [8BitDo IDLE] on usb-0000:00:14.0-4/input0
[12324.914550] usb 1-4: USB disconnect, device number 24
[12325.372795] usb 1-4: new full-speed USB device number 25 using xhci_hcd
[12325.522496] usb 1-4: New USB device found, idVendor=2dc8, idProduct=3107, bcdDevice= 2.00
[12325.522508] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12325.522515] usb 1-4: Product: IDLE
[12325.522519] usb 1-4: Manufacturer: 8BitDo
[12325.522523] usb 1-4: SerialNumber: E417D8743AB1
[12325.525653] hid-generic 0003:2DC8:3107.002B: hiddev1,hidraw8: USB HID v1.10 Device [8BitDo IDLE] on usb-0000:00:14.0-4/input0
[12327.556372] usb 1-4: USB disconnect, device number 25
[12328.028819] usb 1-4: new full-speed USB device number 26 using xhci_hcd
[12328.179225] usb 1-4: New USB device found, idVendor=2dc8, idProduct=3106, bcdDevice= 1.00
[12328.179237] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12328.179243] usb 1-4: Product: 8BitDo Receiver
[12328.179247] usb 1-4: Manufacturer: 8BitDo
[12328.179251] usb 1-4: SerialNumber: E417D8743AB1
[12333.350071] usb 1-4: USB disconnect, device number 26
[12334.320922] usb 1-4: new full-speed USB device number 27 using xhci_hcd
[12334.471249] usb 1-4: New USB device found, idVendor=057e, idProduct=2009, bcdDevice= 2.10
[12334.471262] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12334.471269] usb 1-4: Product: Pro Controller
[12334.471273] usb 1-4: Manufacturer: Nintendo Co., Ltd.
[12334.471278] usb 1-4: SerialNumber: E417D8743AB1
[12334.477531] input: Nintendo Co., Ltd. Pro Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:057E:2009.002C/input/input71
[12334.541466] hid-generic 0003:057E:2009.002C: input,hidraw8: USB HID v1.11 Joystick [Nintendo Co., Ltd. Pro Controller] on usb-0000:00:14.0-4/input0

When there is no controller connected the 8bitdo Pro 2 adapter is in IDLE mode

Bus 001 Device 003: ID 2dc8:3107 8BitDo IDLE

0x05, 0x8C,        // Usage Page (Bar Code Scanner Page)
0x09, 0x01,        // Usage (0x01)
0xA1, 0x01,        // Collection (Application)
0x85, 0x02,        //   Report ID (2)
0x09, 0x03,        //   Usage (0x03)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0x00, 0xFF,  //   Logical Maximum (-256)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x85, 0x81,        //   Report ID (-127)
0x09, 0x04,        //   Usage (0x04)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0x00, 0xFF,  //   Logical Maximum (-256)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection

// 37 bytes

When connected with a controller outputting as Switch Pro

0x95, 0x0A,        //   Report Count (10)
0x55, 0x00,        //   Unit Exponent (0)
0x65, 0x00,        //   Unit (None)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x09,        //   Usage Page (Button)
0x19, 0x0B,        //   Usage Minimum (0x0B)
0x29, 0x0E,        //   Usage Maximum (0x0E)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x04,        //   Report Count (4)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x75, 0x01,        //   Report Size (1)
0x95, 0x02,        //   Report Count (2)
0x81, 0x03,        //   Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x0B, 0x01, 0x00, 0x01, 0x00,  //   Usage (0x010001)
0xA1, 0x00,        //   Collection (Physical)
0x0B, 0x30, 0x00, 0x01, 0x00,  //     Usage (0x010030)
0x0B, 0x31, 0x00, 0x01, 0x00,  //     Usage (0x010031)
0x0B, 0x32, 0x00, 0x01, 0x00,  //     Usage (0x010032)
0x0B, 0x35, 0x00, 0x01, 0x00,  //     Usage (0x010035)
0x15, 0x00,        //     Logical Minimum (0)
0x27, 0xFF, 0xFF, 0x00, 0x00,  //     Logical Maximum (65534)
0x75, 0x10,        //     Report Size (16)
0x95, 0x04,        //     Report Count (4)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              //   End Collection
0x0B, 0x39, 0x00, 0x01, 0x00,  //   Usage (0x010039)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x07,        //   Logical Maximum (7)
0x35, 0x00,        //   Physical Minimum (0)
0x46, 0x3B, 0x01,  //   Physical Maximum (315)
0x65, 0x14,        //   Unit (System: English Rotation, Length: Centimeter)
0x75, 0x04,        //   Report Size (4)
0x95, 0x01,        //   Report Count (1)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x09,        //   Usage Page (Button)
0x19, 0x0F,        //   Usage Minimum (0x0F)
0x29, 0x12,        //   Usage Maximum (0x12)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x04,        //   Report Count (4)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x75, 0x08,        //   Report Size (8)
0x95, 0x34,        //   Report Count (52)
0x81, 0x03,        //   Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)
0x85, 0x21,        //   Report ID (33)
0x09, 0x01,        //   Usage (0x01)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x81, 0x03,        //   Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x85, 0x81,        //   Report ID (-127)
0x09, 0x02,        //   Usage (0x02)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x81, 0x03,        //   Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x85, 0x01,        //   Report ID (1)
0x09, 0x03,        //   Usage (0x03)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x91, 0x83,        //   Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Volatile)
0x85, 0x10,        //   Report ID (16)
0x09, 0x04,        //   Usage (0x04)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x91, 0x83,        //   Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Volatile)
0x85, 0x80,        //   Report ID (-128)
0x09, 0x05,        //   Usage (0x05)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x91, 0x83,        //   Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Volatile)
0x85, 0x82,        //   Report ID (-126)
0x09, 0x06,        //   Usage (0x06)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x91, 0x83,        //   Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Volatile)
0xC0,              // End Collection

// 203 bytes