Various fixes

This commit is contained in:
Elias Naur 2004-04-09 21:52:42 +00:00
parent 4f6eaa7280
commit 368207e9e2
4 changed files with 15 additions and 31 deletions

View file

@ -238,6 +238,6 @@ void extgl_InitARBProgram(JNIEnv *env, jobject ext_set)
};
int num_functions = NUMFUNCTIONS(functions);
jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBProgram");
extgl_InitializeClass(env, clazz, NULL, "<ARBProgram>", num_functions, functions);
extgl_InitializeClass(env, clazz, NULL, NULL, num_functions, functions);
}

View file

@ -105,11 +105,9 @@ int copyEvents(event_queue_t *event_queue, unsigned char *output_event_buffer, i
return num_events;
}
/*int getEventBufferSize(event_queue_t *event_queue) {
return EVENT_BUFFER_SIZE;
}
*/
static void throwGeneralException(JNIEnv * env, const char *exception_name, const char * err) {
if (env->ExceptionCheck() == JNI_TRUE)
return; // The JVM crashes if we try to throw two exceptions from one native call
jclass cls = env->FindClass(exception_name);
env->ThrowNew(cls, err);
env->DeleteLocalRef(cls);
@ -169,9 +167,11 @@ bool ext_InitializeClass(JNIEnv *env, jclass clazz, jobject ext_set, const char
if (function->ext_function_name != NULL) {
void *ext_func_pointer = gpa(function->ext_function_name);
if (ext_func_pointer == NULL) {
printf("NOTICE: %s disabled because of missing driver symbols\n", ext_name);
if (ext_set != NULL)
ext_removeExtension(env, ext_set, ext_name);
if (ext_name != NULL) {
printfDebug("NOTICE: %s disabled because of missing driver symbols\n", ext_name);
if (ext_set != NULL)
ext_removeExtension(env, ext_set, ext_name);
}
free(methods);
return false;
}
@ -185,9 +185,12 @@ bool ext_InitializeClass(JNIEnv *env, jclass clazz, jobject ext_set, const char
}
jint result = env->RegisterNatives(clazz, methods, num_functions);
free(methods);
if (result != 0)
printfDebug("Could not register natives for extension %s\n", ext_name);
return true;
if (result != 0) {
if (ext_name != NULL)
printfDebug("Could not register natives for extension %s\n", ext_name);
return false;
} else
return true;
}
bool getBooleanProperty(JNIEnv *env, const char* propertyName) {

View file

@ -82,9 +82,6 @@ extern bool LoadAL(JNIEnv *env);
/* Loads OpenAL ALC functions */
extern bool LoadALC(JNIEnv *env);
/* Loads any extensions to OpenAL */
static bool LoadALExtensions(void);
static void *NativeGetFunctionPointer(const char *function) {
#ifdef _WIN32
return GetProcAddress(handleOAL, function);
@ -251,13 +248,6 @@ void InitializeOpenAL(JNIEnv *env, jobjectArray oalPaths) {
throwException(env, "Could not load ALC function pointers.");
return;
}
//load OpenAL extensions
if(!LoadALExtensions()) {
DeInitializeOpenAL();
throwException(env, "Could not load AL extension function pointers.");
return;
}
}
/**
@ -268,15 +258,6 @@ void DeInitializeOpenAL() {
handleOAL = 0;
}
/**
* Loads the OpenAL extensions functions
*
* @return true if all methods were loaded, false if one of the methods could not be loaded
*/
static bool LoadALExtensions() {
return true;
}
bool extal_InitializeClass(JNIEnv *env, jclass clazz, jobject ext_set, const char *ext_name, int num_functions, JavaMethodAndExtFunction *functions) {
return ext_InitializeClass(env, clazz, ext_set, ext_name, &extal_GetProcAddress, num_functions, functions);
}

View file

@ -181,5 +181,5 @@ void extgl_InitNVProgram(JNIEnv *env, jobject ext_set)
};
int num_functions = NUMFUNCTIONS(functions);
jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVProgram");
extgl_InitializeClass(env, clazz, NULL, "<NVProgram>", num_functions, functions);
extgl_InitializeClass(env, clazz, NULL, NULL, num_functions, functions);
}