protected void loadNatives() { if (JmeSystem.isLowPermissions()) { return; } if ("LWJGL".equals(settings.getAudioRenderer())) { NativeLibraryLoader.loadNativeLibrary("openal-lwjgl3", true); } if (NativeLibraryLoader.isUsingNativeBullet()) { NativeLibraryLoader.loadNativeLibrary("bulletjme", true); } NativeLibraryLoader.loadNativeLibrary("glfw-lwjgl3", true); NativeLibraryLoader.loadNativeLibrary("jemalloc-lwjgl3", true); NativeLibraryLoader.loadNativeLibrary("lwjgl3", true); }
private static void setExtractionFolderToUserCache() { File extractFolderInHome = getJmeUserCacheFolder(); if (!extractFolderInHome.exists()) { extractFolderInHome.mkdir(); } extractionFolder = new File(extractFolderInHome, "natives_" + Integer.toHexString(computeNativesHash())); if (!extractionFolder.exists()) { extractionFolder.mkdir(); } logger.log(Level.WARNING, "Working directory is not writable. " + "Natives will be extracted to:\n{0}", extractionFolder); }
public static void main(String[] args) { if (args.length == 1) { if ("getjarexcludes".equals(args[0])) { File[] jarFiles = NativeLibraryLoader.getJarsWithNatives(); for (int i = 0; i < jarFiles.length; i++) { File jarFile = jarFiles[i]; try { if ("Windows32".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.Windows32, folder); } else if ("Windows64".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.Windows64, folder); } else if ("Linux32".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.Linux32, folder); } else if ("Linux64".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.Linux64, folder); } else if ("MacOSX32".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.MacOSX32, folder); } else if ("MacOSX64".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.MacOSX64, folder); } else { System.err.println("Please specify a platform, Windows32, Windows64, Linux32, Linux64, MacOSX32 or MacOSX64");
String unmappedName = unmapLibraryName(fileNameInJar); try { File extactionDirectory = getExtractionFolder(); URLConnection conn; InputStream in;
protected void loadNatives() { if (JmeSystem.isLowPermissions()) { return; } if ("LWJGL".equals(settings.getAudioRenderer())) { NativeLibraryLoader.loadNativeLibrary("openal", true); } if (settings.useJoysticks()) { NativeLibraryLoader.loadNativeLibrary("jinput", true); NativeLibraryLoader.loadNativeLibrary("jinput-dx8", true); } NativeLibraryLoader.loadNativeLibrary("lwjgl", true); } protected int getNumSamplesToUse() {
public static File[] getJarsWithNatives() { HashSet<File> jarFiles = new HashSet<File>(); for (Map.Entry<NativeLibrary.Key, NativeLibrary> lib : nativeLibraryMap.entrySet()) { File jarFile = getJarForNativeLibrary(lib.getValue().getPlatform(), lib.getValue().getName()); if (jarFile != null) { jarFiles.add(jarFile); } } return jarFiles.toArray(new File[0]); }
public static void extractNativeLibraries(Platform platform, File targetDir) throws IOException { for (Map.Entry<NativeLibrary.Key, NativeLibrary> lib : nativeLibraryMap.entrySet()) { if (lib.getValue().getPlatform() == platform) { if (!targetDir.exists()) { targetDir.mkdirs(); } extractNativeLibrary(platform, lib.getValue().getName(), targetDir); } } }
/** * Register a new known JNI library. * * This simply registers a known library, the actual extraction and loading * is performed by calling {@link #loadNativeLibrary(java.lang.String, boolean) }. * * This method should be called several times for each library name, * each time specifying a different platform + path combination. * * @param name The name / ID of the library (not OS or architecture specific). * @param platform The platform for which the in-natives-jar path has * been specified for. * @param path The path inside the natives-jar or classpath * corresponding to this library. Must be compatible with the platform * argument. */ public static void registerNativeLibrary(String name, Platform platform, String path) { registerNativeLibrary(name, platform, path, null); }
String unmappedName = unmapLibraryName(fileNameInJar); try { File extactionDirectory = getExtractionFolder(); URLConnection conn; InputStream in;
public static File[] getJarsWithNatives() { HashSet<File> jarFiles = new HashSet<File>(); for (Map.Entry<NativeLibrary.Key, NativeLibrary> lib : nativeLibraryMap.entrySet()) { File jarFile = getJarForNativeLibrary(lib.getValue().getPlatform(), lib.getValue().getName()); if (jarFile != null) { jarFiles.add(jarFile); } } return jarFiles.toArray(new File[0]); }
public static void extractNativeLibraries(Platform platform, File targetDir) throws IOException { for (Map.Entry<NativeLibrary.Key, NativeLibrary> lib : nativeLibraryMap.entrySet()) { if (lib.getValue().getPlatform() == platform) { if (!targetDir.exists()) { targetDir.mkdirs(); } extractNativeLibrary(platform, lib.getValue().getName(), targetDir); } } }
/** * Register a new known JNI library. * * This simply registers a known library, the actual extraction and loading * is performed by calling {@link #loadNativeLibrary(java.lang.String, boolean) }. * * This method should be called several times for each library name, * each time specifying a different platform + path combination. * * @param name The name / ID of the library (not OS or architecture specific). * @param platform The platform for which the in-natives-jar path has * been specified for. * @param path The path inside the natives-jar or classpath * corresponding to this library. Must be compatible with the platform * argument. */ public static void registerNativeLibrary(String name, Platform platform, String path) { registerNativeLibrary(name, platform, path, null); }
@Override public void initialize(AppSettings settings) { if (initialized) { return; } initialized = true; logger.log(Level.INFO, getBuildInfo()); if (!lowPermissions) { if (NativeLibraryLoader.isUsingNativeBullet()) { NativeLibraryLoader.loadNativeLibrary("bulletjme", true); } } }
private static void setExtractionFolderToUserCache() { File extractFolderInHome = getJmeUserCacheFolder(); if (!extractFolderInHome.exists()) { extractFolderInHome.mkdir(); } extractionFolder = new File(extractFolderInHome, "natives_" + Integer.toHexString(computeNativesHash())); if (!extractionFolder.exists()) { extractionFolder.mkdir(); } logger.log(Level.WARNING, "Working directory is not writable. " + "Natives will be extracted to:\n{0}", extractionFolder); }
public static void main(String[] args) { if (args.length == 1) { if ("getjarexcludes".equals(args[0])) { File[] jarFiles = NativeLibraryLoader.getJarsWithNatives(); for (int i = 0; i < jarFiles.length; i++) { File jarFile = jarFiles[i]; try { if ("Windows32".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.Windows32, folder); } else if ("Windows64".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.Windows64, folder); } else if ("Linux32".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.Linux32, folder); } else if ("Linux64".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.Linux64, folder); } else if ("MacOSX32".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.MacOSX32, folder); } else if ("MacOSX64".equals(args[0])) { NativeLibraryLoader.extractNativeLibraries(Platform.MacOSX64, folder); } else { System.err.println("Please specify a platform, Windows32, Windows64, Linux32, Linux64, MacOSX32 or MacOSX64");
protected void loadNatives() { if (JmeSystem.isLowPermissions()) { return; } if ("LWJGL".equals(settings.getAudioRenderer())) { NativeLibraryLoader.loadNativeLibrary("openal", true); } if (settings.useJoysticks()) { NativeLibraryLoader.loadNativeLibrary("jinput", true); NativeLibraryLoader.loadNativeLibrary("jinput-dx8", true); } if (NativeLibraryLoader.isUsingNativeBullet()) { NativeLibraryLoader.loadNativeLibrary("bulletjme", true); } NativeLibraryLoader.loadNativeLibrary("lwjgl", true); }