Game Development Reference
In-Depth Information
va_list argptr;
char string[1024];
CL_Shutdown ();
Qcommon_Shutdown ();
va_start (argptr,error);
vsprintf (string,error,argptr);
va_end (argptr);
jni_sys_error(string);
}
// jni_quake.c
void jni_sys_error(const char * text) {
JNIEnv *env;
if ( !g_VM) {
LOGE("jni_fatal No Java VM available. Aborting\n");
exit (0);
}
(*g_VM)->AttachCurrentThread (g_VM, &env, NULL);
// need a valid environment and class
if ( !env || !jNativesCls) {
return;
}
jmethodID mid = (*env)->GetStaticMethodID(env, jNativesCls
, "OnSysError"
, "(Ljava/lang/String;)V");
// invoke Your.OnSysError(text)
if (mid) {
(*env)->CallStaticVoidMethod(env, jNativesCls
, mid
, (*env)->NewStringUTF(env, text) );
}
}
Whenever a fatal error occurs, Quake II calls Sys_Error with a description of the error. The
client will be shut down and the arguments will be packed into a string and sent to the C to
Java callback of jni_sys_error .
va_start (argptr,error);
vsprintf (string,error,argptr);
va_end (argptr);
jni_sys_error(string);
jni_sys_error then performs the following steps:
Search WWH ::




Custom Search