wip: load oal based on java.library.path
This commit is contained in:
parent
bba7bf9462
commit
24db98e43a
|
@ -163,8 +163,22 @@ void* GetFunctionPointer(const char* function) {
|
||||||
/**
|
/**
|
||||||
* Loads the OpenAL Library
|
* Loads the OpenAL Library
|
||||||
*/
|
*/
|
||||||
void LoadOpenAL() {
|
void LoadOpenAL(JNIEnv *env) {
|
||||||
#ifdef _WIN32
|
#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");
|
handleOAL = LoadLibrary("OpenAL32.dll");
|
||||||
#endif
|
#endif
|
||||||
#ifdef _X11
|
#ifdef _X11
|
||||||
|
@ -187,13 +201,13 @@ void UnLoadOpenAL() {
|
||||||
/**
|
/**
|
||||||
* Initializes OpenAL by loading the library
|
* Initializes OpenAL by loading the library
|
||||||
*/
|
*/
|
||||||
int InitializeOpenAL() {
|
int InitializeOpenAL(JNIEnv *env) {
|
||||||
if(handleOAL != 0) {
|
if(handleOAL != 0) {
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//load our library
|
//load our library
|
||||||
LoadOpenAL();
|
LoadOpenAL(env);
|
||||||
|
|
||||||
// if we couldn't load the library, get out
|
// if we couldn't load the library, get out
|
||||||
if(handleOAL == 0) {
|
if(handleOAL == 0) {
|
||||||
|
|
|
@ -135,7 +135,7 @@ DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties,
|
||||||
#define INITGUID
|
#define INITGUID
|
||||||
#define OPENAL
|
#define OPENAL
|
||||||
|
|
||||||
int InitializeOpenAL();
|
int InitializeOpenAL(JNIEnv *env);
|
||||||
void DeInitializeOpenAL();
|
void DeInitializeOpenAL();
|
||||||
|
|
||||||
//alc
|
//alc
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
* Signature: ()Z
|
* Signature: ()Z
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_BaseAL_nCreate (JNIEnv *env, jobject obj) {
|
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");
|
jclass cls = env->FindClass("org/lwjgl/openal/OpenALException");
|
||||||
env->ThrowNew(cls, "Unable to load function pointers to openal.");
|
env->ThrowNew(cls, "Unable to load function pointers to openal.");
|
||||||
env->DeleteLocalRef(cls);
|
env->DeleteLocalRef(cls);
|
||||||
|
|
Loading…
Reference in New Issue