Homebrew Official HID to VPAD

  • Thread starter Thread starter Maschell
  • Start date Start date
  • Views Views 828,160
  • Replies Replies 2,363
  • Likes Likes 100
Issue with N64 Controller + Adaptoid
I'm trying to get some N64 controllers working with some Adaptoids I have. Buttons work fine, but the joystick is problematic. I'm not too savvy with this stuff, but I think there are possibly a few problems here. The first issue I cannot get around is that the joystick uses signed bytes. From what I can gather the range is about 160, centered at 0, with the min being -80 and the max being +80. I've read that the controller uses 2's complement for the joystick position. I don't fully understand what this means, but it seems to allow for signed bytes. Not sure if HID to VPAD is compatible with this. The second issue I found when using HID Test is that the X and Y position bytes are spread across multiple byte positions in HID Test. For instance, when I move the joystick purely in the X direction, the first digit in position "00" changes and the first digit in position "01" changes. When I move the joystick purely in the Y direction, both digits in position "02" change, and when move the joystick in both X and Y, all the digits in positions "00", "01", and "02" change.

I've created a new configuration file, and like I said above, the buttons are all working fine. I'm hoping someone can help me get the joystick working properly though.
I did some experiments with my Adaptoid and I have determined how it works. I wrote it up here on the controller_patcher GitHub:
https://github.com/Maschell/controller_patcher/issues/23

HID-to-VPAD uses controller_patcher.

The issue is that the controller_patcher code assumes 8bit values. The Adaptoid uses 12bit signed integers from -1200 to 1200 for the joystick axes. It's beyond my current skills to fix that.
 
