XInput
Moderator: Moderators
XInput
For people that also want / need to support XInput* gamepads. Attached is a small wrapper & demo .. the left & right rumble motors are tied to the left & right analog triggers ( for demonstration purposes ).
*XInput only supports XInput compatible devices, while the build-in joystick functions don't support XInput-only devices.
K
- Attachments
-
- XInput.zgeproj
- (56.32 KiB) Downloaded 695 times
Re: XInput
Nice. Does it detect digital pad and shoulders buttons too? Those were not working before.
I'll try that this afternoon
I'll try that this afternoon
Re: XInput
Hi Ats,
K
I haven't tested it with every XInput compatible controller in existence .. but no problems ( for me ) so far
You have a controller that works with the built-in joystick functions except for the D-Pad and shoulder buttons? That's pretty strange.
K
Re: XInput
Time flies by so quickly... But I'm finally playing with your XInput example
And I have two questions:
I tried making an apk out of the example, but it crashes right from the start. Is it because the Android gamepad isn't an XInput? I'd like to detect if the gamepad is an XInput or not, so it could redirect to the basic gamepad detection.
As it is the first time I see the rumble working, I have a noob question: are the two rumbles you activate using the trigger buttons supposed to be left and right? Or a different kind of rumbling? Because mine is doing a slow "wom wom wom" for left, and a quick "bzzzzzzz" for right. Is it normal or is it because my gamepad felt a few times since I bought it ten years ago?
And I have two questions:
I tried making an apk out of the example, but it crashes right from the start. Is it because the Android gamepad isn't an XInput? I'd like to detect if the gamepad is an XInput or not, so it could redirect to the basic gamepad detection.
As it is the first time I see the rumble working, I have a noob question: are the two rumbles you activate using the trigger buttons supposed to be left and right? Or a different kind of rumbling? Because mine is doing a slow "wom wom wom" for left, and a quick "bzzzzzzz" for right. Is it normal or is it because my gamepad felt a few times since I bought it ten years ago?
Re: XInput
Hi Ats,
That's normal, the left motor has a much bigger weight attached than the right motor. Just like most speakers have a "woofer" and a "tweeter".
K
XInput is Windows only ( it's part of DirectX ) .. although unofficial drivers exist for Linux and Mac.
Correct, left trigger controls the left motor & right trigger controls the right motor.
That's normal, the left motor has a much bigger weight attached than the right motor. Just like most speakers have a "woofer" and a "tweeter".
K
Re: XInput
Thanks for the explanations
On Linux, the vibration stops if the trigger is fully pressed. I fixed it by clamping to 0.99 instead of 1:
And in order to launch on Android without crash, I added that to BeforeInitExp. Not sure if it's the right thing to do, but it's working:
(and obviously, I don't rely on XInput functions if I'm on Android)
On Linux, the vibration stops if the trigger is fully pressed. I fixed it by clamping to 0.99 instead of 1:
Code: Select all
int XInputSetVibration(int gamepad, float left, float right)
{
int l, r, v;
l = clamp( left, 0, 0.99)*65535;
r = clamp(right, 0, 0.99)*65535;
v = l+(r<<16);
XInputSetState(gamepad, v);
}
Code: Select all
if(ANDROID)
{
this.ModuleName = "";
}
else
{
this.ModuleName = "XInput9_1_0";
}
Re: XInput
Years later, some players could not launch the game on Linux and I couldn't find why.
After reinstalling Linux on my laptop, I discovered that it was not crashing for me because, at some point, I installed some weird XInput libraries for Linux. But with a fresh install, the game is crashing like everyone else.
Since I don't know how to detect if the library is installed or not, I simply deactivated the XInput on Linux.
By the way, do you know something about XInput9_1_0 and XInput1_3?
DirectX seems to have XInput1_3 nowadays: https://www.microsoft.com/fr-fr/downloa ... aspx?id=35
(which is a weird version number, compared to XInput9_1_0)
Edit:
Never mind, XInput1_3 is for Windows Server 2008; Windows XP Service Pack 3; Windows Server 2003 Service Pack 1; Windows Server 2003 Service Pack 2; Windows 7; Windows XP Service Pack 2; Windows Vista
So it is older.
After reinstalling Linux on my laptop, I discovered that it was not crashing for me because, at some point, I installed some weird XInput libraries for Linux. But with a fresh install, the game is crashing like everyone else.
Since I don't know how to detect if the library is installed or not, I simply deactivated the XInput on Linux.
By the way, do you know something about XInput9_1_0 and XInput1_3?
DirectX seems to have XInput1_3 nowadays: https://www.microsoft.com/fr-fr/downloa ... aspx?id=35
(which is a weird version number, compared to XInput9_1_0)
Edit:
Never mind, XInput1_3 is for Windows Server 2008; Windows XP Service Pack 3; Windows Server 2003 Service Pack 1; Windows Server 2003 Service Pack 2; Windows 7; Windows XP Service Pack 2; Windows Vista
So it is older.
Re: XInput
Hi Ats,
K
Right, calling external functions of which the DLL isn't present will crash your executable. I guess Ville could add a property on ZExternalLibrary that represents if the DLL has been found or not, but that's typically a situation you want to avoid anyway.
You can read more about the different versions of XInput here. And as far as i know XInput 9.1.0 was named / numbered that because it first shipped with DirectX 9. They dropped the DirectX version prefix with subsequent releases, so 9.1.0 is actually version 1.0.
K