Sign in to follow this  
Sc0rp

Raw Input - Joystick data format / Joystick layout

Recommended Posts

Sc0rp    122
Microsoft's Raw Input gives us a structure for mouse and keyboard inputs. But for joysticks, the data is plain binary. Is there a way to interpret that data without having to guess? A lot of games can list your joysticks and its buttons and axis (and sometimes even name them). So there must be a way to get this information. The top level collection can easily be probed by using GetRawInputDeviceInfo() and then looking into the RID_DEVICE_INFO.hid.usUsagePage and usUsage. Joysticks are 0x04 and I guess there must be a way to know that a joystick has x axis (usages from 0x30 to 0x35) and y buttons. That way I can interpret what the binary data means. The outputed data looks like this (for my joystick): 0x00 0x80 0x80 0x80 0x80 0x08 0x00 0x44 0xfd I know that octets from 1 to 4 are axix and the rest are buttons. But that's a guess which is made for my joystick. Thanks for any help you can give me.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this