PabloMK7 / citra

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

Use buttons instead of axes for the d-pad, enabling mapping from game… #203

Closed DavidRGriswold closed 3 months ago

DavidRGriswold commented 4 months ago

(this is my second attempt at this PR because I accidentally deleted the entire branch on remote, which closed the original PR. Sorry. Still figuring out git and github!)

This PR will fix issues https://github.com/PabloMK7/citra/issues/172 and https://github.com/PabloMK7/citra/issues/17 , which I confirmed were a problem. Instead of using Axis+ and Axis- inputs for the d-pad, it uses button inputs instead.

I tested with every controller I have available right now - an 8bitdo micro in switch pro mode (which did not work before but does now) and android mode (which did work before and still does), a Dualshock 4, and my Gamesir g8 - and they all work fine with this change. I believe that every controller that outputs an axis for the d-pad will ALSO output button presses, so this shouldn't break for any controller.

The only negative is that users will need to map their controller again - it did not maintain the old mapping for me even when the inputs were the same. I'm not sure why, to be honest, but it seems like a pretty minor ask all things considered.

Lime3DS solves this differently, by offering both axis mapping AND button mapping for the d-pad, but I don't think its necessary. It's probably confusing to most users, to be honest, who may not understand the difference.

PabloMK7 commented 4 months ago

What about controllers that don't have a dpad but have 2 sticks? I feel like having the option to map both buttons and sticks would be more valuable :)

hosjou commented 4 months ago

Dpad emulation doesn't really need precise axis coordinates afaik. As long as values are available it should be work. Up Yaxis - Down Yaxis + Left Xaxis - Right Xaxis +

Disclaimer, i don't really understand this but other emulators are doing this rather than only detect dpad axis.

PabloMK7 commented 2 months ago

@DavidRGriswold this change breaks some controllers: https://x.com/CYPH3Rs_D0M41N_/status/1827245482562720224

DavidRGriswold commented 2 months ago

Huh, that surprises me after I tested with several different controllers and it worked with all of them. I guess that must be why lime3ds has both options.

MissAnnTropist commented 2 months ago

Just reported this issue my pad NEEDS to be treated as an axis, now I had to roll back because I can't use the d-pad even when it's properly registered.