aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorendolf <[email protected]>2009-03-28 16:36:03 +0000
committerendolf <[email protected]>2009-03-28 16:36:03 +0000
commitbac3720d546ff5890bab19484583e7e409c6df83 (patch)
treeeefd2d8078df7a14df1d8926c81cd5919cbb0fa6 /plugins
parenta7c1b60a880ea1ff1480f16452e87044e30e98ae (diff)
Check the arch type before loading the native library
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@222 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'plugins')
-rw-r--r--plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java30
-rw-r--r--plugins/windows/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java6
-rw-r--r--plugins/windows/src/java/net/java/games/input/RawInputEnvironmentPlugin.java6
3 files changed, 25 insertions, 17 deletions
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 37fc7d9..309ccab 100644
--- a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java
+++ b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java
@@ -59,10 +59,16 @@ public final class LinuxEnvironmentPlugin extends ControllerEnvironment implemen
new PrivilegedAction() {
public final Object run() {
String lib_path = System.getProperty("net.java.games.input.librarypath");
- if (lib_path != null)
- System.load(lib_path + File.separator + System.mapLibraryName(lib_name));
- else
- System.loadLibrary(lib_name);
+ try {
+ if (lib_path != null)
+ System.load(lib_path + File.separator + System.mapLibraryName(lib_name));
+ else
+ System.loadLibrary(lib_name);
+ } catch (UnsatisfiedLinkError e) {
+ logln("Failed to load library: " + e.getMessage());
+ e.printStackTrace();
+ supported = false;
+ }
return null;
}
});
@@ -88,17 +94,11 @@ public final class LinuxEnvironmentPlugin extends ControllerEnvironment implemen
static {
String osName = getPrivilegedProperty("os.name", "").trim();
if(osName.equals("Linux")) {
- try {
- if("i386".equals(getPrivilegedProperty("os.arch"))) {
- loadLibrary(LIBNAME);
- } else {
- loadLibrary(LIBNAME + POSTFIX64BIT);
- }
- supported = true;
- } catch (UnsatisfiedLinkError e) {
- logln("Failed to load library: " + e.getMessage());
- e.printStackTrace();
- supported = false;
+ supported = true;
+ if("i386".equals(getPrivilegedProperty("os.arch"))) {
+ loadLibrary(LIBNAME);
+ } else {
+ loadLibrary(LIBNAME + POSTFIX64BIT);
}
}
}
diff --git a/plugins/windows/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java b/plugins/windows/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java
index 4e5e742..c995876 100644
--- a/plugins/windows/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java
+++ b/plugins/windows/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java
@@ -103,7 +103,11 @@ public final class DirectInputEnvironmentPlugin extends ControllerEnvironment im
String osName = getPrivilegedProperty("os.name", "").trim();
if(osName.startsWith("Windows")) {
supported = true;
- loadLibrary("jinput-dx8");
+ if("x86".equals(getPrivilegedProperty("os.arch"))) {
+ loadLibrary("jinput-dx8");
+ } else {
+ loadLibrary("jinput-dx8-64");
+ }
}
}
diff --git a/plugins/windows/src/java/net/java/games/input/RawInputEnvironmentPlugin.java b/plugins/windows/src/java/net/java/games/input/RawInputEnvironmentPlugin.java
index fe76215..80e7a79 100644
--- a/plugins/windows/src/java/net/java/games/input/RawInputEnvironmentPlugin.java
+++ b/plugins/windows/src/java/net/java/games/input/RawInputEnvironmentPlugin.java
@@ -103,7 +103,11 @@ public final class RawInputEnvironmentPlugin extends ControllerEnvironment imple
String osName = getPrivilegedProperty("os.name", "").trim();
if(osName.startsWith("Windows")) {
supported = true;
- loadLibrary("jinput-raw");
+ if("x86".equals(getPrivilegedProperty("os.arch"))) {
+ loadLibrary("jinput-raw");
+ } else {
+ loadLibrary("jinput-raw-64");
+ }
}
}