use OAL type loading
This commit is contained in:
parent
8e17e445d6
commit
1533eb4924
|
@ -32,6 +32,7 @@
|
||||||
package org.lwjgl.fmod3;
|
package org.lwjgl.fmod3;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -274,6 +275,12 @@ public class FMOD {
|
||||||
dllName = FMOD_LINUX_LIBRARY_NAME;
|
dllName = FMOD_LINUX_LIBRARY_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String jwsPath = getPathFromJWS(dllName.substring(0, dllName.indexOf(".")));
|
||||||
|
if (jwsPath != null) {
|
||||||
|
libpath += seperator
|
||||||
|
+ jwsPath.substring(0, jwsPath.lastIndexOf(File.separator));
|
||||||
|
}
|
||||||
|
|
||||||
// split, and rebuild library path to path + dll
|
// split, and rebuild library path to path + dll
|
||||||
StringTokenizer st = new StringTokenizer(libpath, seperator);
|
StringTokenizer st = new StringTokenizer(libpath, seperator);
|
||||||
String[] paths = new String[st.countTokens() + 1];
|
String[] paths = new String[st.countTokens() + 1];
|
||||||
|
@ -305,6 +312,31 @@ public class FMOD {
|
||||||
nDestroy();
|
nDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to locate FMOD from the JWS Library path
|
||||||
|
* This method exists because FMOD is loaded from native code, and as such
|
||||||
|
* is exempt from JWS library loading rutines. FMOD therefore always fails.
|
||||||
|
* We therefore invoke the protected method of the JWS classloader to see if it can
|
||||||
|
* locate it.
|
||||||
|
*
|
||||||
|
* @param libname Name of library to search for
|
||||||
|
* @return Absolute path to library if found, otherwise null
|
||||||
|
*/
|
||||||
|
private static String getPathFromJWS(String libname) {
|
||||||
|
try {
|
||||||
|
Object o = FMOD.class.getClassLoader();
|
||||||
|
Class c = o.getClass();
|
||||||
|
Method findLibrary =
|
||||||
|
c.getMethod("findLibrary", new Class[] { String.class });
|
||||||
|
Object[] arguments = new Object[] { libname };
|
||||||
|
return (String) findLibrary.invoke(o, arguments);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Failure locating FMOD using classloader:" + e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native method the destroy the FMOD
|
* Native method the destroy the FMOD
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue