mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 05:43:34 +00:00
(Android) Reimplement how shutdown gets signalled
This commit is contained in:
parent
d6b5dd6ac4
commit
cfe5491b05
@ -238,12 +238,9 @@ static void android_input_poll_main_cmd(void)
|
|||||||
{
|
{
|
||||||
int8_t cmd;
|
int8_t cmd;
|
||||||
struct android_app *android_app = (struct android_app*)g_android;
|
struct android_app *android_app = (struct android_app*)g_android;
|
||||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
|
||||||
|
|
||||||
if (read(android_app->msgread, &cmd, sizeof(cmd)) != sizeof(cmd))
|
if (read(android_app->msgread, &cmd, sizeof(cmd)) != sizeof(cmd))
|
||||||
{
|
|
||||||
cmd = -1;
|
cmd = -1;
|
||||||
}
|
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
@ -353,7 +350,6 @@ static void android_input_poll_main_cmd(void)
|
|||||||
|
|
||||||
case APP_CMD_DESTROY:
|
case APP_CMD_DESTROY:
|
||||||
RARCH_LOG("APP_CMD_DESTROY\n");
|
RARCH_LOG("APP_CMD_DESTROY\n");
|
||||||
system->shutdown = true;
|
|
||||||
android_app->destroyRequested = 1;
|
android_app->destroyRequested = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -791,6 +787,8 @@ static void android_input_poll_user(void *data)
|
|||||||
static void android_input_poll(void *data)
|
static void android_input_poll(void *data)
|
||||||
{
|
{
|
||||||
int ident;
|
int ident;
|
||||||
|
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||||
|
struct android_app *android_app = (struct android_app*)g_android;
|
||||||
|
|
||||||
while ((ident =
|
while ((ident =
|
||||||
ALooper_pollAll((input_driver_key_pressed(RARCH_PAUSE_TOGGLE))
|
ALooper_pollAll((input_driver_key_pressed(RARCH_PAUSE_TOGGLE))
|
||||||
@ -809,20 +807,29 @@ static void android_input_poll(void *data)
|
|||||||
android_input_poll_main_cmd();
|
android_input_poll_main_cmd();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (android_app->destroyRequested != 0)
|
||||||
|
{
|
||||||
|
system->shutdown = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool android_run_events(void *data)
|
bool android_run_events(void *data)
|
||||||
{
|
{
|
||||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||||
int id = ALooper_pollOnce(-1, NULL, NULL, NULL);
|
struct android_app *android_app = (struct android_app*)g_android;
|
||||||
|
|
||||||
if (id == LOOPER_ID_MAIN)
|
if (ALooper_pollOnce(-1, NULL, NULL, NULL) == LOOPER_ID_MAIN)
|
||||||
android_input_poll_main_cmd();
|
android_input_poll_main_cmd();
|
||||||
|
|
||||||
/* Check if we are exiting. */
|
/* Check if we are exiting. */
|
||||||
if (system->shutdown)
|
if (android_app->destroyRequested != 0)
|
||||||
|
{
|
||||||
|
system->shutdown = true;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user