Closed akoot closed 1 year ago
Good catch. The issue here is that the code I wrote was supposed to convert a float into a uint16 but it doesnt seem to work as intended. I will push a fix for it later this week.
Ok it took a little longer than I had hoped for due to little to no time in my private life but Ive come arround to create a temporary fix on the development branch. The actual issue is in the XInput Wrapper library since the values for the rumblers are mapped onto a signed Java short while the original value is an C++ uint16. Meaning you will only get 50% of the actual maximum intensity which the rumblers could potentially produce.
To use this temporary fix with maven you can include this into your pom:
<dependency>
<groupId>com.github.RalleYTN</groupId>
<artifactId>XInput-Plugin-for-JInput</artifactId>
<version>development-SNAPSHOT</version>
</dependency>
WARNING: Once I have fixed the actual issue all the vibrations you have currently in your project will double in intensity.
Fixed with latest commit.
Calling
rumbler.rumble(0.0F)
makes the controller rumble when it shouldn't. I wondered why it is and I noticed therumble()
method.https://github.com/RalleYTN/XInput-Plugin-for-JInput/blob/77ff80f01193b1e36ee2293e199490e00c347721/src/main/java/de/ralleytn/plugins/jinput/xinput/XIRumbler.java#L63 https://github.com/RalleYTN/XInput-Plugin-for-JInput/blob/77ff80f01193b1e36ee2293e199490e00c347721/src/main/java/de/ralleytn/plugins/jinput/xinput/XIRumbler.java#L67
I think the use of
Short.MIN_VALUE
is invalid. The motor speed was being set to some ridiculous values, simply removing the+ Short.MIN_VALUE
worked fine for me. I think you may want to useMath.max()
instead if you want values in a specific range.This current version is making an intensity of 0.0F result in -32768, an intensity of 1.0F result in 32767, and an intensity of 0.5F result in -1, when it should be between 0 and 65535.
I simply removed the
+ Short.MIN_VALUE
part for both and it worked fine.