first stab at one-shot devil initialization on mac
This commit is contained in:
parent
97f919869e
commit
3dc9e4e4cf
|
@ -596,6 +596,16 @@ public class IL {
|
||||||
try {
|
try {
|
||||||
IL.initNativeStubs();
|
IL.initNativeStubs();
|
||||||
IL.ilInit();
|
IL.ilInit();
|
||||||
|
|
||||||
|
// We need to initialize everything in one fell swoop on mac
|
||||||
|
if(System.getProperty("os.name").startsWith("Mac")) {
|
||||||
|
ILU.initNativeStubs();
|
||||||
|
ILU.setCreated(true);
|
||||||
|
|
||||||
|
ILUT.initNativeStubs();
|
||||||
|
ILUT.setCreated(true);
|
||||||
|
}
|
||||||
|
|
||||||
created = true;
|
created = true;
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
destroy();
|
destroy();
|
||||||
|
@ -608,6 +618,18 @@ public class IL {
|
||||||
*/
|
*/
|
||||||
public static void destroy() {
|
public static void destroy() {
|
||||||
resetNativeStubs(IL.class);
|
resetNativeStubs(IL.class);
|
||||||
|
|
||||||
|
// We need to destroy everything on mac in one go
|
||||||
|
if(System.getProperty("os.name").startsWith("Mac")) {
|
||||||
|
ILU.resetNativeStubs(ILU.class);
|
||||||
|
ILU.nDestroy();
|
||||||
|
ILU.setCreated(false);
|
||||||
|
|
||||||
|
ILUT.resetNativeStubs(ILUT.class);
|
||||||
|
ILUT.nDestroy();
|
||||||
|
ILUT.setCreated(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (created) {
|
if (created) {
|
||||||
nDestroy();
|
nDestroy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,6 +170,11 @@ public class ILU {
|
||||||
throw new LWJGLException("Cannot create ILU without having created IL instance");
|
throw new LWJGLException("Cannot create ILU without having created IL instance");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to do nothing when running on mac, since all is loaded in IL
|
||||||
|
if(System.getProperty("os.name").startsWith("Mac")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String[] iluPaths = LWJGLUtil.getLibraryPaths(new String[]{
|
String[] iluPaths = LWJGLUtil.getLibraryPaths(new String[]{
|
||||||
"ILU", "ILU.dll",
|
"ILU", "ILU.dll",
|
||||||
"ILU", "libILU.so",
|
"ILU", "libILU.so",
|
||||||
|
@ -187,14 +192,20 @@ public class ILU {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static native void initNativeStubs() throws LWJGLException;
|
static native void initNativeStubs() throws LWJGLException;
|
||||||
|
|
||||||
private static native void resetNativeStubs(Class clazz);
|
static native void resetNativeStubs(Class clazz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit cleanly by calling destroy.
|
* Exit cleanly by calling destroy.
|
||||||
*/
|
*/
|
||||||
public static void destroy() {
|
public static void destroy() {
|
||||||
|
|
||||||
|
// We need to do nothing when running on mac, since all is destroyed in IL
|
||||||
|
if(System.getProperty("os.name").startsWith("Mac")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
resetNativeStubs(ILU.class);
|
resetNativeStubs(ILU.class);
|
||||||
if (created) {
|
if (created) {
|
||||||
nDestroy();
|
nDestroy();
|
||||||
|
@ -212,5 +223,14 @@ public class ILU {
|
||||||
/**
|
/**
|
||||||
* Native method the destroy the ILU
|
* Native method the destroy the ILU
|
||||||
*/
|
*/
|
||||||
protected static native void nDestroy();
|
static native void nDestroy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forcefully set created. Used internally by mac platform since
|
||||||
|
* it loads ilu/ilut in IL and needs to mark them as created
|
||||||
|
* @param created value to set created to
|
||||||
|
*/
|
||||||
|
static void setCreated(boolean created) {
|
||||||
|
ILU.created = created;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,11 @@ public class ILUT {
|
||||||
throw new LWJGLException("Cannot create ILUT without having created IL instance");
|
throw new LWJGLException("Cannot create ILUT without having created IL instance");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to do nothing when running on mac, since all is loaded in IL
|
||||||
|
if(System.getProperty("os.name").startsWith("Mac")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String[] ilutPaths = LWJGLUtil.getLibraryPaths(new String[]{
|
String[] ilutPaths = LWJGLUtil.getLibraryPaths(new String[]{
|
||||||
"ILUT", "ILUT.dll",
|
"ILUT", "ILUT.dll",
|
||||||
"ILUT", "libILUT.so",
|
"ILUT", "libILUT.so",
|
||||||
|
@ -151,14 +156,20 @@ public class ILUT {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static native void initNativeStubs() throws LWJGLException;
|
static native void initNativeStubs() throws LWJGLException;
|
||||||
|
|
||||||
private static native void resetNativeStubs(Class clazz);
|
static native void resetNativeStubs(Class clazz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit cleanly by calling destroy.
|
* Exit cleanly by calling destroy.
|
||||||
*/
|
*/
|
||||||
public static void destroy() {
|
public static void destroy() {
|
||||||
|
|
||||||
|
// We need to do nothing when running on mac, since all is destroyed in IL
|
||||||
|
if(System.getProperty("os.name").startsWith("Mac")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
resetNativeStubs(ILUT.class);
|
resetNativeStubs(ILUT.class);
|
||||||
if (created) {
|
if (created) {
|
||||||
nDestroy();
|
nDestroy();
|
||||||
|
@ -177,4 +188,13 @@ public class ILUT {
|
||||||
* Native method the destroy the ILUT
|
* Native method the destroy the ILUT
|
||||||
*/
|
*/
|
||||||
protected static native void nDestroy();
|
protected static native void nDestroy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forcefully set created. Used internally by mac platform since
|
||||||
|
* it loads ilu/ilut in IL and needs to mark them as created
|
||||||
|
* @param created value to set created to
|
||||||
|
*/
|
||||||
|
static void setCreated(boolean created) {
|
||||||
|
ILUT.created = created;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue