Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adopting Xinput control mapping as standard #46

Open
doqfgc opened this issue Aug 3, 2022 · 1 comment
Open

Consider adopting Xinput control mapping as standard #46

doqfgc opened this issue Aug 3, 2022 · 1 comment

Comments

@doqfgc
Copy link

doqfgc commented Aug 3, 2022

As it is currently, vitastick's control mapping is a bit odd at best and completely unusable at worst. That said, I don't want to leave this issue if it's just a complaint; this would be the fifth issue to do so if I did.

Thus, I'd like to formally suggest adjusting the control mapping to better match Xinput controllers. It would allow most games to work near-flawlessly out of the box and, as a de facto standard in controllers, would have great support on most if not all platforms.

I tried to make this work myself and submit a PR instead, but I hit a couple of roadblocks in the process of making that work, so I'll leave my notes here for any developers who are much better than myself.

The following table is what each control on the Vita maps to, and what it should be on an Xinput mapping:

Control vitastick mapping xinput mapping
CROSS 1 0
CIRCLE 2 1
SQUARE 0 4
TRIANGLE 3 5
L 4 6
R 5 7
LT/L2 6 8
RT/R2 7 9
LS/L3 10 13
RS/R3 11 14
SELECT 8 10
START 9 11
HOME unmapped 12
STICK L axis 1,2 axis 1,2
STICK R axis 3,4 axis 3,4
D-PAD buttons 12-15 axis 7,8
ANA LT,RT unmapped axis 6 (LT),5 (RT)

It was suggested in #39 that the code could be changed to change the mapping; however, I ran into issues with having vitastick report 8 axes instead of 4, and I have no idea where in the code I'd have to change that because it's not the part of the code that handles mapping the buttons.

Implementing this would not only close this issue but also close issues #4, #7, #18, #39, and potentially #27 if back-touchpad support gets added.

EDIT: Maybe not #4 unless PS3XPAD is used.

@xerpi
Copy link
Owner

xerpi commented Aug 3, 2022

To change the number of axes, I think the 0x04 on this line needs to be changed: https://github.com/xerpi/vitastick/blob/master/skprx/usb_descriptors.h#L24
You can use this tool to help visualize that: https://eleccelerator.com/usbdescreqparser/
If you change that value, then you also have to change this struct: https://github.com/xerpi/vitastick/blob/master/skprx/main.c#L17
See that right now there's only 4 axis: left_x, left_y, right_x, right_y. You could change that to int8_t axis[8] for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants