mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-05 14:35:58 +00:00
Linux: added support for 64 bit JVMs
This commit is contained in:
parent
8efeea4d53
commit
e2bbb739aa
8 changed files with 49 additions and 14 deletions
|
|
@ -46,6 +46,10 @@ abstract class DefaultSysImplementation implements SysImplementation {
|
|||
return 1000;
|
||||
}
|
||||
|
||||
public boolean has64Bit() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract long getTime();
|
||||
public abstract void alert(String title, String message);
|
||||
public abstract String getClipboard();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class LWJGLUtil {
|
|||
public static final int PLATFORM_WINDOWS = 3;
|
||||
public static final String PLATFORM_LINUX_NAME = "linux";
|
||||
public static final String PLATFORM_MACOSX_NAME = "macosx";
|
||||
public static final String PLATFORM_WINDOWS_NAME = "win32";
|
||||
public static final String PLATFORM_WINDOWS_NAME = "windows";
|
||||
|
||||
/** LWJGL Logo - 16 by 16 pixels */
|
||||
public static final ByteBuffer LWJGLIcon16x16 = BufferUtils.createByteBuffer(16 * 16 * 4).put(new byte[] {
|
||||
|
|
|
|||
|
|
@ -71,4 +71,8 @@ class LinuxSysImplementation extends J2SESysImplementation {
|
|||
// Seems to have failed
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean has64Bit() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,8 +58,10 @@ public final class Sys {
|
|||
|
||||
/** The implementation instance to delegate platform specific behavior to */
|
||||
private final static SysImplementation implementation;
|
||||
|
||||
private final static String POSTFIX64BIT = "64";
|
||||
|
||||
private static void loadLibrary(final String lib_name) {
|
||||
private static void doLoadLibrary(final String lib_name) {
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
String library_path = System.getProperty("org.lwjgl.librarypath");
|
||||
|
|
@ -72,6 +74,21 @@ public final class Sys {
|
|||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void loadLibrary(final String lib_name) {
|
||||
try {
|
||||
loadLibrary(lib_name);
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
if (implementation.has64Bit()) {
|
||||
try {
|
||||
loadLibrary(lib_name + POSTFIX64BIT);
|
||||
} catch (UnsatisfiedLinkError e2) {
|
||||
LWJGLUtil.log("Failed to load 64 bit library:" + e2.getMessage());
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
|
|||
|
|
@ -44,22 +44,28 @@ interface SysImplementation {
|
|||
/**
|
||||
* Return the version of the native library
|
||||
*/
|
||||
public String getNativeLibraryVersion();
|
||||
String getNativeLibraryVersion();
|
||||
|
||||
public void setDebug(boolean debug);
|
||||
void setDebug(boolean debug);
|
||||
|
||||
/**
|
||||
* Obtains the number of ticks that the hires timer does in a second.
|
||||
*
|
||||
* @return timer resolution in ticks per second or 0 if no timer is present.
|
||||
*/
|
||||
public long getTimerResolution();
|
||||
long getTimerResolution();
|
||||
|
||||
public long getTime();
|
||||
long getTime();
|
||||
|
||||
public void alert(String title, String message);
|
||||
void alert(String title, String message);
|
||||
|
||||
boolean openURL(String url);
|
||||
|
||||
public String getClipboard();
|
||||
String getClipboard();
|
||||
|
||||
/**
|
||||
* Returns true there exists a separate 64 bit library
|
||||
* on the platform
|
||||
*/
|
||||
boolean has64Bit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class LWJGLInstaller {
|
|||
* the user's temp directory, and instruct the LWJGL subsystem to load its
|
||||
* native files from there.
|
||||
* The file required by the installer, is gotten from the classloader via its
|
||||
* getResource command, and is expected to be named <win32 | linux | macosx>_natives.jar.
|
||||
* getResource command, and is expected to be named <windows | linux | macosx>_natives.jar.
|
||||
* Note: Due to the nature of native libraries, we cannot actually uninstall the currently
|
||||
* loaded files, but rather the "last" installed. This means that the most recent install of LWJGL
|
||||
* will always be present in the users temp dir. When invoking the tempInstall method, all old installations
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue