PDA

View Full Version : XInput interface for Delphi



AthenaOfDelphi
19-12-2014, 09:46 PM
Hi all,

I've just released my XInput interface for Delphi. Supports game pads only (limitation of the library). You can have the full complement of 4 pads connected, provides both eventing and polling style of use (or of course a combination of both). It's tested for Win32 and Win64 compilation using XInput1_3.dll. I've been unable to test using XInput1_4.dll as I don't have access to a Windows 8 platform. The only other thing that I've not been able to test is the battery monitoring capabilities for wireless controllers as I don't have one.

If you find issues etc. please report them through GitHub's issue tracker.

My library is available at:- http://smwl.uk/aoddl

azrael11
20-12-2014, 03:10 PM
Athena this is great...

Tell me in which version's of delphi work and if work in lazarus/freepascal...?
Is it possible to work in delphi 7?
This library covers all the bluetooth devices... like xbox 360 controller or wiimote?

Thank you and great work...
P.S.. Give us some progress about the engine the team makes...

Thank you

AthenaOfDelphi
20-12-2014, 08:21 PM
Hi,

If the controller works with XInput, then I see no reason why they would not appear in the controller list. But, I only have a couple of XBox 360 wired pads for testing. Hence I only have constants etc. for the XBox 360 pads (as defined in the Microsoft XInput.h).

Will it work with Delphi 7? It doesn't do anything fancy so it should work just fine. You will have to change the WinAPI.Windows and System.Types in the uses clause to Windows and Types respectively, but other than that it should work just dandy.

Give it a whirl and let me know how you get on.

jano152
28-04-2017, 05:01 PM
Hello, at first I wanted to ask for help because I was having trouble getting the XInput library (unitXInput.pas) working with Delphi 2009, but when I looked in it the solution was really simple. So I'm sharing it if anyone would need it in the future.

All you had to do is change uses:
WinAPI.Windows -> Windows
System.Types -> Types

And add a new const:
GUID_NULL: TGUID = '{00000000-0000-0000-0000-000000000000}';

Also the example project "XInputTestbed" has too many errors so the best way is to create your own test application from scratch.

It's nothing groundbraking but maybe someone will find it useful.

And thanks for the library, it's working great! :)

de_jean_7777
28-04-2017, 07:48 PM
Awesome. This will be hugely helpful when I get around to implementing gamepad input :D Started it, but kinda stopped to do other things and left it in my pile of unfinished code.

Chebmaster
30-04-2017, 09:06 AM
>XInput1_4.dll
Oh, I didn't know 1.4 existed. Thank you for reminding me.
My engine transparently supports 1.3 and 9.1.0
I guess I'd have to buy a Xbox 360 controller headset to test it in full. Sigh.

jano152
09-06-2017, 05:18 PM
Now I have another problem and this time I can't find a solution. My application (using your xipnut library) is working alright under Windows 7 but when I run it under Windows 10, the xinput is not available (xinputAvailable=false) so I can't detect anything. I've tried compatibility modes and I've tried different xinput dll versions. Nothing works. Anyone knows where could be the problem? Or any ideas that I could test?

Thank you.

jano152
10-06-2017, 06:39 AM
So I've traced the problem to this line:
@fXIGetDSoundAudioDeviceGUIDS:=getProcAddress(fXIn putHandle,'XInputGetDSoundAudioDeviceGuids');
The problem is that this will return nil and therefore the procedure TXInputInterface.initialise will return false. So I've removed all references to fXIGetDSoundAudioDeviceGuids in the unit and now it's working fine for buttons press detection.

AthenaOfDelphi
10-06-2017, 08:09 AM
Can I make a suggestion??? Go to the Github page for my library and create an issue recording what you've found out. I'm already looking at fixing it, but as usual Microsoft seem to have complicated things when it comes to figuring out which version of the OS you are running on.

jano152
10-06-2017, 08:52 AM
Issue created :)