aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/linux
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/linux')
-rw-r--r--plugins/linux/src/java/net/java/games/input/JInputLibrary.java5
-rw-r--r--plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java10
-rw-r--r--plugins/linux/src/native/jinput.cpp8
3 files changed, 10 insertions, 13 deletions
diff --git a/plugins/linux/src/java/net/java/games/input/JInputLibrary.java b/plugins/linux/src/java/net/java/games/input/JInputLibrary.java
index 57dbf07..5dbd217 100644
--- a/plugins/linux/src/java/net/java/games/input/JInputLibrary.java
+++ b/plugins/linux/src/java/net/java/games/input/JInputLibrary.java
@@ -12,7 +12,7 @@ public class JInputLibrary {
private static boolean shutdown = false;
private static Object shutdownThreadMonitor = new Object();
private static boolean cleanupDone = false;
- private static int rumbler;
+ private static int rumbler = -1;
private static float force;
public static boolean isSupported() {
@@ -102,6 +102,9 @@ public class JInputLibrary {
}
System.out.println("Environment cleanup");
for(int i=0;i<JInputLibrary.getNumberOfDevices();i++) {
+ if(JInputLibrary.getFFEnabled(i)) {
+ JInputLibrary.nativeRumble(i, 0f);
+ }
JInputLibrary.nativeCleanup(i);
}
}
diff --git a/plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java b/plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java
index 4f28f1c..df8dd84 100644
--- a/plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java
+++ b/plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java
@@ -8,12 +8,6 @@ public class LinuxDeviceRumbler implements Rumbler {
public LinuxDeviceRumbler(int deviceID) {
this.deviceID = deviceID;
-
- Runtime.getRuntime().addShutdownHook(new Thread() {
- public void run() {
- cleanup();
- }
- });
}
public void rumble(float intensity) {
@@ -31,8 +25,4 @@ public class LinuxDeviceRumbler implements Rumbler {
return null;
}
- private void cleanup() {
- rumble(0f);
- }
-
}
diff --git a/plugins/linux/src/native/jinput.cpp b/plugins/linux/src/native/jinput.cpp
index c6294a7..40f0d29 100644
--- a/plugins/linux/src/native/jinput.cpp
+++ b/plugins/linux/src/native/jinput.cpp
@@ -335,7 +335,10 @@ JNIEXPORT jboolean JNICALL Java_net_java_games_input_JInputLibrary_getFFEnabled
*/
JNIEXPORT void JNICALL Java_net_java_games_input_JInputLibrary_nativeRumble
(JNIEnv *, jclass, jint deviceID, jfloat force) {
- jinputDeviceList[deviceID]->rumble(force);
+ if(jinputDeviceList[deviceID]!=0) {
+ LOG_TRACE("Setting rumble on device %d to %d\n", deviceID, force);
+ jinputDeviceList[deviceID]->rumble(force);
+ }
}
/*
@@ -346,8 +349,9 @@ JNIEXPORT void JNICALL Java_net_java_games_input_JInputLibrary_nativeRumble
JNIEXPORT void JNICALL Java_net_java_games_input_JInputLibrary_nativeCleanup
(JNIEnv *, jclass, jint deviceID) {
if(jinputDeviceList[deviceID]!=0) {
+ LOG_TRACE("Cleaning up device %d\n", deviceID);
jinputDeviceList[deviceID]->cleanup();
- free(jinputDeviceList);
+ free(jinputDeviceList[deviceID]);
jinputDeviceList[deviceID]=0;
}
}