mirror of
https://github.com/shadowfacts/jinput-arm64.git
synced 2026-01-02 23:09:57 +01:00
Check the arch type before loading the native library
This commit is contained in:
parent
b789b8cd52
commit
c95cf4bddd
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue