25 June 2011, 09:58 | #1 |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
RawInput or DirectInput used?
Hi,
I'm using a suzo arcade joystick on my stelladapter and was wondering what input api is used for it. Going through the bootlog I found this: ---------------------------------------------------------- RawInput enumeration.. RAWINPUT: found 16 devices 00010045 keyboard: '\\?\HID#VID_AA55&PID_0101&MI_00#7&1e9aa709&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}' type=81 sub=0 mode=1 fkeys=12 indicators=3 tkeys=110 00010043 keyboard: '\\?\HID#VID_045E&PID_0750&MI_00#8&37c32952&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}' type=81 sub=0 mode=1 fkeys=12 indicators=3 tkeys=264 000B003B mouse: '\\?\HID#VID_046D&PID_C525&MI_00#7&3ae55b64&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}' id=256 buttons=16 hw=0 rate=0 'HID-muis [046D/C525]' ('\\?\HID#VID_046D&PID_C525&MI_00#7&3ae55b64&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}') 'HID-toetsenbordapparaat [AA55/0101]' ('\\?\HID#VID_AA55&PID_0101&MI_00#7&1e9aa709&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}') RAWINPUT test ok, usage=2 RAWINPUT test ok, usage=6 DirectInput enumeration.. Game controllers.. I=4114DEE0-F5A5-11DF-8007444553540000 P=BEEF04D8-0000-0000-0000504944564944 'Stelladaptor 2600-to-USB Interface' 'Stelladaptor 2600-to-USB Interface' 00010114 [Game controller] I=21B3BD90-4CA4-11E0-8001444553540000 P=30130E8F-0000-0000-0000504944564944 'USB GamePad' 'USB GamePad' 00010214 [Game controller] I=21B3BD90-4CA4-11E0-8002444553540000 P=30130E8F-0000-0000-0000504944564944 'USB GamePad' 'USB GamePad' 00010214 [Game controller] I=9749D2F0-6F41-11E0-8001444553540000 P=88026666-0000-0000-0000504944564944 'TigerGame PS/PS2 Game Controller Adapter' 'TigerGame PS/PS2 Game Controller Adapter' 00010214 [Game controller] I=2B1FE700-3F66-11E0-8002444553540000 P=0306057E-0000-0000-0000504944564944 'Nintendo RVL-CNT-01' 'Nintendo RVL-CNT-01' 0001021C [Game controller] Windowsmouse initialization.. Catweasel joymouse initialization.. wintab tablet initialization.. ----------------------------------------------------------------- Does this mean DirectInput API is used for this controller? If so, is there a way I can make it to use RawInput by default? (I'm on W7 64-bit). Thx for any answer! |
25 June 2011, 10:40 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
RawInput is only used for keyboards and mice because DirectInput or windows messages don't support multiple separate keyboards or mice.
DirectInput is perfectly fine for joysticks and it has working enumeration support (bit weird but it does work) RawInput does not appear to have any officially documented way to enumerate joysticks features. |
25 June 2011, 23:06 | #3 | |||
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Quote:
Quote:
With regards to the missing documentation, is it by any chance related to the issue mentioned in this blog? Quote:
On a sidenote, is there any way currently in WinUAE, that I could manually configure/map my joystick through the game ports or input panel such that it'll make use of RawInput? EDIT: I noticed that the date of the RAWInput documentation page on MSDN is May 11th, 2011 (here), so maybe it was updated also? |
|||
26 June 2011, 10:01 | #4 | ||||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
Quote:
Note that DirectInput does not internally use rawinput to read mouse but something else because mouse acceleration for example is different between rawinput and directinput -> Mouse vs joystick is not valid comparison. Quote:
Manual parsing of HID descriptors shouldn't be part of application. (and required testing to confirm it really works with all kinds of devices..) Keyboard and mouse rawinput is pre-parsed. You get simple button presses and relative mouse movements. Easy to use. Unfortunately there is no pre-parsed data available for other devices (including joysticks), you need to parse it manually (you only get low level HID descriptors as described in pdf you linked) This is the problem. No application should be required to do this. Quote:
Q: "What about simple support"? A: Using multiple APIs to read same device can have problems. Biggest problem is that there is no way to know if this DirectInput device is same as this RawInput device. Names can be different etc.. In worst case RawInput device name is "HID compliant <device type>" A2: Everyone starts asking/requesting to support this and that device. It does not work that way. Joystick rawinput support isn't programmer (or even user) friendly just yet. (unless some 3rd party has created some kind of RawInput/HID parser) |
||||
26 June 2011, 13:02 | #5 | ||
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
I'm also not sure of the differences, for me the proverbial proof of the pudding would be in the eating. That's basicly also why I wanted to try it out..
Quote:
Quote:
In my experience the way other applications do this, is also configure only a generic joystick/gamepad device, then seem to list all available joystick and gamepad HID devices according to their most basic HID classification, enumerating them simply as say JP1, JP2, JP3 (give that say 1 joystick and two gamepads are attached to the system) and having the user push buttons in a config screen to bind the directions and buttons. But I could be wrong here.. |
||
26 June 2011, 14:09 | #6 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
I don't care if "others" do it. I only care if there is some good enough example code or ready-made library. |
|
26 June 2011, 16:45 | #7 | |||
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Quote:
Quote:
Quote:
Don't know whether this is "good enough", don't kill me if it's not.. |
|||
26 June 2011, 17:10 | #8 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
I do know how to read joysticks using rawinput.
I don't want to know how to parse USB joystick data. It is just low level bit stream (joystick specific) that is explained in descriptors that also needs to be parsed first (as shown in pdf link) You don't know if this byte or that bit is button on/off value or joystick movement data etc without parsing descriptors. |
26 June 2011, 18:13 | #9 | |||
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Quote:
On the following page the specific problem you present seems to be explicitly addressed, including explanations and code example linked on the page: Using the Raw Input API to Process Joystick Input . (Hopefully this is a "good enough" example, otherwise I'll quietly go away.. ) Quote:
Quote:
|
|||
27 June 2011, 11:18 | #10 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Much better. But..
Names/labels are still a problem. Neither example says anything about names. How to get name of the device? ("USB joystick vendorid,productid" isn't what I would call a name..) How to get buttons', sticks', etc label? |
27 June 2011, 20:21 | #11 | |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Quote:
|
|
28 June 2011, 16:05 | #12 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Intel examples look too low level (uses IOCTL) but I found out how to enumerate and get name strings from HID devices. Everything appears to be in HID.DLL.
Still not sure if HID device features (buttons etc..) have names or if they are always generated by HID or manufacturer specific drivers.. EDIT: It seems DirectInput names are generated. (http://msdn.microsoft.com/en-us/wind...dware/gg487464) Last edited by Toni Wilen; 28 June 2011 at 18:03. |
28 June 2011, 22:37 | #13 | ||
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Quote:
Quote:
Are you currently looking at the possibility of using RawInput, or bypassing the Raw Input API and do all HID communication by using only the HID user library (as referred to in that blog, being the lowest level interface for game-input)? |
||
29 June 2011, 10:49 | #14 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Enumeration seems to work. Enumeration is currently done using rawinput API (because code was already there), properties are read using hid.dll (because it is more flexible and code wasn't there yet )
It will use DirectInput-like usage mapping but not 100% exactly (by design, not a bug) Haven't decided yet how to actually read HID reports. btw, there may be one "real" advantage in using "Direct HID Input": It should be possible to support HID devices that don't have Windows drivers (only detected as generic USB HID device), at least as long as data format is known. EDIT: Lowest level method (ReadFile() directly from device handle) does not appear to work very well, single call to get one HID report takes multiple milliseconds. Reason unknown. RawInput method appears works fine. Last edited by Toni Wilen; 29 June 2011 at 20:39. |
29 June 2011, 23:26 | #15 | ||||
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Quote:
Quote:
Quote:
Quote:
|
||||
30 June 2011, 13:01 | #16 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
AFAIK PS3 pad is buggy (from HID standard point of view), it can never work under Windows without device driver because to "enable" it (so that it actually does anything, strange gamepad feature..), it needs to receive HID USB report with invalid ID (ID that is not included in pad's USB descriptor)
Windows USB stack simply won't accept invalid report IDs. |
30 June 2011, 21:23 | #17 | |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Quote:
|
|
30 June 2011, 22:53 | #18 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
http://www.winuae.net/files/b/winuae.zip
Quick HID RawInput joystick support test version. DirectInput is disabled in this version. Tested using XBox360 pad, Competition Pro USB and PS2 and GameCube pads (using USB adapters). "Appears to work". Maybe. |
01 July 2011, 02:15 | #19 | |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Quote:
|
|
01 July 2011, 12:07 | #20 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
Everyone else can also comment and test this if interested. Just include name of game control device and say if it works (and if not, if it works in 2.3.2 in DirectInput mode). Note that you need to re-create your custom input configuration (if you have one) because RawInput device is not same device as "old" DirectInput device (even if names are exactly same). EDIT: this will be part of next beta but most likely in final version DirectInput is still the default, RawInput joystick requires command line parameter. Last edited by Toni Wilen; 01 July 2011 at 14:12. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
DirectInput/XInput/RawInput? | MethodGit | support.WinUAE | 1 | 13 June 2013 20:54 |
|
|