mupen64plus / mupen64plus-user-issues

Issue reports from users go here
http://www.mupen64plus.org/
17 stars 3 forks source link

Single HuiJia USB GamePad detected as 4 controllers and real controllers mapped to 1 and 3. #709

Closed moll closed 5 years ago

moll commented 5 years ago

Hey,

It seems the HuiJia USB GamePad controller is detected by the Linux v4.18 kernel as two different joystick devices and assigned /dev/input/js0 and /dev/input/js1. jstest confirms they both send signals fine. However mupen64plus v2.5 (https://www.archlinux.org/packages/community/x86_64/mupen64plus/) (or SDL?) detects them as 4 controllers, assigning js0 to Nintendo 64's 1 and 2 slots and the js1 one to slots 3 and 4. In-game therefore 1st physical maps to 1st virtual and 2nd physical maps to 3rd virtual.

I've so far been unable to come up with the concoction of mupen64plus.cfg settings that would map the physical controllers to virtual controllers correctly. Could the change from one device with two controllers to two separate js# devices have been a change in the kernel that SDL and mupen64plus haven't anticipated? Any way to get this back to working through configuration?

Thanks in advance!

moll commented 5 years ago

On a clean mupen64plus run, the following is spit out to stdout:

UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 2 SDL joysticks were found.
Input: N64 Controller #1: Using auto-config with SDL joystick 0 ('HuiJia  USB GamePad')
Input: N64 Controller #2: Using auto-config with SDL joystick 0 ('HuiJia  USB GamePad')
Input: N64 Controller #3: Using auto-config with SDL joystick 1 ('HuiJia  USB GamePad')
Input: N64 Controller #4: Using auto-config with SDL joystick 1 ('HuiJia  USB GamePad')
Input: 4 controller(s) found, 4 plugged in and usable in the emulator
Input Warning: No rumble supported on N64 joystick #1
Input Warning: No rumble supported on N64 joystick #2
Input Warning: No rumble supported on N64 joystick #3
Input Warning: No rumble supported on N64 joystick #4
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.

Swapping the Input-SDL-Control3 and Input-SDL-Control2 section contents doesn't seem to have the expected effect either, as doesn't swapping them with mode = 0 for manual config.

It wouldn't be problematic for controllers to be mapped wrong if it weren't for games using only the first two virtual controllers when selecting in-game 2-player modes...

moll commented 5 years ago

Phew, managed to solve this one by copying the button assignments from the first controller config to the second one and change its device to 1, then disable the remaining 2 Input-SDL-Control sections.

In summary, the InputAutoCfg.ini as it stands today seems to be wrong OR I've got a slightly different gamepad from the one Mupen64Plus by default configures to. How would we find out? I suppose we should fix the automatic configuration, too, to save future players from having to debug all this.

richard42 commented 5 years ago

They must have changed the kernel driver for this device. Previously, it showed up as a single joystick but the first N64 controller was mapped to one set of buttons, and the second N64 controller was mapped to a different set of buttons. It's actually better the new way. I'll modify the inputautoconfig file to work with the new kernel driver.

richard42 commented 5 years ago

It would be helpful if someone could test this an macOS as well. This joystick adapter has separate configs for each operating system.