mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(Android) Fix - restore state functionality broke again due to
'refactor' in driver.c - this does not work for re-entrancy - please consult with me
This commit is contained in:
parent
70b5007a1e
commit
e8a57f21cd
@ -139,7 +139,6 @@ void engine_handle_cmd(struct android_app* android_app, int32_t cmd)
|
||||
/* POSTEXEC */
|
||||
free_saved_state(android_app);
|
||||
|
||||
g_extern.lifecycle_state &= ~(1ULL << RARCH_PAUSE_TOGGLE);
|
||||
break;
|
||||
case APP_CMD_START:
|
||||
RARCH_LOG("engine_handle_cmd: APP_CMD_START.\n");
|
||||
@ -209,6 +208,7 @@ void engine_handle_cmd(struct android_app* android_app, int32_t cmd)
|
||||
case APP_CMD_GAINED_FOCUS:
|
||||
RARCH_LOG("engine_handle_cmd: APP_CMD_GAINED_FOCUS.\n");
|
||||
|
||||
g_extern.lifecycle_state &= ~(1ULL << RARCH_PAUSE_TOGGLE);
|
||||
/* EXEC */
|
||||
break;
|
||||
case APP_CMD_LOST_FOCUS:
|
||||
@ -229,46 +229,36 @@ void engine_handle_cmd(struct android_app* android_app, int32_t cmd)
|
||||
|
||||
bool android_run_events(struct android_app* android_app)
|
||||
{
|
||||
// Read all pending events.
|
||||
int id;
|
||||
int id = ALooper_pollOnce(0, NULL, 0, NULL);
|
||||
|
||||
RARCH_LOG("RetroArch Android paused.\n");
|
||||
|
||||
// Block forever waiting for events.
|
||||
while ((id = ALooper_pollOnce(input_key_pressed_func(RARCH_PAUSE_TOGGLE) ? -1 : 100, NULL, 0, NULL)) >= 0)
|
||||
if (id == LOOPER_ID_MAIN)
|
||||
{
|
||||
// Process this event.
|
||||
if (id)
|
||||
int8_t cmd;
|
||||
|
||||
if (read(android_app->msgread, &cmd, sizeof(cmd)) == sizeof(cmd))
|
||||
{
|
||||
int8_t cmd;
|
||||
|
||||
if (read(android_app->msgread, &cmd, sizeof(cmd)) == sizeof(cmd))
|
||||
{
|
||||
if(cmd == APP_CMD_SAVE_STATE)
|
||||
free_saved_state(android_app);
|
||||
}
|
||||
else
|
||||
cmd = -1;
|
||||
|
||||
engine_handle_cmd(android_app, cmd);
|
||||
|
||||
if (cmd == APP_CMD_INIT_WINDOW)
|
||||
{
|
||||
if(g_extern.lifecycle_state & (1ULL << RARCH_REENTRANT))
|
||||
init_drivers();
|
||||
|
||||
if (android_app->window != NULL)
|
||||
g_android.window_ready = true;
|
||||
}
|
||||
if(cmd == APP_CMD_SAVE_STATE)
|
||||
free_saved_state(android_app);
|
||||
}
|
||||
else
|
||||
cmd = -1;
|
||||
|
||||
// Check if we are exiting.
|
||||
if (g_extern.lifecycle_state & (1ULL << RARCH_QUIT_KEY))
|
||||
return false;
|
||||
engine_handle_cmd(android_app, cmd);
|
||||
|
||||
if (cmd == APP_CMD_INIT_WINDOW)
|
||||
{
|
||||
if(g_extern.lifecycle_state & (1ULL << RARCH_REENTRANT))
|
||||
init_drivers();
|
||||
|
||||
if (android_app->window != NULL)
|
||||
g_android.window_ready = true;
|
||||
}
|
||||
}
|
||||
|
||||
RARCH_LOG("RetroArch Android unpaused.\n");
|
||||
|
||||
// Check if we are exiting.
|
||||
if (g_extern.lifecycle_state & (1ULL << RARCH_QUIT_KEY))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
2
driver.c
2
driver.c
@ -238,8 +238,10 @@ static void adjust_system_rates(void)
|
||||
|
||||
RARCH_LOG("Set audio input rate to: %.2f Hz.\n", g_settings.audio.in_rate);
|
||||
|
||||
#ifndef ANDROID
|
||||
if (driver.video_data)
|
||||
video_set_nonblock_state_func(!g_settings.video.vsync || g_extern.system.force_nonblock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void driver_set_monitor_refresh_rate(float hz)
|
||||
|
Loading…
x
Reference in New Issue
Block a user