xerpi / viimote

41 stars 7 forks source link

Analog Sticks Classic Controller #10

Open HereForLinus opened 4 years ago

HereForLinus commented 4 years ago

I am able to connect the Wiimote just fine and use any extension, but when I use the Classic Controller (also tried it on a Pro) the sticks seem like they have a limited range of motion. I confirmed this when I launched Minecraft and when I tried to move my character forward, it does so very slowly but when using the Vita's sticks, it moves just fine.

xerpi commented 4 years ago

Probably those value are slightly off: https://github.com/xerpi/viimote/blob/master/main.c#L24 Do you know how to compile? Hint: https://vitasdk.org/

zerofalcon commented 4 years ago

I can confirm this issue and it happens for the nunchuck too. Tested both an original wiimote with/without motion plus attached and a wiimote plus. If I connect my wired fight pad in the wiimote the range values are fine, so, the problem lies only on the nunchuck and both wii classic controllers.

xerpi commented 4 years ago

I don't have those accessories myself so I can't test it. If you could install vitasdk, try changing some deadzones/parameters and then submitting feedback it would be very appreciated.

AGTS10k commented 4 years ago

I have a Classic Controller, but don't have a Nunchuck. I know nothing about VitaSDK or how to use git and compile software, but I am willing to learn. So far I think I understand how to install VitaSDK via msys2, but I have no idea on what to do next. Can you point me to some instructions, please? Oh, and is there a homebrew for testing Vita's button's and sticks on the Vita itself? Because so far I can think only about streaming the Vita's input to my Windows machine via vitapad or vitastick or the like.

Also, how hard would it be to make the plugin read the mapping and deadzone/sensitivity values from a file, instead of hardcoding them? That would actually make testing and finding the right values much easier, and will allow for remapping. I, for one, would very like to remap the O to A and X to B, because they are being the other way around currently.

xerpi commented 4 years ago

@BFG1992 to compile:

mkdir build
cd build
cmake ..
make

This will generate the skprx. To change the mapping (from code) change this line: https://github.com/xerpi/viimote/blob/master/main.c#L430 And you can also change the analog threshold here: https://github.com/xerpi/viimote/blob/master/main.c#L22

AGTS10k commented 4 years ago

@xerpi So, I have learned how to recompile it and fiddled with values around the lines you have linked. I successfully managed to swap the A and B mappings, but I had problems with finding the proper ranges of the analog sticks. I never understood how CLASSIC_ANALOG_THRESHOLD value affects the actual control, as it feels the same, no matter if I set 0 or 10 there instead of the default 3. I have also tried increasing the CLASSIC_ANALOG_L_MAX and CLASSIC_ANALOG_R_MAX values, but that only made the sticks to register off-center in released state. I'm also bad at math and programming, so I struggle to understand how it all works... I have made a video, though, where I demonstrate how the analogs work and what values are reported with precompiled 1.2 release, using the VitaTester homebrew: https://www.youtube.com/watch?v=27YKkcLTHQc From what I saw, the actual ranges the sticks reach are generally from 20-25 to 230-235, which is approximately 20-25 to reach the fully tilted state of either side of axes. If you have any suggestions on which values I should set into which variables - let me know, I'll put them to the test.

P.S.: I actually have the Wii Classic Controller Pro, not the regular, older one with analog triggers. Sorry for misinformation there.

zerofalcon commented 4 years ago

@xerpi So, I have learned how to recompile it and fiddled with values around the lines you have linked. I successfully managed to swap the A and B mappings, but I had problems with finding the proper ranges of the analog sticks. I never understood how CLASSIC_ANALOG_THRESHOLD value affects the actual control, as it feels the same, no matter if I set 0 or 10 there instead of the default 3. I have also tried increasing the CLASSIC_ANALOG_L_MAX and CLASSIC_ANALOG_R_MAX values, but that only made the sticks to register off-center in released state. I'm also bad at math and programming, so I struggle to understand how it all works... I have made a video, though, where I demonstrate how the analogs work and what values are reported with precompiled 1.2 release, using the VitaTester homebrew: https://www.youtube.com/watch?v=27YKkcLTHQc From what I saw, the actual ranges the sticks reach are generally from 20-25 to 230-235, which is approximately 20-25 to reach the fully tilted state of either side of axes. If you have any suggestions on which values I should set into which variables - let me know, I'll put them to the test.

P.S.: I actually have the Wii Classic Controller Pro, not the regular, older one with analog triggers. Sorry for misinformation there.

Hi and sorry if this is already resolved. Whats the progress so far with the stick values? Thanks in advanced.

AGTS10k commented 4 years ago

@zerofalcon I did no further testing of the plugin since writing that comment. As I stated: I don't really understand how to program such stuff and am bad at math, so fiddling with the stick values in the code is all I can do, sadly. I never found values that would make the Wii Classic Controller Pro analog sticks to report ranges of 0-255 on the Vita, as the Vita's sticks do. I (wildly) guessed that maybe it isn't as simple as just putting in some right values, so I have posted my findings in hope that xerpi finds them useful and makes according changes to the code, but it seems that either my testing wasn't useful or xerpi is not interested in further development of this plugin :(

Coincidentally, I have bought myself a (used) Nunchuk yesterday, so I might have a try at tweaking the values once again, after it arrives tomorrow. The code for the Classic Controller analogs and for the Nunchuk analog is different, so maybe I can compare the reported values of both attachments and figure something out... Don't count on that though.

xerpi commented 4 years ago

Just tested it with a Nunchuk and it works fine. I've also done some simplifications/improvements to the code, can you test this with both the Classic and Nunchuk? I have already pushed the changes to master if you want to take a look.

viimote.zip

zerofalcon commented 4 years ago

Thank you for the update xerpi. I made a test and as you said nunchuks now work fine. On the contrary, classic controller now have inverted the Left stick Y axis, if I push the stick Up it act as Down pressed and viceversa. I noticed that pushing the stick UP the range value seem reaching the max value, while pushing down stays on minimum/mid range. The right stick is fine, but has the same issue of limited min/mid range value pushing left and up. Maybe if the classic controller can use the same min/max analog values as the nunchuks this can be solved.

xerpi commented 4 years ago

Just committed the fix with to the inverted left Y axis. Regarding the min/max values, can you try playing with those values: https://github.com/xerpi/viimote/blob/master/main.c#L22 ? For example with something like:

#define CLASSIC_ANALOG_L_MIN        4
#define CLASSIC_ANALOG_L_MAX        60
#define CLASSIC_ANALOG_R_MIN        2
#define CLASSIC_ANALOG_R_MAX        30