diff options
Diffstat (limited to 'plugins/linux')
12 files changed, 102 insertions, 492 deletions
diff --git a/plugins/linux/build.xml b/plugins/linux/build.xml index 8db02c0..a120a51 100644 --- a/plugins/linux/build.xml +++ b/plugins/linux/build.xml @@ -59,14 +59,12 @@ </target> <target depends="init,compile" name="createJNIHeaders"> - <javah> + <javah destdir="src/native"> <classpath> - <pathelement path="src/java"/> - <pathelement location="jinput.jar"/> + <pathelement location="../../coreAPI/bin/jinput.jar"/> + <pathelement location="bin/linux.jar"/> </classpath> - <class name="net.java.games.input.LinuxDevice"/> - <class name="net.java.games.input.LinuxEnvironmentPlugin"/> - <class name="net.java.games.input.LinuxKeyboard"/> + <class name="net.java.games.input.JInputLibrary"/> </javah> </target> diff --git a/plugins/linux/src/java/net/java/games/input/LinuxDevice.java b/plugins/linux/src/java/net/java/games/input/LinuxDevice.java index 228886e..a475643 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxDevice.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxDevice.java @@ -112,7 +112,7 @@ public class LinuxDevice extends AbstractController { this.nativeID = nativeID; - portType = LinuxNativeTypesMap.getPortType(getNativePortType(nativeID)); + portType = LinuxNativeTypesMap.getPortType(JInputLibrary.getNativePortType(nativeID)); for(int i=0;i<8;i++) { hatAxisIDs[i] = -1; @@ -493,7 +493,7 @@ public class LinuxDevice extends AbstractController { * @return false if the controller is no longer valid. */ public boolean poll() { - int retval = nativePoll(nativeID, buttonData, relAxesData, absAxesData); + int retval = JInputLibrary.poll(nativeID, buttonData, relAxesData, absAxesData); if(retval>=0) return true; return false; } @@ -532,7 +532,7 @@ public class LinuxDevice extends AbstractController { * @return The axis fuzz. */ public float getAbsAxisFuzz(int axisID) { - return (float) getNativeAbsAxisFuzz(nativeID, axisID); + return (float) JInputLibrary.getAbsAxisFuzz(nativeID, axisID); } /** @@ -541,7 +541,7 @@ public class LinuxDevice extends AbstractController { * @return The maximum value */ public float getAbsAxisMaximum(int axisID) { - return (float) getNativeAbsAxisMaximum(nativeID, axisID); + return (float) JInputLibrary.getAbsAxisMaximum(nativeID, axisID); } /** @@ -550,7 +550,7 @@ public class LinuxDevice extends AbstractController { * @return The minimum axis value */ public float getAbsAxisMinimum(int axisID) { - return (float) getNativeAbsAxisMinimum(nativeID, axisID); + return (float) JInputLibrary.getAbsAxisMinimum(nativeID, axisID); } /** Return the enumeration of supported button types for this device @@ -560,83 +560,30 @@ public class LinuxDevice extends AbstractController { if(supportedButtons.length==0) { return; } - getNativeSupportedButtons(nativeID, supportedButtons); + JInputLibrary.getSupportedButtons(nativeID, supportedButtons); } /** Return the enumeration of supported absolute axis types for this device * @param suportedAbsAxes The array to populate */ private void getSupportedAbsAxes(int suportedAbsAxes[]) { - getNativeSupportedAbsAxes(nativeID, suportedAbsAxes); + JInputLibrary.getSupportedAbsAxes(nativeID, suportedAbsAxes); } /** Return the enumeration of supported relative axis types for this device * @param supportedRelAxes The array to populate */ private void getSupportedRelAxes(int supportedRelAxes[]) { - getNativeSupportedRelAxes(nativeID, supportedRelAxes); + JInputLibrary.getSupportedRelAxes(nativeID, supportedRelAxes); } /** Returns the status of FF support for this device * */ private boolean getFFEnabled() { - return getNativeFFEnabled(nativeID); + return JInputLibrary.getFFEnabled(nativeID); } - /** Native call to get the supported absolute axes for a device - * @param deviceID The native device number - * @param supportedAbsAxes aray to populate - */ - private native void getNativeSupportedAbsAxes(int deviceID, int supportedAbsAxes[]); - /** Native call to get the supported relative axes for a device - * @param deviceID The native device ID - * @param supportedRelAxes the array to populate - */ - private native void getNativeSupportedRelAxes(int deviceID, int supportedRelAxes[]); - /** Native call to get the supported buttons for a device - * @param deviceID The native device ID - * @param supportedButtons The array to populate - */ - private native void getNativeSupportedButtons(int deviceID, int supportedButtons[]); - /** Call to poll the device at the native library - * @param deviceID The native device ID - * @param buttonData Array to populate with button values - * @param relAxesData Array to populate with relative axes values - * @param absAxesData Array to populate with absolute axes values - * @return the number of events read - */ - private native int nativePoll(int deviceID, int buttonData[], int relAxesData[], int absAxesData[]); - /** Returns the fuzz of an axis fro mthe native lib - * @param deviceID The native device id - * @param axisID The native axis ID - * @return The fuzz - */ - private native int getNativeAbsAxisFuzz(int deviceID, int axisID); - /** Gets the maximum value for an absloute axis fr omthe native library - * @param deviceID The native device ID - * @param axisID The native axis ID - * @return The Max value - */ - private native int getNativeAbsAxisMaximum(int deviceID, int axisID); - /** Gets the minimum value for an absloute axis from the native library - * @param deviceID The native device ID - * @param axisID The native axis number - * @return The min value - */ - private native int getNativeAbsAxisMinimum(int deviceID, int axisID); - /** Gets the port type from the native lib - * @param deviceID The device to get the port type for - * @return The port type - */ - private native int getNativePortType(int deviceID); - - /** Gets the status of FF support for this device - * @param deviceID The device to get the port type for - * @return The port type - */ - private native boolean getNativeFFEnabled(int deviceID); - /** * A device that represents a joystick coolie hat. * @author Jeremy Booth ([email protected]) 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 48d0502..4f28f1c 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java @@ -18,7 +18,7 @@ public class LinuxDeviceRumbler implements Rumbler { public void rumble(float intensity) { // TODO Auto-generated method stub - nativeRumble(deviceID, intensity); + JInputLibrary.rumble(deviceID, intensity); } public String getAxisName() { @@ -32,11 +32,7 @@ public class LinuxDeviceRumbler implements Rumbler { } private void cleanup() { - nativeCleanup(deviceID); + rumble(0f); } - private native void nativeRumble(int deviceID, float intensity); - - private native void nativeCleanup(int deviceID); - } diff --git a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java index fc19780..4dcb27f 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java @@ -32,37 +32,21 @@ import net.java.games.util.plugins.Plugin; */ public class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plugin { - static { - if(isSupported()) { - System.loadLibrary("jinput-linux"); - } - } - /** List of controllers */ private Controller[] controllers; /** Creates a new instance of LinuxEnvironmentPlugin */ public LinuxEnvironmentPlugin() { - if(isSupported()) { - LinuxNativeTypesMap.init(); - init(); + if(JInputLibrary.isSupported()) { + LinuxNativeTypesMap.init(); + JInputLibrary.init(); createControllers(); } else { controllers = new Controller[0]; } } - public static boolean isSupported() { - System.out.println("OS name is: " + System.getProperty("os.name")); - if(System.getProperty("os.name").indexOf("Linux")!=-1) { - System.out.println("Linux plugin is supported"); - return true; - } - System.out.println("Linux plugin is not supported"); - return false; - } - /** Returns a list of all controllers available to this environment, * or an empty array if there are no controllers in this environment. * @return Returns a list of all controllers available to this environment, @@ -75,7 +59,7 @@ public class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plu /** Create the controllers */ private void createControllers() { - int numDevices = getNumberOfDevices(); + int numDevices = JInputLibrary.getNumberOfDevices(); Controller[] tempControllers = new Controller[numDevices]; @@ -102,13 +86,15 @@ public class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plu * @param deviceNumber The device ID * @return The new device */ - private Controller createDevice(int deviceNumber) { - String name = getDeviceName(deviceNumber); - int numAbsAxes = getNumAbsAxes(deviceNumber); - int numRelAxes = getNumRelAxes(deviceNumber); - int numButtons = getNumButtons(deviceNumber); + private Controller createDevice(int deviceNumber) { + String name = JInputLibrary.getDeviceName(deviceNumber); + int numAbsAxes = JInputLibrary.getNumAbsAxes(deviceNumber); + int numRelAxes = JInputLibrary.getNumRelAxes(deviceNumber); + int numButtons = JInputLibrary.getNumButtons(deviceNumber); Controller device = null; + System.out.println("Java working on device " + name); + int mouseCharacteristic = 0; int keyboardCharacteristic = 0; int joystickCharacteristic = 0; @@ -153,33 +139,4 @@ public class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plu return device; } - /** Get the name of a device from the native library - * @param deviceID The device id - * @return The devices name - */ - private native String getDeviceName(int deviceID); - /** Get the number of absolute axes for the requested device - * @param deviceID The device ID - * @return The number of abs axes - */ - private native int getNumAbsAxes(int deviceID); - /** Get the nmber or relative axes from the native library - * @param deviceID The native device ID - * @return The number of raltive axes for the device - */ - private native int getNumRelAxes(int deviceID); - /** Gets the number of buttons for the requested devce from the native library - * @param deviceID The device ID - * @return The number of buttons - */ - private native int getNumButtons(int deviceID); - /** Initialises the native library - * @return <0 if something went wrong - */ - private native int init(); - /** Gets the number of devices the native library found - * @return Th number of devices - */ - private native int getNumberOfDevices(); - } diff --git a/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java b/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java index f6533bd..7c16343 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java @@ -115,7 +115,7 @@ public class LinuxKeyboard extends StandardKeyboard { * @return False if this device is invalid. */ public boolean poll() { - int retval = nativePoll(nativeID, keyData, dummyRelAxesData, dummyAbsAxesData); + int retval = JInputLibrary.poll(nativeID, keyData, dummyRelAxesData, dummyAbsAxesData); if(retval>=0) return true; return false; } @@ -169,25 +169,7 @@ public class LinuxKeyboard extends StandardKeyboard { * @param supportedButtons The array if key types to populate */ private void getSupportedButtons(int supportedButtons[]) { - getNativeSupportedButtons(nativeID, supportedButtons); + JInputLibrary.getSupportedButtons(nativeID, supportedButtons); } - /** Gets the supported key types for a particular native device - * @param deviceID The device ID - * @param supportedButtons The array to populate with teh supported key ids - */ - private native void getNativeSupportedButtons(int deviceID, int supportedButtons[]); - /** Calls the native library to poll the device - * @param deviceID The device ID - * @param buttonData Aray to populate with button values - * @param relAxesData Array to populate with relative axis values - * @param absAxesData Array to populate with absolute axes values - * @return <0 if soething went wrong - */ - private native int nativePoll(int deviceID, int buttonData[], int relAxesData[], int absAxesData[]); - /** Gets the port type from the native library for a particular keyboard - * @param deviceID The keybaord id - * @return native port ype - */ - private native int getNativePortType(int deviceID); } diff --git a/plugins/linux/src/native/EventDevice.cpp b/plugins/linux/src/native/EventDevice.cpp index a0b0888..d5cefbf 100644 --- a/plugins/linux/src/native/EventDevice.cpp +++ b/plugins/linux/src/native/EventDevice.cpp @@ -83,6 +83,7 @@ EventDevice::EventDevice(char *deviceFileName) { if (ioctl(fd, EVIOCSFF, &effect) == -1) { perror("Upload effect"); } + LOG_TRACE("Uploaded effect %d\n", effect.id); } else { diff --git a/plugins/linux/src/native/MixedDevice.cpp b/plugins/linux/src/native/MixedDevice.cpp index bb113ea..aff795e 100644 --- a/plugins/linux/src/native/MixedDevice.cpp +++ b/plugins/linux/src/native/MixedDevice.cpp @@ -123,6 +123,12 @@ void MixedDevice::rumble(float force) { } void MixedDevice::cleanup() { - joystickDevice->cleanup(); - eventDevice->cleanup(); + if(joystickDevice!=0 && eventDevice!=0) { + joystickDevice->cleanup(); + eventDevice->cleanup(); + free(joystickDevice); + free(eventDevice); + joystickDevice=0; + eventDevice=0; + } } diff --git a/plugins/linux/src/native/jinput.cpp b/plugins/linux/src/native/jinput.cpp index 2b8128f..4140616 100644 --- a/plugins/linux/src/native/jinput.cpp +++ b/plugins/linux/src/native/jinput.cpp @@ -29,10 +29,7 @@ #include <malloc.h> #include <string.h> -#include "net_java_games_input_LinuxDevice.h" -#include "net_java_games_input_LinuxEnvironmentPlugin.h" -#include "net_java_games_input_LinuxKeyboard.h" -#include "net_java_games_input_LinuxDeviceRumbler.h" +#include "net_java_games_input_JInputLibrary.h" #include "Device.h" #include "EventDevice.h" @@ -46,12 +43,12 @@ Device **jinputDeviceList; int jinputNumDevices; /* - * Class: net_java_games_input_LinuxEnvironmentPlugin - * Method: init + * Class: net_java_games_input_JInputLibrary + * Method: nativeInit * Signature: ()I */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_init - (JNIEnv *, jobject) { +JNIEXPORT jint JNICALL Java_net_java_games_input_JInputLibrary_nativeInit + (JNIEnv *, jclass) { LOG_TRACE("Initing event interface\n"); if(evInit()!=0) { @@ -124,13 +121,12 @@ JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_init } /* - * Class: net_java_games_input_LinuxEnvironmentPlugin + * Class: net_java_games_input_JInputLibrary * Method: getDeviceName * Signature: (I)Ljava/lang/String; */ - -JNIEXPORT jstring JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_getDeviceName - (JNIEnv *env, jobject, jint deviceID) { +JNIEXPORT jstring JNICALL Java_net_java_games_input_JInputLibrary_getDeviceName + (JNIEnv *env, jclass, jint deviceID) { LOG_TRACE("Gettign device name for jinput device %d.\n", deviceID); LOG_TRACE("jinput device %d is %d\n", deviceID, jinputDeviceList[deviceID]); @@ -139,59 +135,59 @@ JNIEXPORT jstring JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_getDe } /* - * Class: net_java_games_input_LinuxEnvironmentPlugin + * Class: net_java_games_input_JInputLibrary * Method: getNumAbsAxes * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_getNumAbsAxes - (JNIEnv *env, jobject, jint deviceID) { +JNIEXPORT jint JNICALL Java_net_java_games_input_JInputLibrary_getNumAbsAxes + (JNIEnv *env, jclass, jint deviceID) { LOG_TRACE("Gettign number of absolute axes for jinput device %d (%d)\n", deviceID, jinputDeviceList[deviceID]->getNumberAbsAxes()); return jinputDeviceList[deviceID]->getNumberAbsAxes(); } /* - * Class: net_java_games_input_LinuxEnvironmentPlugin + * Class: net_java_games_input_JInputLibrary * Method: getNumRelAxes * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_getNumRelAxes - (JNIEnv *env, jobject, jint deviceID) { +JNIEXPORT jint JNICALL Java_net_java_games_input_JInputLibrary_getNumRelAxes + (JNIEnv *env, jclass, jint deviceID) { LOG_TRACE("Gettign number of relative axes for jinput device %d (%d)\n", deviceID, jinputDeviceList[deviceID]->getNumberRelAxes()); return jinputDeviceList[deviceID]->getNumberRelAxes(); } /* - * Class: net_java_games_input_LinuxEnvironmentPlugin + * Class: net_java_games_input_JInputLibrary * Method: getNumButtons * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_getNumButtons - (JNIEnv *, jobject, jint deviceID) { +JNIEXPORT jint JNICALL Java_net_java_games_input_JInputLibrary_getNumButtons + (JNIEnv *, jclass, jint deviceID) { LOG_TRACE("Gettign number of buttons for jinput device %d (%d)\n", deviceID, jinputDeviceList[deviceID]->getNumberButtons()); return jinputDeviceList[deviceID]->getNumberButtons(); } /* - * Class: net_java_games_input_LinuxEnvironmentPlugin + * Class: net_java_games_input_JInputLibrary * Method: getNumberOfDevices * Signature: ()I */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_getNumberOfDevices - (JNIEnv *, jobject) { +JNIEXPORT jint JNICALL Java_net_java_games_input_JInputLibrary_getNumberOfDevices + (JNIEnv *, jclass) { return jinputNumDevices; } /* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeSupportedAbsAxes + * Class: net_java_games_input_JInputLibrary + * Method: getSupportedAbsAxes * Signature: (I[I)V */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDevice_getNativeSupportedAbsAxes - (JNIEnv *env, jobject, jint deviceID, jintArray axesData) { +JNIEXPORT void JNICALL Java_net_java_games_input_JInputLibrary_getSupportedAbsAxes + (JNIEnv *env, jclass, jint deviceID, jintArray axesData) { jint *axisReturns = env->GetIntArrayElements(axesData, 0); @@ -202,12 +198,12 @@ JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDevice_getNativeSupportedA } /* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeSupportedRelAxes + * Class: net_java_games_input_JInputLibrary + * Method: getSupportedRelAxes * Signature: (I[I)V */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDevice_getNativeSupportedRelAxes - (JNIEnv *env, jobject, jint deviceID, jintArray axesData) { +JNIEXPORT void JNICALL Java_net_java_games_input_JInputLibrary_getSupportedRelAxes + (JNIEnv *env, jclass, jint deviceID, jintArray axesData) { jint *axisReturns = env->GetIntArrayElements(axesData, 0); @@ -218,12 +214,12 @@ JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDevice_getNativeSupportedR } /* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeSupportedButtons + * Class: net_java_games_input_JInputLibrary + * Method: getSupportedButtons * Signature: (I[I)V */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDevice_getNativeSupportedButtons - (JNIEnv *env, jobject, jint deviceID, jintArray buttonData) { +JNIEXPORT void JNICALL Java_net_java_games_input_JInputLibrary_getSupportedButtons + (JNIEnv *env, jclass, jint deviceID, jintArray buttonData) { jint *buttonDataElements = env->GetIntArrayElements(buttonData, 0); @@ -234,12 +230,12 @@ JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDevice_getNativeSupportedB } /* - * Class: net_java_games_input_LinuxDevice - * Method: nativePoll + * Class: net_java_games_input_JInputLibrary + * Method: poll * Signature: (I[I[I[I)I */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_nativePoll - (JNIEnv *env, jobject, jint deviceID, jintArray buttons, jintArray relAxes, jintArray absAxes) { +JNIEXPORT jint JNICALL Java_net_java_games_input_JInputLibrary_poll + (JNIEnv *env, jclass, jint deviceID, jintArray buttons, jintArray relAxes, jintArray absAxes) { jint *buttonElements = env->GetIntArrayElements(buttons, 0); jint *relAxesElements = env->GetIntArrayElements(relAxes, 0); @@ -258,24 +254,24 @@ JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_nativePoll } /* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeAbsAxisFuzz + * Class: net_java_games_input_JInputLibrary + * Method: getAbsAxisFuzz * Signature: (II)I */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_getNativeAbsAxisFuzz - (JNIEnv *, jobject, jint deviceID, jint axisID) { +JNIEXPORT jint JNICALL Java_net_java_games_input_JInputLibrary_getAbsAxisFuzz + (JNIEnv *, jclass, jint deviceID, jint axisID) { LOG_TRACE("Getting fuzz data for axis %d on device %d\n", axisID, deviceID); return jinputDeviceList[deviceID]->getAbsAxisFuzz(axisID); } /* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeAbsAxisMaximum + * Class: net_java_games_input_JInputLibrary + * Method: getAbsAxisMaximum * Signature: (II)I */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_getNativeAbsAxisMaximum - (JNIEnv *, jobject, jint deviceID, jint axisID) { +JNIEXPORT jint JNICALL Java_net_java_games_input_JInputLibrary_getAbsAxisMaximum + (JNIEnv *, jclass, jint deviceID, jint axisID) { LOG_TRACE("Getting absolute axes maximum value data for axis %d on device %d\n", axisID, deviceID); return jinputDeviceList[deviceID]->getAbsAxisMaximum(axisID); @@ -283,91 +279,36 @@ JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_getNativeAbsAxisMax /* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeAbsAxisMinimum + * Class: net_java_games_input_JInputLibrary + * Method: getAbsAxisMinimum * Signature: (II)I */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_getNativeAbsAxisMinimum - (JNIEnv *, jobject, jint deviceID, jint axisID) { +JNIEXPORT jint JNICALL Java_net_java_games_input_JInputLibrary_getAbsAxisMinimum + (JNIEnv *, jclass, jint deviceID, jint axisID) { LOG_TRACE("Getting absolute axes minimum value data for axis %d on device %d\n", axisID, deviceID); return jinputDeviceList[deviceID]->getAbsAxisMinimum(axisID); } /* - * Class: net_java_games_input_LinuxDevice + * Class: net_java_games_input_JInputLibrary * Method: getNativePortType * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_getNativePortType - (JNIEnv *, jobject, jint deviceID) { +JNIEXPORT jint JNICALL Java_net_java_games_input_JInputLibrary_getNativePortType + (JNIEnv *, jclass, jint deviceID) { LOG_TRACE("Getting bus type for device %d\n", deviceID); return jinputDeviceList[deviceID]->getBusType(); } -/* Inaccessible static: NO_RUMBLERS */ -/* Inaccessible static: _00024assertionsDisabled */ -/* Inaccessible static: class_00024net_00024java_00024games_00024input_00024Keyboard */ -/* - * Class: net_java_games_input_LinuxKeyboard - * Method: getNativeSupportedButtons - * Signature: (I[I)V - */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxKeyboard_getNativeSupportedButtons - (JNIEnv *env, jobject, jint deviceID, jintArray buttons) { - - jint *buttonDataElements = env->GetIntArrayElements(buttons, 0); - - LOG_TRACE("Gettign number of buttons for jinput keyboard device %d\n", deviceID); - jinputDeviceList[deviceID]->getSupportedButtons(buttonDataElements); - - env->ReleaseIntArrayElements(buttons, buttonDataElements, 0); -} - -/* - * Class: net_java_games_input_LinuxKeyboard - * Method: nativePoll - * Signature: (I[I[I[I)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxKeyboard_nativePoll - (JNIEnv *env, jobject, jint deviceID, jintArray buttons, jintArray relAxes, jintArray absAxes) { - - jint *buttonElements = env->GetIntArrayElements(buttons, 0); - jint *relAxesElements = env->GetIntArrayElements(relAxes, 0); - jint *absAxesElements = env->GetIntArrayElements(absAxes, 0); - - LOG_POLL_TRACE("Polling jinput keyboard device %d\n", deviceID); - int retval = jinputDeviceList[deviceID]->poll(); - LOG_POLL_TRACE("Getting polled data for keyboard device %d\n", deviceID); - jinputDeviceList[deviceID]->getPolledData(relAxesElements, absAxesElements, buttonElements); - - env->ReleaseIntArrayElements(buttons, buttonElements, 0); - env->ReleaseIntArrayElements(relAxes, relAxesElements, 0); - env->ReleaseIntArrayElements(absAxes, absAxesElements, 0); - - return retval; -} - -/* - * Class: net_java_games_input_LinuxKeyboard - * Method: getNativePortType - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxKeyboard_getNativePortType - (JNIEnv *, jobject, jint deviceID) { - - LOG_TRACE("Getting bus type for keyboard device %d\n", deviceID); - return jinputDeviceList[deviceID]->getBusType(); -} - /* - * Class: net_java_games_input_LinuxDevice + * Class: net_java_games_input_JInputLibrary * Method: getFFEnabled * Signature: (I)Z */ -JNIEXPORT jboolean JNICALL Java_net_java_games_input_LinuxDevice_getNativeFFEnabled - (JNIEnv *, jobject, jint deviceID) { +JNIEXPORT jboolean JNICALL Java_net_java_games_input_JInputLibrary_getFFEnabled + (JNIEnv *, jclass, jint deviceID) { LOG_TRACE("Getting FFEnabled status for device %d\n", deviceID); if(jinputDeviceList[deviceID]->getFFEnabled()) { @@ -379,21 +320,25 @@ JNIEXPORT jboolean JNICALL Java_net_java_games_input_LinuxDevice_getNativeFFEnab } /* - * Class: net_java_games_input_LinuxRumblerDevice + * Class: net_java_games_input_JInputLibrary * Method: nativeRumble * Signature: (IF)V */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDeviceRumbler_nativeRumble - (JNIEnv *, jobject, jint deviceID, jfloat force) { +JNIEXPORT void JNICALL Java_net_java_games_input_JInputLibrary_nativeRumble + (JNIEnv *, jclass, jint deviceID, jfloat force) { jinputDeviceList[deviceID]->rumble(force); } /* - * Class: net_java_games_input_LinuxRumblerDevice + * Class: net_java_games_input_JInputLibrary * Method: nativeCleanup * Signature: (I)V */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDeviceRumbler_nativeCleanup - (JNIEnv *, jobject, jint deviceID) { - jinputDeviceList[deviceID]->cleanup(); +JNIEXPORT void JNICALL Java_net_java_games_input_JInputLibrary_nativeCleanup + (JNIEnv *, jclass, jint deviceID) { + if(jinputDeviceList[deviceID]!=0) { + jinputDeviceList[deviceID]->cleanup(); + free(jinputDeviceList); + jinputDeviceList[deviceID]=0; + } } diff --git a/plugins/linux/src/native/net_java_games_input_LinuxDevice.h b/plugins/linux/src/native/net_java_games_input_LinuxDevice.h deleted file mode 100644 index 13cba3e..0000000 --- a/plugins/linux/src/native/net_java_games_input_LinuxDevice.h +++ /dev/null @@ -1,88 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class net_java_games_input_LinuxDevice */ - -#ifndef _Included_net_java_games_input_LinuxDevice -#define _Included_net_java_games_input_LinuxDevice -#ifdef __cplusplus -extern "C" { -#endif -/* Inaccessible static: NO_AXES */ -/* Inaccessible static: NO_CONTROLLERS */ -/* Inaccessible static: NO_RUMBLERS */ -/* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeSupportedAbsAxes - * Signature: (I[I)V - */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDevice_getNativeSupportedAbsAxes - (JNIEnv *, jobject, jint, jintArray); - -/* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeSupportedRelAxes - * Signature: (I[I)V - */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDevice_getNativeSupportedRelAxes - (JNIEnv *, jobject, jint, jintArray); - -/* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeSupportedButtons - * Signature: (I[I)V - */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDevice_getNativeSupportedButtons - (JNIEnv *, jobject, jint, jintArray); - -/* - * Class: net_java_games_input_LinuxDevice - * Method: nativePoll - * Signature: (I[I[I[I)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_nativePoll - (JNIEnv *, jobject, jint, jintArray, jintArray, jintArray); - -/* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeAbsAxisFuzz - * Signature: (II)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_getNativeAbsAxisFuzz - (JNIEnv *, jobject, jint, jint); - -/* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeAbsAxisMaximum - * Signature: (II)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_getNativeAbsAxisMaximum - (JNIEnv *, jobject, jint, jint); - -/* - * Class: net_java_games_input_LinuxDevice - * Method: getNativeAbsAxisMinimum - * Signature: (II)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_getNativeAbsAxisMinimum - (JNIEnv *, jobject, jint, jint); - -/* - * Class: net_java_games_input_LinuxDevice - * Method: getNativePortType - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxDevice_getNativePortType - (JNIEnv *, jobject, jint); - -/* - * Class: net_java_games_input_LinuxDevice - * Method: getFFEnabled - * Signature: (I)Z - */ -JNIEXPORT jboolean JNICALL Java_net_java_games_input_LinuxDevice_getNativeFFEnabled - (JNIEnv *, jobject, jint); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/plugins/linux/src/native/net_java_games_input_LinuxDeviceRumbler.h b/plugins/linux/src/native/net_java_games_input_LinuxDeviceRumbler.h deleted file mode 100644 index 085f22d..0000000 --- a/plugins/linux/src/native/net_java_games_input_LinuxDeviceRumbler.h +++ /dev/null @@ -1,28 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class net_java_games_input_LinuxDeviceRumbler */ - -#ifndef _Included_net_java_games_input_LinuxDeviceRumbler -#define _Included_net_java_games_input_LinuxDeviceRumbler -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: net_java_games_input_LinuxDeviceRumbler - * Method: nativeRumble - * Signature: (IF)V - */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDeviceRumbler_nativeRumble - (JNIEnv *, jobject, jint, jfloat); - -/* - * Class: net_java_games_input_LinuxDeviceRumbler - * Method: nativeCleanup - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxDeviceRumbler_nativeCleanup - (JNIEnv *, jobject, jint); -#ifdef __cplusplus -} -#endif -#endif diff --git a/plugins/linux/src/native/net_java_games_input_LinuxEnvironmentPlugin.h b/plugins/linux/src/native/net_java_games_input_LinuxEnvironmentPlugin.h deleted file mode 100644 index 6e68a97..0000000 --- a/plugins/linux/src/native/net_java_games_input_LinuxEnvironmentPlugin.h +++ /dev/null @@ -1,64 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class net_java_games_input_LinuxEnvironmentPlugin */ - -#ifndef _Included_net_java_games_input_LinuxEnvironmentPlugin -#define _Included_net_java_games_input_LinuxEnvironmentPlugin -#ifdef __cplusplus -extern "C" { -#endif -/* Inaccessible static: _00024assertionsDisabled */ -/* Inaccessible static: defaultEnvironment */ -/* Inaccessible static: class_00024net_00024java_00024games_00024input_00024ControllerEnvironment */ -/* - * Class: net_java_games_input_LinuxEnvironmentPlugin - * Method: getDeviceName - * Signature: (I)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_getDeviceName - (JNIEnv *, jobject, jint); - -/* - * Class: net_java_games_input_LinuxEnvironmentPlugin - * Method: getNumAbsAxes - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_getNumAbsAxes - (JNIEnv *, jobject, jint); - -/* - * Class: net_java_games_input_LinuxEnvironmentPlugin - * Method: getNumRelAxes - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_getNumRelAxes - (JNIEnv *, jobject, jint); - -/* - * Class: net_java_games_input_LinuxEnvironmentPlugin - * Method: getNumButtons - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_getNumButtons - (JNIEnv *, jobject, jint); - -/* - * Class: net_java_games_input_LinuxEnvironmentPlugin - * Method: init - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_init - (JNIEnv *, jobject); - -/* - * Class: net_java_games_input_LinuxEnvironmentPlugin - * Method: getNumberOfDevices - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxEnvironmentPlugin_getNumberOfDevices - (JNIEnv *, jobject); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/plugins/linux/src/native/net_java_games_input_LinuxKeyboard.h b/plugins/linux/src/native/net_java_games_input_LinuxKeyboard.h deleted file mode 100644 index 041f416..0000000 --- a/plugins/linux/src/native/net_java_games_input_LinuxKeyboard.h +++ /dev/null @@ -1,42 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class net_java_games_input_LinuxKeyboard */ - -#ifndef _Included_net_java_games_input_LinuxKeyboard -#define _Included_net_java_games_input_LinuxKeyboard -#ifdef __cplusplus -extern "C" { -#endif -/* Inaccessible static: NO_AXES */ -/* Inaccessible static: NO_CONTROLLERS */ -/* Inaccessible static: NO_RUMBLERS */ -/* Inaccessible static: _00024assertionsDisabled */ -/* Inaccessible static: class_00024net_00024java_00024games_00024input_00024Keyboard */ -/* - * Class: net_java_games_input_LinuxKeyboard - * Method: getNativeSupportedButtons - * Signature: (I[I)V - */ -JNIEXPORT void JNICALL Java_net_java_games_input_LinuxKeyboard_getNativeSupportedButtons - (JNIEnv *, jobject, jint, jintArray); - -/* - * Class: net_java_games_input_LinuxKeyboard - * Method: nativePoll - * Signature: (I[I[I[I)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxKeyboard_nativePoll - (JNIEnv *, jobject, jint, jintArray, jintArray, jintArray); - -/* - * Class: net_java_games_input_LinuxKeyboard - * Method: getNativePortType - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_net_java_games_input_LinuxKeyboard_getNativePortType - (JNIEnv *, jobject, jint); - -#ifdef __cplusplus -} -#endif -#endif |