I have been working on modifying controller_patcher to support multibyte stick input and non-byte-aligned data. Both are necessary for the Adaptoid which uses a pair of 12bit signed values for its axes.
I have built the library, and built HID-to-VPAD around it but there are some issues with it. I really need a way to see on screen what the stick coords are (once it's connected as a Pro Controller). I have confirmed the byte encoding via HIDtest. Are there any tools that can show on-screen stick position? HID-to-VPAD shows which direction in a digital way, but not analogue.
Post automatically merged:

Finally figured out how to enable and collect UDP logging from the Wii U but the messages seems to get delivered very asynchronously.
 
Last edited by patters,
Is there any way to map the pressing in of the joysticks, either left or right? I'm playing Splatoon on my Switch controller, and it requires an input that is pressing in of R stick on gamepad. I thought that I mapped it correctly in my config file, using VPAD_R_Stick_Press, but I'm sure that there needs to be proper naming convention for this to work, yeah? @patters
 
Last edited by crayrayc,
After painstakingly chipping away at this I'm proud to have been able to add Adaptoid support:
https://github.com/Maschell/controller_patcher/pull/42

It works perfectly in the Wii U port of Super Mario 64, and in Wii U titles, but for some reason I have yet to understand it only buffers the input correctly if you bind it as a GamePad, not as a Pro Controller. Also, for me at least, it seems to have some issues in Virtual Console (Super Mario 64 in particular). Hoping @Maschell can help with these remaining details.
 

Attachments

Last edited by patters,
Hello! I'm trying to connect my Xbox Series Controller trhough the network client but it won't appear in it, even aftes scanning for controllers. What can I do?
 
After painstakingly chipping away at this I'm proud to have been able to add Adaptoid support:


It works perfectly in the Wii U port of Super Mario 64, and in Wii U titles, but for some reason I have yet to understand it only buffers the input correctly if you bind it as a GamePad, not as a Pro Controller. Also, for me at least, it seems to have some issues in Virtual Console (Super Mario 64 in particular). Hoping @Maschell can help with these remaining details.
Thank you so much! I think this helps me understand more on configuring the HORI Mario Kart Racing Wheel Pro Deluxe. I'm having trouble understanding the X-axis for the Wheel. The neutral position is 0x00 but either direction causes the values to increase inside of HID-Test. The far left direction jumps back to 0x00 and matches the neutral value, and the far right is 0xFF. The behavior in Hid-to-Vpad has the Left Stick stuck to the far left and moving the wheel causes the controller to stutter quickly from left to right.

Does this steering wheel use synced bytes also? Or am I overlooking something?

(PS, my first post, thanks for the historic community)
 
Thank you so much! I think this helps me understand more on configuring the HORI Mario Kart Racing Wheel Pro Deluxe. I'm having trouble understanding the X-axis for the Wheel. The neutral position is 0x00 but either direction causes the values to increase inside of HID-Test. The far left direction jumps back to 0x00 and matches the neutral value, and the far right is 0xFF. The behavior in Hid-to-Vpad has the Left Stick stuck to the far left and moving the wheel causes the controller to stutter quickly from left to right.

Does this steering wheel use synced bytes also? Or am I overlooking something?

(PS, my first post, thanks for the historic community)
Yes, it's probably signed, which is a way to store both positive and negative numbers in binary. So instead of encoding 0-255 in a byte, you use it to store -128 to 127 including zero. Or for example -32768 to 32767 in a pair of bytes. The binary data is still the same - a byte is still 0-255 but the difference is how you interpret it.

The negative numbers are not encoded completely intuitively, they are stored using 'Two's Complement Notation'. You can experiment with an online converter to check the values you see in HID-Test:
https://www.allmath.com/twos-complement.php

Use the calculator on your computer in programmers mode to set binary bits and convert to and from hexadecimal numbers. For example, -128 will show as 0x80 (128) in HID-Test. By carefully recording and decoding the results that you are seeing in HID-Test you should be able to figure it out, like I did for the Adaptoid here. Notice that the HID descriptor data will absolutely tell you whether the axis data is signed, via the logical Min/Max fields.

If you download my build, you can look at my Adaptoid INI file and use it to try to build an INI for your device.
 
Last edited by patters,
  • Like
Reactions: DreamAddict
Yes, it's probably signed, which is a way to store both positive and negative numbers in binary. So instead of encoding 0-255 in a byte, you use it to store -128 to 127 including zero. Or for example -32768 to 32767 in a pair of bytes. The binary data is still the same - a byte is still 0-255 but the difference is how you interpret it.

The negative numbers are not encoded completely intuitively, they are stored using 'Two's Complement Notation'. You can experiment with an online converter to check the values you see in HID-Test:

Use the calculator on your computer in programmers mode to set binary bits and convert to and from hexadecimal numbers. For example, -128 will show as 0x80 (128) in HID-Test. By carefully recording and decoding the results that you are seeing in HID-Test you should be able to figure it out, like I did for the Adaptoid here. Notice that the HID descriptor data will absolutely tell you whether the axis data is signed, via the logical Min/Max fields.

If you download my build, you can look at my Adaptoid INI file and use it to try to build an INI for your device.

Is there support for 16bit HID axis?

I'm beginning with this configuration and playing around with my MinMax values.


VPad_L_Stick_X = 0x06, 0x00 VPad_L_Stick_X_Bit_Length = 0x10 // 16bit HID axis report VPad_L_Stick_X_Signed = True // Range includes negative values VPad_L_Stick_X_MinMax = 0x8000, 0x7FFF VPad_L_Stick_X_MinMax_MSB = 0x80, 0x7F VPad_L_Stick_X_Deadzone = 0x20
 
Yes, my modified build supports bit lengths from 8 to 16. But your MinMax can only be 8 bit (so as not to break the processing for existing INI files). The high bytes of each 16 bit pair will be entered in the MinMax_MSB.
So in your example INI MinMax should be 0x00, 0xFF. MinMax_MSB is correct as shown.
 
Last edited by patters,
I have finally moved over to Aroma and I'm using the version of hid_to_vpad from the Aroma plugins thread. The persistence is really nice, makes it easy for my kids to use a GC controller instead of the giant gamepad.

Is this built from the source code in the wups branch on the GitHub repo (6 years old)? Or is it something more recent? I don't really have the patience to re-read 117 pages of this thread. I did it once while researching for my Adaptoid modification.

At some point I will try to port my Adaptoid support changes. I did have a go before but couldn't set up a working wups build environment, despite that my devkitpro is fine.
 
I have brewed up an aroma build of hid_to_vpad 0.1.1-alpha with Adaptoid N64 controller adapter support - and support for any controller with up to 16bit HID axis reports, and for controllers with signed HID axis reports (ranges with negative numbers). You can inspect my Adaptoid INI file to get the hang of how to do this. INI files are read from wiiu/controller, as before.

My pull request on the controller_patcher repo, with all the details, here:
https://github.com/Maschell/controller_patcher/pull/44
 

Attachments

Last edited by patters,
Just asking if possible: Could Dualshock 2 be added?

It's been years since I've used this, but doesn't it just work on your Wii U with whatever PC controller you can use? So if you can get it working on PC it should work with this. Although you might need a custom .ini just remembered that.
 
I cleaned up my fork of the Aroma controller_patcher code some more and turned the axis processing into a function rather than repeating a huge chunk four times.

It will be possible to make INI files for racing wheels and pedals which use 16bit HID axis reports, using this build. See the notes in the included INI file for instructions.
 

Attachments

Last edited by patters,
  • Like
Reactions: ber71
I have brewed up an aroma build of hid_to_vpad 0.1.1-alpha with Adaptoid N64 controller adapter support - and support for any controller with up to 16bit HID axis reports, and for controllers with signed HID axis reports (ranges with negative numbers). You can inspect my Adaptoid INI file to get the hang of how to do this. INI files are read from wiiu/controller, as before.

My pull request on the controller_patcher repo, with all the details, here:
https://github.com/Maschell/controller_patcher/pull/44
just what i needed! i love you, man!
 
Last edited by vugmusgalstadt,
  • Like
Reactions: patters

Site & Scene News

Popular threads in this forum