PabloMK7 / citra

A Nintendo 3DS Emulator
GNU General Public License v2.0
3.71k stars 629 forks source link

Android - D-Pad only accepts axis inputs #17

Open sgern opened 7 months ago

sgern commented 7 months ago

Is there an existing issue for this?

Affected Build(s)

Ñ

Description of Issue

Controllers that implement their D-Pad as four buttons rather than two axes can't map their D-Pad properly on Android, as the emulator only accepts two-axis inputs for D-Pad mapping. This is a known issue from the old repo in the Android version of the emulator that has not been fixed for over three years. Affected controllers include the DualShock 3 and JoyCon Pair. The MMJ fork is able to properly map four-button D-Pads, although I'm not sure if that comes at the cost of losing two-axis D-Pad support.

Expected Behavior

When I try to map the D-Pad inputs with the affected controllers, they should map properly.

Reproduction Steps

  1. Connect a DualShock 3, JoyCon Pair, or other affected controller to an Android device running the emulator, either by USB or Bluetooth.
  2. Attempt to map the controller's D-Pad to the emulator's D-Pad.

Log File

N/A

System Configuration

Device: Galaxy Tab A8 Controllers: DualShock 3, JoyCon Pair

DavidRGriswold commented 3 months ago

This is the same as #172

Citra MMJ solves this problem by using four inputs for all directional axes, essentially treating axis + direction as one button for digital controls. That way any axis direction or a button can be mapped to any input. This also opens up, for example, keyboard input on dpad and joysticks, though I'm not certain if the android backend supports keypresses. It should also open a way to reverse axes at a system level - just map up to down and down to up!

@PabloMK7 do you have any objection to me trying to reorganize the android input this way and making a PR? I realize I'd need to have it translate the old way into the new way upon loading settings and also handle the digital-to-analog conversion in situations a button (e.g. wasd) is mapped to an analog stick, but I assume citra-qt already does that so I should be able to see how they do it and try to match it.

The only real disadvantage I see is that you have to do a few additional steps when mapping - 12 directional inputs instead of 6. The flexibility seems worth it though.