mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
Create rarch_main_set_idle - make 'idle' variable self-contained
This commit is contained in:
parent
3f46a74f08
commit
74ee9b05f3
@ -829,10 +829,9 @@ void video_driver_get_video_output_prev(void)
|
|||||||
void video_driver_cached_frame(void)
|
void video_driver_cached_frame(void)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
|
||||||
void *recording = driver ? driver->recording_data : NULL;
|
void *recording = driver ? driver->recording_data : NULL;
|
||||||
|
|
||||||
if (global->is_idle)
|
if (rarch_main_is_idle())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Cannot allow recording when pushing duped frames. */
|
/* Cannot allow recording when pushing duped frames. */
|
||||||
|
@ -359,7 +359,7 @@ static void engine_handle_cmd(void)
|
|||||||
{
|
{
|
||||||
RARCH_LOG("Pausing RetroArch.\n");
|
RARCH_LOG("Pausing RetroArch.\n");
|
||||||
global->is_paused = true;
|
global->is_paused = true;
|
||||||
global->is_idle = true;
|
rarch_main_set_idle(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ static void engine_handle_cmd(void)
|
|||||||
|
|
||||||
case APP_CMD_GAINED_FOCUS:
|
case APP_CMD_GAINED_FOCUS:
|
||||||
global->is_paused = false;
|
global->is_paused = false;
|
||||||
global->is_idle = false;
|
rarch_main_set_idle(false);
|
||||||
|
|
||||||
if ((android_app->sensor_state_mask
|
if ((android_app->sensor_state_mask
|
||||||
& (UINT64_C(1) << RETRO_SENSOR_ACCELEROMETER_ENABLE))
|
& (UINT64_C(1) << RETRO_SENSOR_ACCELEROMETER_ENABLE))
|
||||||
|
@ -397,7 +397,7 @@ static void rgui_render(void)
|
|||||||
if (menu_entries_needs_refresh() && menu_driver_alive() && !disp->msg_force)
|
if (menu_entries_needs_refresh() && menu_driver_alive() && !disp->msg_force)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (global->is_idle)
|
if (rarch_main_is_idle())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!menu_display_update_pending())
|
if (!menu_display_update_pending())
|
||||||
|
@ -364,7 +364,7 @@ int menu_iterate(retro_input_t input,
|
|||||||
|
|
||||||
ret = menu_entry_iterate(action);
|
ret = menu_entry_iterate(action);
|
||||||
|
|
||||||
if (menu_driver_alive() && !global->is_idle)
|
if (menu_driver_alive() && !rarch_main_is_idle())
|
||||||
menu_display_fb();
|
menu_display_fb();
|
||||||
|
|
||||||
menu_driver_set_texture();
|
menu_driver_set_texture();
|
||||||
|
16
runloop.c
16
runloop.c
@ -44,6 +44,8 @@
|
|||||||
|
|
||||||
static struct global g_extern;
|
static struct global g_extern;
|
||||||
|
|
||||||
|
static bool main_is_idle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check_pause:
|
* check_pause:
|
||||||
* @pressed : was libretro pause key pressed?
|
* @pressed : was libretro pause key pressed?
|
||||||
@ -512,7 +514,7 @@ static int do_pause_state_checks(
|
|||||||
static int do_state_checks(driver_t *driver, settings_t *settings,
|
static int do_state_checks(driver_t *driver, settings_t *settings,
|
||||||
global_t *global, event_cmd_state_t *cmd)
|
global_t *global, event_cmd_state_t *cmd)
|
||||||
{
|
{
|
||||||
if (global->is_idle)
|
if (main_is_idle)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (cmd->screenshot_pressed)
|
if (cmd->screenshot_pressed)
|
||||||
@ -868,7 +870,7 @@ global_t *global_get_ptr(void)
|
|||||||
|
|
||||||
void rarch_main_state_free(void)
|
void rarch_main_state_free(void)
|
||||||
{
|
{
|
||||||
g_extern.is_idle = false;
|
main_is_idle = false;
|
||||||
g_extern.ui_companion_is_on_foreground = false;
|
g_extern.ui_companion_is_on_foreground = false;
|
||||||
g_extern.frames.limit.minimum_time = 0.0;
|
g_extern.frames.limit.minimum_time = 0.0;
|
||||||
g_extern.frames.limit.last_time = 0.0;
|
g_extern.frames.limit.last_time = 0.0;
|
||||||
@ -912,12 +914,14 @@ void rarch_main_clear_state(void)
|
|||||||
rarch_main_global_free();
|
rarch_main_global_free();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rarch_main_set_idle(unsigned enable)
|
||||||
|
{
|
||||||
|
main_is_idle = enable;
|
||||||
|
}
|
||||||
|
|
||||||
bool rarch_main_is_idle(void)
|
bool rarch_main_is_idle(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
return main_is_idle;
|
||||||
if (!global)
|
|
||||||
return false;
|
|
||||||
return global->is_idle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool rarch_main_cmd_get_state_menu_toggle_button_combo(
|
static bool rarch_main_cmd_get_state_menu_toggle_button_combo(
|
||||||
|
@ -43,7 +43,6 @@ typedef struct rarch_resolution
|
|||||||
typedef struct global
|
typedef struct global
|
||||||
{
|
{
|
||||||
/* Lifecycle state checks. */
|
/* Lifecycle state checks. */
|
||||||
bool is_idle;
|
|
||||||
bool ui_companion_is_on_foreground;
|
bool ui_companion_is_on_foreground;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
@ -345,6 +344,8 @@ FILE *rarch_main_log_file(void);
|
|||||||
|
|
||||||
bool rarch_main_is_idle(void);
|
bool rarch_main_is_idle(void);
|
||||||
|
|
||||||
|
void rarch_main_set_idle(unsigned enable);
|
||||||
|
|
||||||
void rarch_main_state_free(void);
|
void rarch_main_state_free(void);
|
||||||
|
|
||||||
void rarch_main_global_free(void);
|
void rarch_main_global_free(void);
|
||||||
|
@ -45,19 +45,19 @@ void apple_rarch_exited(void);
|
|||||||
static void rarch_enable_ui(void)
|
static void rarch_enable_ui(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
global->is_paused = true;
|
global->is_paused = true;
|
||||||
global->is_idle = true;
|
|
||||||
global->ui_companion_is_on_foreground = true;
|
global->ui_companion_is_on_foreground = true;
|
||||||
|
rarch_main_set_idle(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rarch_disable_ui(void)
|
static void rarch_disable_ui(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
global->is_paused = false;
|
global->is_paused = false;
|
||||||
global->is_idle = false;
|
global->ui_companion_is_on_foreground = false;
|
||||||
global->ui_companion_is_on_foreground = false;
|
rarch_main_set_idle(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rarch_draw(void)
|
static void rarch_draw(void)
|
||||||
@ -88,7 +88,7 @@ static void rarch_draw(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global->is_idle)
|
if (rarch_main_is_idle())
|
||||||
return;
|
return;
|
||||||
CFRunLoopWakeUp(CFRunLoopGetMain());
|
CFRunLoopWakeUp(CFRunLoopGetMain());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user