Homebrew Official HID to VPAD

patters

Well-Known Member
Member
Joined
Jan 28, 2006
Messages
174
Trophies
1
XP
905
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
174
Trophies
1
XP
905
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
174
Trophies
1
XP
905
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: 16
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
11
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
174
Trophies
1
XP
905
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
11
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
174
Trophies
1
XP
905
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
  • Psionic Roshambo @ Psionic Roshambo:
    I just want a Pokemon Hell Raiser fan game 😭
  • K3Nv2 @ K3Nv2:
    Anyone wanna play with my joydock
  • BigOnYa @ BigOnYa:
    Biomutant looks cool tho, may have to try that
  • Quincy @ Quincy:
    Usually when such a big title leaks the Temp will be the first to report about it (going off of historical reports here, Pokemon SV being the latest one I can recall seeing pop up here)
  • K3Nv2 @ K3Nv2:
    I still like how a freaking mp3 file hacks webos all that security defeated by text yet again
  • BigOnYa @ BigOnYa:
    They have simulators for everything nowdays, cray cray. How about a sim that shows you playing the Switch.
  • K3Nv2 @ K3Nv2:
    That's called yuzu
    +1
  • BigOnYa @ BigOnYa:
    I want a 120hz 4k tv but crazy how more expensive the 120hz over the 60hz are. Or even more crazy is the price of 8k's.
  • K3Nv2 @ K3Nv2:
    No real point since movies are 30fps
  • BigOnYa @ BigOnYa:
    Not a big movie buff, more of a gamer tbh. And Series X is 120hz 8k ready, but yea only 120hz 4k games out right now, but thinking of in the future.
  • K3Nv2 @ K3Nv2:
    Mostly why you never see TV manufacturers going post 60hz
  • BigOnYa @ BigOnYa:
    I only watch tv when i goto bed, it puts me to sleep, and I have a nas drive filled w my fav shows so i can watch them in order, commercial free. I usually watch Married w Children, or South Park
  • K3Nv2 @ K3Nv2:
    Stremio ruined my need for nas
  • BigOnYa @ BigOnYa:
    I stream from Nas to firestick, one on every tv, and use Kodi. I'm happy w it, plays everything. (I pirate/torrent shows/movies on pc, and put on nas)
  • K3Nv2 @ K3Nv2:
    Kodi repost are still pretty popular
  • BigOnYa @ BigOnYa:
    What the hell is Kodi reposts? what do you mean, or "Wut?" -xdqwerty
  • K3Nv2 @ K3Nv2:
    Google them basically web crawlers to movie sites
  • BigOnYa @ BigOnYa:
    oh you mean the 3rd party apps on Kodi, yea i know what you mean, yea there are still a few cool ones, in fact watched the new planet of the apes movie other night w wifey thru one, was good pic surprisingly, not a cam
  • BigOnYa @ BigOnYa:
    Damn, only $2.06 and free shipping. Gotta cost more for them to ship than $2.06
  • BigOnYa @ BigOnYa:
    I got my Dad a firestick for Xmas and showed him those 3rd party sites on Kodi, he loves it, all he watches anymore. He said he has got 3 letters from AT&T already about pirating, but he says f them, let them shut my internet off (He wants out of his AT&T contract anyways)
  • K3Nv2 @ K3Nv2:
    That's where stremio comes to play never got a letter about it
  • BigOnYa @ BigOnYa:
    I just use a VPN, even give him my login and password so can use it also, and he refuses, he's funny.
  • BigOnYa @ BigOnYa:
    I had to find and get him an old style flip phone even without text, cause thats what he wanted. No text, no internet, only phone calls. Old, old school.
    BigOnYa @ BigOnYa: I had to find and get him an old style flip phone even without text, cause thats what he wanted...