wip: load oal based on java.library.path

This commit is contained in:
Brian Matzon 2003-03-21 17:55:33 +00:00
parent bba7bf9462
commit 24db98e43a
3 changed files with 19 additions and 5 deletions

View File

@ -163,8 +163,22 @@ void* GetFunctionPointer(const char* function) {
/**
* Loads the OpenAL Library
*/
void LoadOpenAL() {
void LoadOpenAL(JNIEnv *env) {
#ifdef _WIN32
jstring propertykey;
jstring librarypath;
jclass systemclass;
jmethodID propertymethod;
//compile bitch!
//propertykey = env->NewStringUTF("java.library.path");
///*systemclass = */env->FindClass("java/lang/System");
//propertymethod = env->GetStaticMethodID(systemclass, "getProperty", "(Ljava/lang/String;)Ljava/lang/String");
//librarypath = env->CallStaticObjectMethod(systemclass, jmethodID, propertykey);
printf("Loaded library path: %s", librarypath);
//parse string
//try to load for each path
handleOAL = LoadLibrary("OpenAL32.dll");
#endif
#ifdef _X11
@ -187,13 +201,13 @@ void UnLoadOpenAL() {
/**
* Initializes OpenAL by loading the library
*/
int InitializeOpenAL() {
int InitializeOpenAL(JNIEnv *env) {
if(handleOAL != 0) {
return JNI_TRUE;
}
//load our library
LoadOpenAL();
LoadOpenAL(env);
// if we couldn't load the library, get out
if(handleOAL == 0) {

View File

@ -135,7 +135,7 @@ DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties,
#define INITGUID
#define OPENAL
int InitializeOpenAL();
int InitializeOpenAL(JNIEnv *env);
void DeInitializeOpenAL();
//alc

View File

@ -41,7 +41,7 @@
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_BaseAL_nCreate (JNIEnv *env, jobject obj) {
if(!InitializeOpenAL()) {
if(!InitializeOpenAL(env)) {
jclass cls = env->FindClass("org/lwjgl/openal/OpenALException");
env->ThrowNew(cls, "Unable to load function pointers to openal.");
env->DeleteLocalRef(cls);