mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 06:40:48 +00:00
(Android) Use DetachCurrentThread - first stab at setting up clean
deiniting
This commit is contained in:
parent
6d44198f8a
commit
9b6425c1da
@ -20,6 +20,7 @@ struct droid
|
||||
const ASensor* accelerometerSensor;
|
||||
ASensorEventQueue* sensorEventQueue;
|
||||
|
||||
bool init_quit;
|
||||
bool window_inited;
|
||||
unsigned animating;
|
||||
unsigned width;
|
||||
|
@ -52,6 +52,7 @@ static int16_t android_input_state(void *data, const struct retro_keybind **retr
|
||||
(void)index;
|
||||
(void)id;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -60,6 +61,18 @@ static bool android_input_key_pressed(void *data, int key)
|
||||
(void)data;
|
||||
(void)key;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case RARCH_QUIT_KEY:
|
||||
if(g_android.init_quit)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
(void)0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -48,9 +48,7 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd)
|
||||
break;
|
||||
case APP_CMD_TERM_WINDOW:
|
||||
// The window is being hidden or closed, clean it up.
|
||||
rarch_main_deinit();
|
||||
rarch_deinit_msg_queue();
|
||||
rarch_main_clear_state();
|
||||
g_android.init_quit = true;
|
||||
break;
|
||||
case APP_CMD_GAINED_FOCUS:
|
||||
// When our app gains focus, we start monitoring the accelerometer.
|
||||
@ -106,6 +104,8 @@ static void android_get_char_argv(char *argv, size_t sizeof_argv, const char *ar
|
||||
strncpy(argv, test_argv, sizeof_argv);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, jsParam1, test_argv);
|
||||
|
||||
(*rarch_vm)->DetachCurrentThread(rarch_vm);
|
||||
}
|
||||
|
||||
#define MAX_ARGS 32
|
||||
|
@ -192,11 +192,10 @@ static void gfx_ctx_check_window(bool *quit,
|
||||
*/
|
||||
|
||||
// Check if we are exiting.
|
||||
if (state->destroyRequested != 0)
|
||||
if (state->destroyRequested != 0 || g_android.init_quit)
|
||||
{
|
||||
gl->quitting = true;
|
||||
*quit = true;
|
||||
gfx_ctx_destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user