|
@@ -58,15 +58,20 @@ public class Natives {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected static void extractNativeLib(String sysName, String name) throws IOException {
|
|
protected static void extractNativeLib(String sysName, String name) throws IOException {
|
|
|
|
|
+ extractNativeLib(sysName, name, false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ protected static void extractNativeLib(String sysName, String name, boolean load) throws IOException {
|
|
|
String fullname = System.mapLibraryName(name);
|
|
String fullname = System.mapLibraryName(name);
|
|
|
|
|
|
|
|
String path = "native/" + sysName + "/" + fullname;
|
|
String path = "native/" + sysName + "/" + fullname;
|
|
|
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
|
|
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
|
|
|
//InputStream in = Natives.class.getResourceAsStream();
|
|
//InputStream in = Natives.class.getResourceAsStream();
|
|
|
if (in == null) {
|
|
if (in == null) {
|
|
|
- if(name!="bulletjme")
|
|
|
|
|
- logger.log(Level.WARNING, "Cannot locate native library: {0}/{1}",
|
|
|
|
|
- new String[]{sysName, fullname});
|
|
|
|
|
|
|
+ if (name != "bulletjme") {
|
|
|
|
|
+ logger.log(Level.WARNING, "Cannot locate native library: {0}/{1}",
|
|
|
|
|
+ new String[]{sysName, fullname});
|
|
|
|
|
+ }
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
File targetFile = new File(workingDir, fullname);
|
|
File targetFile = new File(workingDir, fullname);
|
|
@@ -80,12 +85,17 @@ public class Natives {
|
|
|
out.close();
|
|
out.close();
|
|
|
} catch (FileNotFoundException ex) {
|
|
} catch (FileNotFoundException ex) {
|
|
|
if (ex.getMessage().contains("used by another process")) {
|
|
if (ex.getMessage().contains("used by another process")) {
|
|
|
|
|
+ if (load) {
|
|
|
|
|
+ System.load(targetFile.getAbsolutePath());
|
|
|
|
|
+ }
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
throw ex;
|
|
throw ex;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ if (load) {
|
|
|
|
|
+ System.load(targetFile.getAbsolutePath());
|
|
|
|
|
+ }
|
|
|
logger.log(Level.FINE, "Copied {0} to {1}", new Object[]{fullname, targetFile});
|
|
logger.log(Level.FINE, "Copied {0} to {1}", new Object[]{fullname, targetFile});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -150,8 +160,8 @@ public class Natives {
|
|
|
extractNativeLib("windows", "jinput-dx8_64");
|
|
extractNativeLib("windows", "jinput-dx8_64");
|
|
|
extractNativeLib("windows", "jinput-raw_64");
|
|
extractNativeLib("windows", "jinput-raw_64");
|
|
|
}
|
|
}
|
|
|
- if(needNativeBullet){
|
|
|
|
|
- extractNativeLib("windows", "bulletjme");
|
|
|
|
|
|
|
+ if (needNativeBullet) {
|
|
|
|
|
+ extractNativeLib("windows", "bulletjme", true);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case Windows32:
|
|
case Windows32:
|
|
@@ -165,8 +175,8 @@ public class Natives {
|
|
|
extractNativeLib("windows", "jinput-dx8");
|
|
extractNativeLib("windows", "jinput-dx8");
|
|
|
extractNativeLib("windows", "jinput-raw");
|
|
extractNativeLib("windows", "jinput-raw");
|
|
|
}
|
|
}
|
|
|
- if(needNativeBullet){
|
|
|
|
|
- extractNativeLib("windows", "bulletjme");
|
|
|
|
|
|
|
+ if (needNativeBullet) {
|
|
|
|
|
+ extractNativeLib("windows", "bulletjme", true);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case Linux64:
|
|
case Linux64:
|
|
@@ -179,8 +189,8 @@ public class Natives {
|
|
|
if (needOAL) {
|
|
if (needOAL) {
|
|
|
extractNativeLib("linux", "openal64");
|
|
extractNativeLib("linux", "openal64");
|
|
|
}
|
|
}
|
|
|
- if(needNativeBullet){
|
|
|
|
|
- extractNativeLib("linux", "bulletjme");
|
|
|
|
|
|
|
+ if (needNativeBullet) {
|
|
|
|
|
+ extractNativeLib("linux", "bulletjme", true);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case Linux32:
|
|
case Linux32:
|
|
@@ -193,8 +203,8 @@ public class Natives {
|
|
|
if (needOAL) {
|
|
if (needOAL) {
|
|
|
extractNativeLib("linux", "openal");
|
|
extractNativeLib("linux", "openal");
|
|
|
}
|
|
}
|
|
|
- if(needNativeBullet){
|
|
|
|
|
- extractNativeLib("linux", "bulletjme32");
|
|
|
|
|
|
|
+ if (needNativeBullet) {
|
|
|
|
|
+ extractNativeLib("linux", "bulletjme", true);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case MacOSX_PPC32:
|
|
case MacOSX_PPC32:
|
|
@@ -209,8 +219,8 @@ public class Natives {
|
|
|
if (needJInput) {
|
|
if (needJInput) {
|
|
|
extractNativeLib("macosx", "jinput-osx");
|
|
extractNativeLib("macosx", "jinput-osx");
|
|
|
}
|
|
}
|
|
|
- if(needNativeBullet){
|
|
|
|
|
- extractNativeLib("macosx", "bulletjme");
|
|
|
|
|
|
|
+ if (needNativeBullet) {
|
|
|
|
|
+ extractNativeLib("macosx", "bulletjme", true);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|