Homebrew Official HID to VPAD

patters

Well-Known Member
Member
Joined
Jan 28, 2006
Messages
172
Trophies
1
XP
884
Country
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.
 

patters

Well-Known Member
Member
Joined
Jan 28, 2006
Messages
172
Trophies
1
XP
884
Country
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,

crayrayc

New Member
Newbie
Joined
Feb 18, 2024
Messages
1
Trophies
0
Age
30
XP
12
Country
United States
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,

patters

Well-Known Member
Member
Joined
Jan 28, 2006
Messages
172
Trophies
1
XP
884
Country
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

  • hidtovpad_adaptoid.zip
    4.2 MB · Views: 14
Last edited by patters,

Alonsinwhat

New Member
Newbie
Joined
Jan 28, 2024
Messages
1
Trophies
0
Age
18
XP
9
Country
Chile
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?
 

DreamAddict

New Member
Newbie
Joined
Apr 22, 2024
Messages
2
Trophies
0
XP
7
Country
United States
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)
 

patters

Well-Known Member
Member
Joined
Jan 28, 2006
Messages
172
Trophies
1
XP
884
Country
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

DreamAddict

New Member
Newbie
Joined
Apr 22, 2024
Messages
2
Trophies
0
XP
7
Country
United States
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
 

patters

Well-Known Member
Member
Joined
Jan 28, 2006
Messages
172
Trophies
1
XP
884
Country
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,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: Lol rappers still promoting crypto