Use more runloop flags

This commit is contained in:
LibretroAdmin 2022-10-10 08:59:27 +02:00
parent c9bbe7683f
commit d100e73780
14 changed files with 110 additions and 115 deletions

View File

@ -4594,6 +4594,7 @@ bool config_save_file(const char *path)
struct config_float_setting *float_settings = NULL; struct config_float_setting *float_settings = NULL;
struct config_array_setting *array_settings = NULL; struct config_array_setting *array_settings = NULL;
struct config_path_setting *path_settings = NULL; struct config_path_setting *path_settings = NULL;
uint32_t flags = runloop_get_flags();
config_file_t *conf = config_file_new_from_path_to_string(path); config_file_t *conf = config_file_new_from_path_to_string(path);
settings_t *settings = config_st; settings_t *settings = config_st;
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();
@ -4608,7 +4609,7 @@ bool config_save_file(const char *path)
if (!conf) if (!conf)
conf = config_file_new_alloc(); conf = config_file_new_alloc();
if (!conf || retroarch_ctl(RARCH_CTL_IS_OVERRIDES_ACTIVE, NULL)) if (!conf || (flags & RUNLOOP_FLAG_OVERRIDES_ACTIVE))
{ {
if (conf) if (conf)
config_file_free(conf); config_file_free(conf);

View File

@ -44,6 +44,7 @@
#include "../../driver.h" #include "../../driver.h"
#include "../../retroarch.h" #include "../../retroarch.h"
#include "../../runloop.h"
#include "../../verbosity.h" #include "../../verbosity.h"
#include "../common/ctr_common.h" #include "../common/ctr_common.h"
@ -461,6 +462,7 @@ static void bottom_menu_control(void* data, bool lcd_bottom)
ctr_video_t *ctr = (ctr_video_t*)data; ctr_video_t *ctr = (ctr_video_t*)data;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
int config_slot = settings->ints.state_slot; int config_slot = settings->ints.state_slot;
uint32_t flags = runloop_get_flags();
if (!ctr->init_bottom_menu) if (!ctr->init_bottom_menu)
{ {
@ -475,7 +477,7 @@ static void bottom_menu_control(void* data, bool lcd_bottom)
BIT64_CLEAR(lifecycle_state, RARCH_MENU_TOGGLE); BIT64_CLEAR(lifecycle_state, RARCH_MENU_TOGGLE);
if (!retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL)) if (!(flags & RUNLOOP_FLAG_CORE_RUNNING))
{ {
if (!ctr->bottom_is_idle) if (!ctr->bottom_is_idle)
{ {
@ -618,8 +620,8 @@ static void bottom_menu_control(void* data, bool lcd_bottom)
ctr->refresh_bottom_menu = true; ctr->refresh_bottom_menu = true;
} }
if (ctr->bottom_menu == CTR_BOTTOM_MENU_NOT_AVAILABLE || if ( ctr->bottom_menu == CTR_BOTTOM_MENU_NOT_AVAILABLE
!retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL)) || (!(flags & RUNLOOP_FLAG_CORE_RUNNING)))
return; return;
@ -1308,6 +1310,7 @@ static bool ctr_frame(void* data, const void* frame,
#endif #endif
bool overlay_behind_menu = video_info->overlay_behind_menu; bool overlay_behind_menu = video_info->overlay_behind_menu;
bool lcd_bottom = false; bool lcd_bottom = false;
uint32_t flags = runloop_get_flags();
if (!width || !height || !settings) if (!width || !height || !settings)
{ {
@ -1318,7 +1321,7 @@ static bool ctr_frame(void* data, const void* frame,
lcd_bottom = settings->bools.video_3ds_lcd_bottom; lcd_bottom = settings->bools.video_3ds_lcd_bottom;
if (lcd_bottom != ctr_bottom_screen_enabled) if (lcd_bottom != ctr_bottom_screen_enabled)
{ {
if (retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL)) if (flags & RUNLOOP_FLAG_CORE_RUNNING)
{ {
ctr_set_bottom_screen_enable(lcd_bottom, false); ctr_set_bottom_screen_enable(lcd_bottom, false);
if (lcd_bottom) if (lcd_bottom)
@ -1676,8 +1679,8 @@ static bool ctr_frame(void* data, const void* frame,
#endif #endif
#ifndef CONSOLE_LOG #ifndef CONSOLE_LOG
if (ctr_bottom_screen_enabled && if ( ctr_bottom_screen_enabled
retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL)) && (flags & RUNLOOP_FLAG_CORE_RUNNING))
{ {
if ( !ctr->bottom_is_idle ) if ( !ctr->bottom_is_idle )
{ {

View File

@ -167,9 +167,9 @@ static void gfx_ctx_mali_fbdev_destroy_really(void)
static void gfx_ctx_mali_fbdev_maybe_restart(void) static void gfx_ctx_mali_fbdev_maybe_restart(void)
{ {
runloop_state_t *runloop_st = runloop_state_get_ptr(); uint32_t flags = runloop_get_flags();
if (!runloop_st->shutdown_initiated) if (!(flags & RUNLOOP_FLAG_SHUTDOWN_INITIATED))
frontend_driver_set_fork(FRONTEND_FORK_RESTART); frontend_driver_set_fork(FRONTEND_FORK_RESTART);
} }
@ -183,9 +183,9 @@ All these workarounds should be reverted when and if egl_destroy issues in libma
*/ */
static void gfx_ctx_mali_fbdev_destroy(void *data) static void gfx_ctx_mali_fbdev_destroy(void *data)
{ {
runloop_state_t *runloop_st = runloop_state_get_ptr(); uint32_t flags = runloop_get_flags();
if (runloop_st->shutdown_initiated) if (flags & RUNLOOP_FLAG_SHUTDOWN_INITIATED)
{ {
if (!gfx_ctx_mali_fbdev_restart_pending) if (!gfx_ctx_mali_fbdev_restart_pending)
{ {

View File

@ -77,6 +77,7 @@
#include "../../paths.h" #include "../../paths.h"
#include "../../playlist.h" #include "../../playlist.h"
#include "../../retroarch.h" #include "../../retroarch.h"
#include "../../runloop.h"
#include "../../verbosity.h" #include "../../verbosity.h"
#include "../../lakka.h" #include "../../lakka.h"
#ifdef HAVE_BLUETOOTH #ifdef HAVE_BLUETOOTH
@ -3556,24 +3557,25 @@ static int generic_action_ok_remap_file_operation(const char *path,
if (!string_is_empty(remap_file_path) && if (!string_is_empty(remap_file_path) &&
(filestream_delete(remap_file_path) == 0)) (filestream_delete(remap_file_path) == 0))
{ {
uint32_t flags = runloop_get_flags();
switch (action_type) switch (action_type)
{ {
case ACTION_OK_REMAP_FILE_REMOVE_CORE: case ACTION_OK_REMAP_FILE_REMOVE_CORE:
if (retroarch_ctl(RARCH_CTL_IS_REMAPS_CORE_ACTIVE, NULL)) if (flags & RUNLOOP_FLAG_REMAPS_CORE_ACTIVE)
{ {
input_remapping_deinit(false); input_remapping_deinit(false);
input_remapping_set_defaults(false); input_remapping_set_defaults(false);
} }
break; break;
case ACTION_OK_REMAP_FILE_REMOVE_GAME: case ACTION_OK_REMAP_FILE_REMOVE_GAME:
if (retroarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL)) if (flags & RUNLOOP_FLAG_REMAPS_GAME_ACTIVE)
{ {
input_remapping_deinit(false); input_remapping_deinit(false);
input_remapping_set_defaults(false); input_remapping_set_defaults(false);
} }
break; break;
case ACTION_OK_REMAP_FILE_REMOVE_CONTENT_DIR: case ACTION_OK_REMAP_FILE_REMOVE_CONTENT_DIR:
if (retroarch_ctl(RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE, NULL)) if (flags & RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE)
{ {
input_remapping_deinit(false); input_remapping_deinit(false);
input_remapping_set_defaults(false); input_remapping_set_defaults(false);
@ -6922,13 +6924,14 @@ static int action_ok_contentless_core_run(const char *path,
* the current selection here, and reapply it manually * the current selection here, and reapply it manually
* when building the contentless cores list... */ * when building the contentless cores list... */
size_t selection = menu_navigation_get_selection(); size_t selection = menu_navigation_get_selection();
uint32_t flags = runloop_get_flags();
if (string_is_empty(core_path)) if (string_is_empty(core_path))
return menu_cbs_exit(); return menu_cbs_exit();
/* If core is already running, open quick menu */ /* If core is already running, open quick menu */
if (retroarch_ctl(RARCH_CTL_IS_CORE_LOADED, (void*)core_path) && if ( retroarch_ctl(RARCH_CTL_IS_CORE_LOADED, (void*)core_path)
retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL)) && (flags & RUNLOOP_FLAG_CORE_RUNNING))
{ {
bool flush_menu = false; bool flush_menu = false;
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, &flush_menu); menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, &flush_menu);

View File

@ -9412,6 +9412,7 @@ static int materialui_list_push(void *data, void *userdata,
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
rarch_system_info_t *system = &runloop_state_get_ptr()->system; rarch_system_info_t *system = &runloop_state_get_ptr()->system;
uint32_t flags = runloop_get_flags();
/* If navigation bar is hidden, use default /* If navigation bar is hidden, use default
* main menu */ * main menu */
@ -9420,7 +9421,7 @@ static int materialui_list_push(void *data, void *userdata,
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
if (retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL)) if (flags & RUNLOOP_FLAG_CORE_RUNNING)
{ {
if (!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) if (!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
{ {

View File

@ -8667,9 +8667,11 @@ static int ozone_list_push(void *data, void *userdata,
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
rarch_system_info_t *system = &runloop_state_get_ptr()->system; rarch_system_info_t *system = &runloop_state_get_ptr()->system;
uint32_t flags = runloop_get_flags();
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
if (retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL)) if (flags & RUNLOOP_FLAG_CORE_RUNNING)
{ {
if (!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) if (!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
{ {

View File

@ -7445,9 +7445,10 @@ static int xmb_list_push(void *data, void *userdata,
case DISPLAYLIST_MAIN_MENU: case DISPLAYLIST_MAIN_MENU:
{ {
rarch_system_info_t *system = &runloop_state_get_ptr()->system; rarch_system_info_t *system = &runloop_state_get_ptr()->system;
uint32_t flags = runloop_get_flags();
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
if (retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL)) if (flags & RUNLOOP_FLAG_CORE_RUNNING)
{ {
if (!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) if (!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
{ {

View File

@ -98,6 +98,7 @@
#include "../core_option_manager.h" #include "../core_option_manager.h"
#include "../paths.h" #include "../paths.h"
#include "../retroarch.h" #include "../retroarch.h"
#include "../runloop.h"
#include "../core.h" #include "../core.h"
#include "../frontend/frontend_driver.h" #include "../frontend/frontend_driver.h"
#include "../ui/ui_companion_driver.h" #include "../ui/ui_companion_driver.h"
@ -1235,10 +1236,11 @@ static unsigned menu_displaylist_parse_core_option_override_list(
menu_displaylist_info_t *info, settings_t *settings) menu_displaylist_info_t *info, settings_t *settings)
{ {
unsigned count = 0; unsigned count = 0;
uint32_t flags = runloop_get_flags();
bool core_has_options = !retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL) && bool core_has_options = !retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL) &&
retroarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL); retroarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL);
bool game_options_active = retroarch_ctl(RARCH_CTL_IS_GAME_OPTIONS_ACTIVE, NULL); bool game_options_active = flags & RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE;
bool folder_options_active = retroarch_ctl(RARCH_CTL_IS_FOLDER_OPTIONS_ACTIVE, NULL); bool folder_options_active = flags & RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE;
bool show_core_options_flush = settings ? bool show_core_options_flush = settings ?
settings->bools.quick_menu_show_core_options_flush : false; settings->bools.quick_menu_show_core_options_flush : false;
@ -1332,16 +1334,17 @@ static unsigned menu_displaylist_parse_remap_file_manager_list(
menu_displaylist_info_t *info, settings_t *settings) menu_displaylist_info_t *info, settings_t *settings)
{ {
unsigned count = 0; unsigned count = 0;
uint32_t flags = runloop_get_flags();
bool has_content = !string_is_empty(path_get(RARCH_PATH_CONTENT)); bool has_content = !string_is_empty(path_get(RARCH_PATH_CONTENT));
bool core_remap_active = retroarch_ctl(RARCH_CTL_IS_REMAPS_CORE_ACTIVE, NULL); bool core_remap_active = flags & RUNLOOP_FLAG_REMAPS_CORE_ACTIVE;
bool content_dir_remap_active = retroarch_ctl(RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE, NULL); bool content_dir_remap_active = flags & RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE;
bool game_remap_active = retroarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL); bool game_remap_active = flags & RUNLOOP_FLAG_REMAPS_GAME_ACTIVE;
bool remap_save_on_exit = settings->bools.remap_save_on_exit; bool remap_save_on_exit = settings->bools.remap_save_on_exit;
/* Sanity check - cannot handle remap files /* Sanity check - cannot handle remap files
* unless a valid core is running */ * unless a valid core is running */
if (!retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL) || if ( !(flags & RUNLOOP_FLAG_CORE_RUNNING)
retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) || retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
goto end; goto end;
/* Show currently 'active' remap file */ /* Show currently 'active' remap file */
@ -6140,6 +6143,7 @@ unsigned menu_displaylist_build_list(
{ {
unsigned i; unsigned i;
unsigned count = 0; unsigned count = 0;
uint32_t flags = runloop_get_flags();
switch (type) switch (type)
{ {
@ -9203,8 +9207,8 @@ unsigned menu_displaylist_build_list(
} }
#ifdef HAVE_RUNAHEAD #ifdef HAVE_RUNAHEAD
if (retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL) && if ( (flags & RUNLOOP_FLAG_CORE_RUNNING)
!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) && !retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
runahead_supported = core_info_current_supports_runahead(); runahead_supported = core_info_current_supports_runahead();
if (runahead_supported) if (runahead_supported)
@ -10194,8 +10198,8 @@ unsigned menu_displaylist_build_list(
}; };
#ifdef HAVE_REWIND #ifdef HAVE_REWIND
if (retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL) && if ( (flags & RUNLOOP_FLAG_CORE_RUNNING)
!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) && !retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
rewind_supported = core_info_current_supports_rewind(); rewind_supported = core_info_current_supports_rewind();
if (rewind_supported) if (rewind_supported)
@ -13548,8 +13552,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
#if defined(HAVE_RGUI) || defined(HAVE_MATERIALUI) || defined(HAVE_OZONE) || defined(HAVE_XMB) #if defined(HAVE_RGUI) || defined(HAVE_MATERIALUI) || defined(HAVE_OZONE) || defined(HAVE_XMB)
const char *menu_ident = menu_driver_ident(); const char *menu_ident = menu_driver_ident();
#endif #endif
uint32_t flags = runloop_get_flags();
if (retroarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL)) if (flags & RUNLOOP_FLAG_CORE_RUNNING)
{ {
if (!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) if (!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list, if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list,

View File

@ -6680,7 +6680,8 @@ void menu_driver_toggle(
bool pause_libretro = false; bool pause_libretro = false;
bool audio_enable_menu = false; bool audio_enable_menu = false;
runloop_state_t *runloop_st = runloop_state_get_ptr(); runloop_state_t *runloop_st = runloop_state_get_ptr();
bool runloop_shutdown_initiated = runloop_st->shutdown_initiated; bool runloop_shutdown_initiated = runloop_st->flags &
RUNLOOP_FLAG_SHUTDOWN_INITIATED;
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
bool input_overlay_hide_in_menu = false; bool input_overlay_hide_in_menu = false;
bool input_overlay_enable = false; bool input_overlay_enable = false;

View File

@ -1755,8 +1755,8 @@ bool command_event(enum event_command cmd, void *data)
break; break;
#if defined(HAVE_RUNAHEAD) && (defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)) #if defined(HAVE_RUNAHEAD) && (defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB))
case CMD_EVENT_LOAD_SECOND_CORE: case CMD_EVENT_LOAD_SECOND_CORE:
if (!runloop_st->core_running || if (!(runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING) ||
!runloop_st->runahead_secondary_core_available) !(runloop_st->runahead_secondary_core_available))
return false; return false;
if (runloop_st->secondary_lib_handle) if (runloop_st->secondary_lib_handle)
return true; return true;
@ -1885,7 +1885,7 @@ bool command_event(enum event_command cmd, void *data)
rarch_system_info_t *sys_info = &runloop_st->system; rarch_system_info_t *sys_info = &runloop_st->system;
uint8_t flags = content_get_flags(); uint8_t flags = content_get_flags();
runloop_st->core_running = false; runloop_st->flags &= ~RUNLOOP_FLAG_CORE_RUNNING;
/* The platform that uses ram_state_save calls it when the content /* The platform that uses ram_state_save calls it when the content
* ends and writes it to a file */ * ends and writes it to a file */
@ -2082,7 +2082,12 @@ bool command_event(enum event_command cmd, void *data)
&& !netplay_driver_ctl( && !netplay_driver_ctl(
RARCH_NETPLAY_CTL_IS_ENABLED, NULL)) RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
#endif #endif
runloop_st->autosave = autosave_init(); {
if (autosave_init())
runloop_st->flags |= RUNLOOP_FLAG_AUTOSAVE;
else
runloop_st->flags &= ~RUNLOOP_FLAG_AUTOSAVE;
}
} }
#endif #endif
break; break;
@ -2092,7 +2097,8 @@ bool command_event(enum event_command cmd, void *data)
return false; return false;
break; break;
case CMD_EVENT_AUDIO_START: case CMD_EVENT_AUDIO_START:
if (!audio_driver_start(runloop_st->shutdown_initiated)) if (!audio_driver_start(runloop_st->flags &
RUNLOOP_FLAG_SHUTDOWN_INITIATED))
return false; return false;
break; break;
case CMD_EVENT_AUDIO_MUTE_TOGGLE: case CMD_EVENT_AUDIO_MUTE_TOGGLE:
@ -3616,8 +3622,7 @@ static void global_free(struct rarch_state *p_rarch)
runloop_st->flags &= ~( runloop_st->flags &= ~(
RUNLOOP_FLAG_IS_SRAM_LOAD_DISABLED RUNLOOP_FLAG_IS_SRAM_LOAD_DISABLED
| RUNLOOP_FLAG_IS_SRAM_SAVE_DISABLED | RUNLOOP_FLAG_IS_SRAM_SAVE_DISABLED
| RUNLOOP_FLAG_USE_SRAM | RUNLOOP_FLAG_USE_SRAM);
);
#ifdef HAVE_PATCH #ifdef HAVE_PATCH
p_rarch->flags &= ~( p_rarch->flags &= ~(
RARCH_FLAGS_BPS_PREF RARCH_FLAGS_BPS_PREF
@ -3631,8 +3636,7 @@ static void global_free(struct rarch_state *p_rarch)
runloop_st->flags &= ~(RUNLOOP_FLAG_OVERRIDES_ACTIVE runloop_st->flags &= ~(RUNLOOP_FLAG_OVERRIDES_ACTIVE
| RUNLOOP_FLAG_REMAPS_CORE_ACTIVE | RUNLOOP_FLAG_REMAPS_CORE_ACTIVE
| RUNLOOP_FLAG_REMAPS_GAME_ACTIVE | RUNLOOP_FLAG_REMAPS_GAME_ACTIVE
| RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE | RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE);
);
#endif #endif
runloop_st->current_core.has_set_input_descriptors = false; runloop_st->current_core.has_set_input_descriptors = false;
@ -5586,8 +5590,6 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
{ {
case RARCH_CTL_HAS_SET_SUBSYSTEMS: case RARCH_CTL_HAS_SET_SUBSYSTEMS:
return runloop_st->current_core.has_set_subsystems; return runloop_st->current_core.has_set_subsystems;
case RARCH_CTL_CORE_IS_RUNNING:
return runloop_st->core_running;
#ifdef HAVE_BSV_MOVIE #ifdef HAVE_BSV_MOVIE
case RARCH_CTL_BSV_MOVIE_IS_INITED: case RARCH_CTL_BSV_MOVIE_IS_INITED:
return (input_state_get_ptr()->bsv_movie_state_handle != NULL); return (input_state_get_ptr()->bsv_movie_state_handle != NULL);
@ -5631,11 +5633,11 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
#if defined(HAVE_RUNAHEAD) && (defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)) #if defined(HAVE_RUNAHEAD) && (defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB))
case RARCH_CTL_IS_SECOND_CORE_AVAILABLE: case RARCH_CTL_IS_SECOND_CORE_AVAILABLE:
return return
runloop_st->core_running (runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING)
&& runloop_st->runahead_secondary_core_available; && (runloop_st->runahead_secondary_core_available);
case RARCH_CTL_IS_SECOND_CORE_LOADED: case RARCH_CTL_IS_SECOND_CORE_LOADED:
return return
runloop_st->core_running (runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING)
&& (runloop_st->secondary_lib_handle != NULL); && (runloop_st->secondary_lib_handle != NULL);
#endif #endif
case RARCH_CTL_HAS_SET_USERNAME: case RARCH_CTL_HAS_SET_USERNAME:
@ -5756,14 +5758,6 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
| RUNLOOP_FLAG_REMAPS_GAME_ACTIVE); | RUNLOOP_FLAG_REMAPS_GAME_ACTIVE);
runloop_st->flags |= RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE; runloop_st->flags |= RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE;
break; break;
case RARCH_CTL_IS_OVERRIDES_ACTIVE:
return ((runloop_st->flags & RUNLOOP_FLAG_OVERRIDES_ACTIVE) > 0);
case RARCH_CTL_IS_REMAPS_CORE_ACTIVE:
return ((runloop_st->flags & RUNLOOP_FLAG_REMAPS_CORE_ACTIVE) > 0);
case RARCH_CTL_IS_REMAPS_GAME_ACTIVE:
return ((runloop_st->flags & RUNLOOP_FLAG_REMAPS_GAME_ACTIVE) > 0);
case RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE:
return ((runloop_st->flags & RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE) > 0);
#endif #endif
case RARCH_CTL_SET_MISSING_BIOS: case RARCH_CTL_SET_MISSING_BIOS:
runloop_st->missing_bios = true; runloop_st->missing_bios = true;
@ -5773,10 +5767,6 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
break; break;
case RARCH_CTL_IS_MISSING_BIOS: case RARCH_CTL_IS_MISSING_BIOS:
return runloop_st->missing_bios; return runloop_st->missing_bios;
case RARCH_CTL_IS_GAME_OPTIONS_ACTIVE:
return ((runloop_st->flags & RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE) > 0);
case RARCH_CTL_IS_FOLDER_OPTIONS_ACTIVE:
return ((runloop_st->flags & RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE) > 0);
case RARCH_CTL_GET_PERFCNT: case RARCH_CTL_GET_PERFCNT:
{ {
bool **perfcnt = (bool**)data; bool **perfcnt = (bool**)data;
@ -5811,7 +5801,7 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
#ifdef HAVE_CONFIGFILE #ifdef HAVE_CONFIGFILE
runloop_st->flags &= ~RUNLOOP_FLAG_OVERRIDES_ACTIVE; runloop_st->flags &= ~RUNLOOP_FLAG_OVERRIDES_ACTIVE;
#endif #endif
runloop_st->autosave = false; runloop_st->flags &= ~RUNLOOP_FLAG_AUTOSAVE;
runloop_frame_time_free(); runloop_frame_time_free();
runloop_audio_buffer_status_free(); runloop_audio_buffer_status_free();
input_game_focus_free(); input_game_focus_free();
@ -5843,7 +5833,7 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
case RARCH_CTL_IS_PAUSED: case RARCH_CTL_IS_PAUSED:
return runloop_st->paused; return runloop_st->paused;
case RARCH_CTL_SET_SHUTDOWN: case RARCH_CTL_SET_SHUTDOWN:
runloop_st->shutdown_initiated = true; runloop_st->flags |= RUNLOOP_FLAG_SHUTDOWN_INITIATED;
break; break;
case RARCH_CTL_CORE_OPTION_PREV: case RARCH_CTL_CORE_OPTION_PREV:
/* /*
@ -5871,8 +5861,6 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
*idx, 1, true); *idx, 1, true);
} }
break; break;
case RARCH_CTL_NONE: case RARCH_CTL_NONE:
default: default:
return false; return false;
@ -6206,7 +6194,7 @@ bool retroarch_main_quit(void)
if (video_st->video_refresh_rate_original) if (video_st->video_refresh_rate_original)
video_display_server_restore_refresh_rate(); video_display_server_restore_refresh_rate();
if (!runloop_st->shutdown_initiated) if (!(runloop_st->flags & RUNLOOP_FLAG_SHUTDOWN_INITIATED))
{ {
command_event_save_auto_state( command_event_save_auto_state(
settings->bools.savestate_auto_save, settings->bools.savestate_auto_save,
@ -6242,7 +6230,7 @@ bool retroarch_main_quit(void)
#endif #endif
} }
runloop_st->shutdown_initiated = true; runloop_st->flags |= RUNLOOP_FLAG_SHUTDOWN_INITIATED;
#ifdef HAVE_MENU #ifdef HAVE_MENU
retroarch_menu_running_finished(true); retroarch_menu_running_finished(true);
#endif #endif

View File

@ -87,15 +87,8 @@ enum rarch_ctl_state
RARCH_CTL_SET_WINDOWED_SCALE, RARCH_CTL_SET_WINDOWED_SCALE,
#ifdef HAVE_CONFIGFILE #ifdef HAVE_CONFIGFILE
RARCH_CTL_IS_OVERRIDES_ACTIVE,
RARCH_CTL_IS_REMAPS_CORE_ACTIVE,
RARCH_CTL_SET_REMAPS_CORE_ACTIVE, RARCH_CTL_SET_REMAPS_CORE_ACTIVE,
RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE,
RARCH_CTL_SET_REMAPS_CONTENT_DIR_ACTIVE, RARCH_CTL_SET_REMAPS_CONTENT_DIR_ACTIVE,
RARCH_CTL_IS_REMAPS_GAME_ACTIVE,
RARCH_CTL_SET_REMAPS_GAME_ACTIVE, RARCH_CTL_SET_REMAPS_GAME_ACTIVE,
#endif #endif
@ -103,9 +96,6 @@ enum rarch_ctl_state
RARCH_CTL_SET_MISSING_BIOS, RARCH_CTL_SET_MISSING_BIOS,
RARCH_CTL_UNSET_MISSING_BIOS, RARCH_CTL_UNSET_MISSING_BIOS,
RARCH_CTL_IS_GAME_OPTIONS_ACTIVE,
RARCH_CTL_IS_FOLDER_OPTIONS_ACTIVE,
RARCH_CTL_IS_PAUSED, RARCH_CTL_IS_PAUSED,
RARCH_CTL_SET_PAUSED, RARCH_CTL_SET_PAUSED,
@ -127,7 +117,6 @@ enum rarch_ctl_state
RARCH_CTL_CORE_OPTION_PREV, RARCH_CTL_CORE_OPTION_PREV,
RARCH_CTL_CORE_OPTION_NEXT, RARCH_CTL_CORE_OPTION_NEXT,
RARCH_CTL_CORE_OPTION_UPDATE_DISPLAY, RARCH_CTL_CORE_OPTION_UPDATE_DISPLAY,
RARCH_CTL_CORE_IS_RUNNING,
/* BSV Movie */ /* BSV Movie */
RARCH_CTL_BSV_MOVIE_IS_INITED RARCH_CTL_BSV_MOVIE_IS_INITED

View File

@ -1913,8 +1913,8 @@ bool runloop_environment_cb(unsigned cmd, void *data)
* requests a shutdown event */ * requests a shutdown event */
RARCH_LOG("[Environ]: SHUTDOWN.\n"); RARCH_LOG("[Environ]: SHUTDOWN.\n");
runloop_st->shutdown_initiated = true; runloop_st->flags |= RUNLOOP_FLAG_CORE_SHUTDOWN_INITIATED
runloop_st->core_shutdown_initiated = true; | RUNLOOP_FLAG_SHUTDOWN_INITIATED;
#ifdef HAVE_MENU #ifdef HAVE_MENU
/* Ensure that menu stack is flushed appropriately /* Ensure that menu stack is flushed appropriately
* after the core has stopped running */ * after the core has stopped running */
@ -5609,7 +5609,7 @@ bool runloop_event_init_core(
if (!event_init_content(settings, input_st)) if (!event_init_content(settings, input_st))
{ {
runloop_st->core_running = false; runloop_st->flags &= ~RUNLOOP_FLAG_CORE_RUNNING;
return false; return false;
} }
@ -6757,11 +6757,11 @@ MENU_ST_FLAG_IS_BINDING;
if (runloop_exec) if (runloop_exec)
runloop_exec = false; runloop_exec = false;
if (runloop_st->core_shutdown_initiated) if (runloop_st->flags & RUNLOOP_FLAG_CORE_SHUTDOWN_INITIATED)
{ {
bool load_dummy_core = false; bool load_dummy_core = false;
runloop_st->core_shutdown_initiated = false; runloop_st->flags &= ~RUNLOOP_FLAG_CORE_SHUTDOWN_INITIATED;
/* Check whether dummy core should be loaded /* Check whether dummy core should be loaded
* instead of exiting RetroArch completely * instead of exiting RetroArch completely
@ -6769,14 +6769,14 @@ MENU_ST_FLAG_IS_BINDING;
if (settings->bools.load_dummy_on_core_shutdown) if (settings->bools.load_dummy_on_core_shutdown)
{ {
load_dummy_core = true; load_dummy_core = true;
runloop_st->shutdown_initiated = false; runloop_st->flags &= ~RUNLOOP_FLAG_SHUTDOWN_INITIATED;
} }
/* Unload current core, and load dummy if /* Unload current core, and load dummy if
* required */ * required */
if (!command_event(CMD_EVENT_UNLOAD_CORE, &load_dummy_core)) if (!command_event(CMD_EVENT_UNLOAD_CORE, &load_dummy_core))
{ {
runloop_st->shutdown_initiated = true; runloop_st->flags |= RUNLOOP_FLAG_SHUTDOWN_INITIATED;
quit_runloop = true; quit_runloop = true;
} }
@ -6786,7 +6786,7 @@ MENU_ST_FLAG_IS_BINDING;
else else
quit_runloop = true; quit_runloop = true;
runloop_st->core_running = false; runloop_st->flags &= ~RUNLOOP_FLAG_CORE_RUNNING;
if (quit_runloop) if (quit_runloop)
{ {
@ -7748,7 +7748,7 @@ int runloop_iterate(void)
{ {
case RUNLOOP_STATE_QUIT: case RUNLOOP_STATE_QUIT:
runloop_st->frame_limit_last_time = 0.0; runloop_st->frame_limit_last_time = 0.0;
runloop_st->core_running = false; runloop_st->flags &= ~RUNLOOP_FLAG_CORE_RUNNING;
command_event(CMD_EVENT_QUIT, NULL); command_event(CMD_EVENT_QUIT, NULL);
return -1; return -1;
case RUNLOOP_STATE_POLLED_AND_SLEEP: case RUNLOOP_STATE_POLLED_AND_SLEEP:
@ -7779,12 +7779,12 @@ int runloop_iterate(void)
#endif #endif
return 0; return 0;
case RUNLOOP_STATE_ITERATE: case RUNLOOP_STATE_ITERATE:
runloop_st->core_running = true; runloop_st->flags |= RUNLOOP_FLAG_CORE_RUNNING;
break; break;
} }
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
if (runloop_st->autosave) if (runloop_st->flags & RUNLOOP_FLAG_AUTOSAVE)
autosave_lock(); autosave_lock();
#endif #endif
@ -8015,7 +8015,7 @@ int runloop_iterate(void)
#endif #endif
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
if (runloop_st->autosave) if (runloop_st->flags & RUNLOOP_FLAG_AUTOSAVE)
autosave_unlock(); autosave_unlock();
#endif #endif

View File

@ -147,7 +147,11 @@ enum runloop_flags
RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE = (1 << 11), RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE = (1 << 11),
RUNLOOP_FLAG_REMAPS_CORE_ACTIVE = (1 << 12), RUNLOOP_FLAG_REMAPS_CORE_ACTIVE = (1 << 12),
RUNLOOP_FLAG_REMAPS_GAME_ACTIVE = (1 << 13), RUNLOOP_FLAG_REMAPS_GAME_ACTIVE = (1 << 13),
RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE = (1 << 14) RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE = (1 << 14),
RUNLOOP_FLAG_SHUTDOWN_INITIATED = (1 << 15),
RUNLOOP_FLAG_CORE_SHUTDOWN_INITIATED = (1 << 16),
RUNLOOP_FLAG_CORE_RUNNING = (1 << 17),
RUNLOOP_FLAG_AUTOSAVE = (1 << 18)
}; };
struct runloop struct runloop
@ -289,11 +293,7 @@ struct runloop
bool focused; bool focused;
bool slowmotion; bool slowmotion;
bool fastmotion; bool fastmotion;
bool shutdown_initiated;
bool core_shutdown_initiated;
bool core_running;
bool perfcnt_enable; bool perfcnt_enable;
bool autosave;
#ifdef HAVE_RUNAHEAD #ifdef HAVE_RUNAHEAD
bool has_variable_update; bool has_variable_update;
bool input_is_dirty; bool input_is_dirty;
@ -321,7 +321,7 @@ input_st->bsv_movie_state.eof_exit)
* d) Video driver no longer alive. * d) Video driver no longer alive.
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better) * e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
*/ */
#define RUNLOOP_TIME_TO_EXIT(quit_key_pressed) (runloop_state.shutdown_initiated || quit_key_pressed || !is_alive BSV_MOVIE_IS_EOF() || ((runloop_state.max_frames != 0) && (frame_count >= runloop_state.max_frames)) || runloop_exec) #define RUNLOOP_TIME_TO_EXIT(quit_key_pressed) ((runloop_state.flags & RUNLOOP_FLAG_SHUTDOWN_INITIATED) || quit_key_pressed || !is_alive BSV_MOVIE_IS_EOF() || ((runloop_state.max_frames != 0) && (frame_count >= runloop_state.max_frames)) || runloop_exec)
RETRO_BEGIN_DECLS RETRO_BEGIN_DECLS

View File

@ -1121,10 +1121,11 @@ void CoreOptionsDialog::buildLayout()
if (!contentLabel.isEmpty()) if (!contentLabel.isEmpty())
{ {
if (!retroarch_ctl(RARCH_CTL_IS_GAME_OPTIONS_ACTIVE, NULL)) uint32_t flags = runloop_get_flags();
label = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_CREATE); if (flags & RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE)
else
label = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_IN_USE); label = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_IN_USE);
else
label = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_CREATE);
if (!label.isEmpty()) if (!label.isEmpty())
{ {