mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +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;
|
const ASensor* accelerometerSensor;
|
||||||
ASensorEventQueue* sensorEventQueue;
|
ASensorEventQueue* sensorEventQueue;
|
||||||
|
|
||||||
|
bool init_quit;
|
||||||
bool window_inited;
|
bool window_inited;
|
||||||
unsigned animating;
|
unsigned animating;
|
||||||
unsigned width;
|
unsigned width;
|
||||||
|
@ -52,6 +52,7 @@ static int16_t android_input_state(void *data, const struct retro_keybind **retr
|
|||||||
(void)index;
|
(void)index;
|
||||||
(void)id;
|
(void)id;
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +61,18 @@ static bool android_input_key_pressed(void *data, int key)
|
|||||||
(void)data;
|
(void)data;
|
||||||
(void)key;
|
(void)key;
|
||||||
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case RARCH_QUIT_KEY:
|
||||||
|
if(g_android.init_quit)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
(void)0;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,9 +48,7 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd)
|
|||||||
break;
|
break;
|
||||||
case APP_CMD_TERM_WINDOW:
|
case APP_CMD_TERM_WINDOW:
|
||||||
// The window is being hidden or closed, clean it up.
|
// The window is being hidden or closed, clean it up.
|
||||||
rarch_main_deinit();
|
g_android.init_quit = true;
|
||||||
rarch_deinit_msg_queue();
|
|
||||||
rarch_main_clear_state();
|
|
||||||
break;
|
break;
|
||||||
case APP_CMD_GAINED_FOCUS:
|
case APP_CMD_GAINED_FOCUS:
|
||||||
// When our app gains focus, we start monitoring the accelerometer.
|
// 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);
|
strncpy(argv, test_argv, sizeof_argv);
|
||||||
|
|
||||||
(*env)->ReleaseStringUTFChars(env, jsParam1, test_argv);
|
(*env)->ReleaseStringUTFChars(env, jsParam1, test_argv);
|
||||||
|
|
||||||
|
(*rarch_vm)->DetachCurrentThread(rarch_vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_ARGS 32
|
#define MAX_ARGS 32
|
||||||
|
@ -192,11 +192,10 @@ static void gfx_ctx_check_window(bool *quit,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Check if we are exiting.
|
// Check if we are exiting.
|
||||||
if (state->destroyRequested != 0)
|
if (state->destroyRequested != 0 || g_android.init_quit)
|
||||||
{
|
{
|
||||||
gl->quitting = true;
|
gl->quitting = true;
|
||||||
*quit = true;
|
*quit = true;
|
||||||
gfx_ctx_destroy();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user