RAWINPUT and multiple Joypads

Started by
1 comment, last by Tom Sloper 7 years, 10 months ago

i want to support 4 joypads and i decided to use RAWINPUT for that.

but im kinda lost. i find a lot of information and examples, but none of them feature more than 1 joypad. so here are the things im stuck with and i really hope someone can help me out.

1.) on my pc, GetRawInputDeviceList reports 4 mice, 3 keyboards and 3 joypads. last time i checked, i had 1 mouse, 1 keyboard and 2 joypads. how do i filter out the "real" ones? i need to decide in advance, who is going to be player 1, player 2 etc. but how?

2.) the handles returned from WM_INPUT + GetRawInputData + RAWINPUT\header\hDevice dont match any handles returned from GetRawInputDeviceList + RAWINPUTDEVICELIST\hDevice. how do i identify a device, other than using the device name returned from GetRawInputDeviceInfo?

3) how do i find out the min/max values of an axis? i played around with HidP_GetValueCaps + HIDP_VALUE_CAPS\LogicalMin & Max and HIDP_VALUE_CAPS\PhysicalMin & Max, but they didnt return the values i was expecting. on my xbox controller, HIDP_VALUE_CAPS\LogicalMax returns 255 for the left and right triggers (LT/RT), which is correct. HIDP_VALUE_CAPS\PhysicalMax returns -1 however. for the left stick (LX/LY), i get -1 for both, logical and physical. the correct value should be 65535. its easy to transform -1 to 255 or 65535, but i doubt this will work for all joypads. iirc, the logitech rumblepad uses a range from 0-255 for ALL axis. so how do i get the correct value, for every joypad?

Advertisement
User reports that he found the problem. Thread locked.

-- Tom Sloper -- sloperama.com

I see someone downvoted me for locking the thread. The user reported that he wanted the topic deleted.
I didn't delete it, and I didn't want him to delete it, so I merely locked it to protect it. I don't
think I deserve a negative vote for doing that.

Edit: thanks to someone for reversing the negative vote. I don't deserve any more upvotes henceforth.

-- Tom Sloper -- sloperama.com

This topic is closed to new replies.

Advertisement