Jump to content
  • Advertisement
Sign in to follow this  
WTOrf

DInput & XInput woes - Gamecontrollers not enumerating with FF

This topic is 3665 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, This issue has had me stumped for about a month now, so I'm hoping someone can help. Here goes. I wrote a C++ lib which handles input. It uses XInput for Gamepads which support the MS Common Controller interface and DirectInput8 for legacy support of older Gamepads. The code has always worked fine as a statically linked lib, linking it to C++ games. Forcefeedback works as does everything else. When compiled as a DLL, everything works fine EXCEPT force feedback, regardless of whether the code is going through the DirectInput codepath (Logitech Rumblepad2), or the XInput codepath (XBox360 controller.) I have a test app in C# which DLLImport's my dll, and a test app in C++ which uses LoadLibrary/GetProcAddress... They both has the same issue, so I'm pretty sure it's DLL specific. ---- My understanding of DirectInput is that you need an HINSTANCE and an HWND. I'm giving it the App's HWND, and the DLL's HINSTANCE passed from DLLMain's DLL_PROCESS_ATTACH (as noted to doso in http://msdn.microsoft.com/en-us/library/bb219686(VS.85).aspx ) So long as I call SetCooperativeLevel(m_hWnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE), I'd assume FF should work if the window has focus. My understanding of XInput is that you don't need to specify an HINSTANCE or HWND at all. You just call XInputSetState and it does its thing, maybe sprinkle a XInputEnable(true) in where necessary. So both APIs I'm using are exhibiting the same issue in the end. They get axis and button info just fine, and also handle window focus properly (no data if not foreground window), but simply won't do forcefeedback at all. Has anyone else run into this kind of thing while writing an input DLL? Any suggesions? I'm stumped.

Share this post


Link to post
Share on other sites
Advertisement
Quote:

It was my understanding that XInput only worked for the Xbox 360 controller.


Yes and no.

XInput is an API to the Microsoft Common Controller Driver, so any controller which uses that will enumerate as an XInput device. There are other controllers out there, such as the Logitech ChillStream which work with XInput (http://www.logitech.com/index.cfm/gaming/pc_gaming/gamepads/devices/292&cl=us,en) because it's a MS Common Controller (MSCC) device.

These MSCC controllers also have a DirectInput fallback. They can be enumerated and used with the DirectInput API but Forcefeedback will not be available. This is why I noted the actual controllers I was using with my code, and made sure to note that they were using the appropriate code path.

My code has an internal CDXGamepad and CXInputGamepad implementation and collapses that into a single CGamepad object such that the game using the library doesn't care what the end user has, because generally speaking users just want what they have to work.

Still stumped.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!