mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-22 01:45:19 +01:00
platform/android-nosdl: add Platform_Shutdown for preShutdown callback
This commit is contained in:
parent
537202a73d
commit
eb8cd4a7c3
@ -265,6 +265,7 @@ DECLARE_JNI_INTERFACE( int, nativeInit, jobject array )
|
||||
jni.getGLAttribute = (*env)->GetStaticMethodID(env, jni.bindcls, "getGLAttribute", "(I)I");
|
||||
jni.deleteGLContext = (*env)->GetStaticMethodID(env, jni.bindcls, "deleteGLContext", "()Z");
|
||||
jni.getSurface = (*env)->GetStaticMethodID(env, jni.bindcls, "getNativeSurface", "(I)Landroid/view/Surface;");
|
||||
jni.preShutdown = (*env)->GetStaticMethodID(env, jni.bindcls, "preShutdown", "()V");
|
||||
|
||||
// jni fails when called from signal handler callback, so jump here when called messagebox from handler
|
||||
if( setjmp( crash_frame ))
|
||||
@ -272,8 +273,7 @@ DECLARE_JNI_INTERFACE( int, nativeInit, jobject array )
|
||||
// note: this will destroy stack and shutting down engine with return-from-main
|
||||
// will be impossible, but Sys_Quit works
|
||||
(*jni.env)->CallStaticVoidMethod( jni.env, jni.bindcls, jni.messageBox, (*jni.env)->NewStringUTF( jni.env, "crash" ), (*jni.env)->NewStringUTF( jni.env , crash_text ) );
|
||||
|
||||
// java shutdown callback here?
|
||||
(*jni.env)->CallStaticVoidMethod( jni.env, jni.bindcls, jni.preShutdown );
|
||||
|
||||
// UB, but who cares, we already crashed!
|
||||
longjmp( restore_frame, 1 );
|
||||
@ -603,7 +603,9 @@ void Android_Init( void )
|
||||
|
||||
void Android_Shutdown( void )
|
||||
{
|
||||
|
||||
if( host.crashed )
|
||||
return;
|
||||
(*jni.env)->CallStaticVoidMethod( jni.env, jni.bindcls, jni.preShutdown );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -29,6 +29,7 @@ extern struct jnimethods_s
|
||||
jmethodID getGLAttribute;
|
||||
jmethodID deleteGLContext;
|
||||
jmethodID getSurface;
|
||||
jmethodID preShutdown;
|
||||
int width, height;
|
||||
} jni;
|
||||
|
||||
|
@ -135,6 +135,8 @@ static inline void Platform_Shutdown( void )
|
||||
|
||||
#if XASH_SDL
|
||||
SDLash_Shutdown( );
|
||||
#elif XASH_ANDROID
|
||||
Android_Shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user