mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Create retroarch_get_flags and use it
This commit is contained in:
parent
abf8bdc660
commit
a153738bbd
@ -3330,6 +3330,7 @@ static bool config_load_file(global_t *global,
|
||||
struct config_array_setting *array_settings = NULL;
|
||||
struct config_path_setting *path_settings = NULL;
|
||||
config_file_t *conf = path ? config_file_new_from_path_to_string(path) : open_default_config_file();
|
||||
uint16_t rarch_flags = retroarch_get_flags();
|
||||
|
||||
tmp_str[0] = '\0';
|
||||
|
||||
@ -3399,7 +3400,7 @@ static bool config_load_file(global_t *global,
|
||||
|
||||
/* Overrides */
|
||||
|
||||
if (retroarch_ctl(RARCH_CTL_HAS_SET_USERNAME, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_HAS_SET_USERNAME)
|
||||
override_username = strdup(settings->paths.username);
|
||||
|
||||
/* Boolean settings */
|
||||
@ -3541,7 +3542,8 @@ static bool config_load_file(global_t *global,
|
||||
|
||||
/* Post-settings load */
|
||||
|
||||
if (retroarch_ctl(RARCH_CTL_HAS_SET_USERNAME, NULL) && override_username)
|
||||
if ( (rarch_flags & RARCH_FLAGS_HAS_SET_USERNAME)
|
||||
&& (override_username))
|
||||
{
|
||||
configuration_set_string(settings,
|
||||
settings->paths.username,
|
||||
|
33
retroarch.c
33
retroarch.c
@ -290,25 +290,6 @@ enum
|
||||
extern const bluetooth_driver_t *bluetooth_drivers[];
|
||||
#endif
|
||||
|
||||
|
||||
enum rarch_state_flags
|
||||
{
|
||||
RARCH_FLAGS_HAS_SET_USERNAME = (1 << 0),
|
||||
RARCH_FLAGS_HAS_SET_VERBOSITY = (1 << 1),
|
||||
RARCH_FLAGS_HAS_SET_LIBRETRO = (1 << 2),
|
||||
RARCH_FLAGS_HAS_SET_LIBRETRO_DIRECTORY = (1 << 3),
|
||||
RARCH_FLAGS_HAS_SET_SAVE_PATH = (1 << 4),
|
||||
RARCH_FLAGS_HAS_SET_STATE_PATH = (1 << 5),
|
||||
RARCH_FLAGS_HAS_SET_UPS_PREF = (1 << 6),
|
||||
RARCH_FLAGS_HAS_SET_BPS_PREF = (1 << 7),
|
||||
RARCH_FLAGS_HAS_SET_IPS_PREF = (1 << 8),
|
||||
RARCH_FLAGS_HAS_SET_LOG_TO_FILE = (1 << 9),
|
||||
RARCH_FLAGS_UPS_PREF = (1 << 10),
|
||||
RARCH_FLAGS_BPS_PREF = (1 << 11),
|
||||
RARCH_FLAGS_IPS_PREF = (1 << 12),
|
||||
RARCH_FLAGS_BLOCK_CONFIG_READ = (1 << 13)
|
||||
};
|
||||
|
||||
/* MAIN GLOBAL VARIABLES */
|
||||
struct rarch_state
|
||||
{
|
||||
@ -359,6 +340,12 @@ global_t *global_get_ptr(void)
|
||||
return &global_driver_st;
|
||||
}
|
||||
|
||||
uint16_t retroarch_get_flags(void)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
return p_rarch->flags;
|
||||
}
|
||||
|
||||
struct retro_perf_counter **retro_get_perf_counter_rarch(void)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
@ -5596,12 +5583,6 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
return (input_state_get_ptr()->bsv_movie_state_handle != NULL);
|
||||
#endif
|
||||
#ifdef HAVE_PATCH
|
||||
case RARCH_CTL_IS_BPS_PREF:
|
||||
return ((p_rarch->flags & RARCH_FLAGS_BPS_PREF) > 0);
|
||||
case RARCH_CTL_IS_UPS_PREF:
|
||||
return ((p_rarch->flags & RARCH_FLAGS_UPS_PREF) > 0);
|
||||
case RARCH_CTL_IS_IPS_PREF:
|
||||
return ((p_rarch->flags & RARCH_FLAGS_IPS_PREF) > 0);
|
||||
case RARCH_CTL_UNSET_BPS_PREF:
|
||||
p_rarch->flags &= ~RARCH_FLAGS_BPS_PREF;
|
||||
break;
|
||||
@ -5641,8 +5622,6 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
(runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING)
|
||||
&& (runloop_st->secondary_lib_handle != NULL);
|
||||
#endif
|
||||
case RARCH_CTL_HAS_SET_USERNAME:
|
||||
return ((p_rarch->flags & RARCH_FLAGS_HAS_SET_USERNAME) > 0);
|
||||
case RARCH_CTL_IS_INITED:
|
||||
return runloop_st->is_inited;
|
||||
case RARCH_CTL_MAIN_DEINIT:
|
||||
|
20
retroarch.h
20
retroarch.h
@ -195,6 +195,24 @@ typedef enum apple_view_type
|
||||
APPLE_VIEW_TYPE_METAL
|
||||
} apple_view_type_t;
|
||||
|
||||
enum rarch_state_flags
|
||||
{
|
||||
RARCH_FLAGS_HAS_SET_USERNAME = (1 << 0),
|
||||
RARCH_FLAGS_HAS_SET_VERBOSITY = (1 << 1),
|
||||
RARCH_FLAGS_HAS_SET_LIBRETRO = (1 << 2),
|
||||
RARCH_FLAGS_HAS_SET_LIBRETRO_DIRECTORY = (1 << 3),
|
||||
RARCH_FLAGS_HAS_SET_SAVE_PATH = (1 << 4),
|
||||
RARCH_FLAGS_HAS_SET_STATE_PATH = (1 << 5),
|
||||
RARCH_FLAGS_HAS_SET_UPS_PREF = (1 << 6),
|
||||
RARCH_FLAGS_HAS_SET_BPS_PREF = (1 << 7),
|
||||
RARCH_FLAGS_HAS_SET_IPS_PREF = (1 << 8),
|
||||
RARCH_FLAGS_HAS_SET_LOG_TO_FILE = (1 << 9),
|
||||
RARCH_FLAGS_UPS_PREF = (1 << 10),
|
||||
RARCH_FLAGS_BPS_PREF = (1 << 11),
|
||||
RARCH_FLAGS_IPS_PREF = (1 << 12),
|
||||
RARCH_FLAGS_BLOCK_CONFIG_READ = (1 << 13)
|
||||
};
|
||||
|
||||
bool retroarch_get_current_savestate_path(char *path, size_t len);
|
||||
|
||||
bool retroarch_get_entry_state_path(char *path, size_t len, unsigned slot);
|
||||
@ -208,6 +226,8 @@ bool retroarch_get_entry_state_path(char *path, size_t len, unsigned slot);
|
||||
**/
|
||||
void retroarch_fail(int error_code, const char *error);
|
||||
|
||||
uint16_t retroarch_get_flags(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -61,13 +61,8 @@ enum rarch_ctl_state
|
||||
RARCH_CTL_IS_SECOND_CORE_LOADED,
|
||||
#endif
|
||||
|
||||
RARCH_CTL_IS_BPS_PREF,
|
||||
RARCH_CTL_UNSET_BPS_PREF,
|
||||
|
||||
RARCH_CTL_IS_UPS_PREF,
|
||||
RARCH_CTL_UNSET_UPS_PREF,
|
||||
|
||||
RARCH_CTL_IS_IPS_PREF,
|
||||
RARCH_CTL_UNSET_IPS_PREF,
|
||||
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
@ -76,9 +71,6 @@ enum rarch_ctl_state
|
||||
RARCH_CTL_UNSET_BLOCK_CONFIG_READ,
|
||||
#endif
|
||||
|
||||
/* Username */
|
||||
RARCH_CTL_HAS_SET_USERNAME,
|
||||
|
||||
RARCH_CTL_HAS_SET_SUBSYSTEMS,
|
||||
|
||||
RARCH_CTL_SET_IDLE,
|
||||
|
@ -1921,6 +1921,7 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
|
||||
rarch_system_info_t *sys_info = &runloop_st->system;
|
||||
const char *path_dir_system = settings->paths.directory_system;
|
||||
bool check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
uint16_t rarch_flags = retroarch_get_flags();
|
||||
|
||||
if (!content_info)
|
||||
return false;
|
||||
@ -1930,11 +1931,11 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
|
||||
if (check_firmware_before_loading)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_CHECK_FW_BEFORE_LOADING;
|
||||
#ifdef HAVE_PATCH
|
||||
if (retroarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_IPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_IPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_BPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_BPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_UPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_UPS_PREF;
|
||||
if (runloop_st->flags & RUNLOOP_FLAG_PATCH_BLOCKED)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_PATCH_IS_BLOCKED;
|
||||
@ -2011,17 +2012,18 @@ bool task_push_load_content_from_playlist_from_menu(
|
||||
bool force_core_reload = settings->bools.always_reload_core_on_run_content;
|
||||
#endif
|
||||
bool check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
uint16_t rarch_flags = retroarch_get_flags();
|
||||
|
||||
content_ctx.flags = 0;
|
||||
|
||||
if (check_firmware_before_loading)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_CHECK_FW_BEFORE_LOADING;
|
||||
#ifdef HAVE_PATCH
|
||||
if (retroarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_IPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_IPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_BPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_BPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_UPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_UPS_PREF;
|
||||
if (runloop_st->flags & RUNLOOP_FLAG_PATCH_BLOCKED)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_PATCH_IS_BLOCKED;
|
||||
@ -2139,6 +2141,7 @@ end:
|
||||
|
||||
bool task_push_start_current_core(content_ctx_info_t *content_info)
|
||||
{
|
||||
uint16_t rarch_flags;
|
||||
content_information_ctx_t content_ctx;
|
||||
bool ret = true;
|
||||
content_state_t *p_content = content_state_get_ptr();
|
||||
@ -2150,16 +2153,17 @@ bool task_push_start_current_core(content_ctx_info_t *content_info)
|
||||
if (!content_info)
|
||||
return false;
|
||||
|
||||
content_ctx.flags = 0;
|
||||
rarch_flags = retroarch_get_flags();
|
||||
content_ctx.flags = 0;
|
||||
|
||||
if (check_firmware_before_loading)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_CHECK_FW_BEFORE_LOADING;
|
||||
#ifdef HAVE_PATCH
|
||||
if (retroarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_IPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_IPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_BPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_BPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_UPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_UPS_PREF;
|
||||
if (runloop_st->flags & RUNLOOP_FLAG_PATCH_BLOCKED)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_PATCH_IS_BLOCKED;
|
||||
@ -2362,8 +2366,8 @@ bool task_push_load_content_with_new_core_from_menu(
|
||||
retro_task_callback_t cb,
|
||||
void *user_data)
|
||||
{
|
||||
uint16_t rarch_flags;
|
||||
content_information_ctx_t content_ctx;
|
||||
|
||||
content_state_t *p_content = content_state_get_ptr();
|
||||
bool ret = true;
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -2384,16 +2388,17 @@ bool task_push_load_content_with_new_core_from_menu(
|
||||
type, cb, user_data);
|
||||
#endif
|
||||
|
||||
content_ctx.flags = 0;
|
||||
rarch_flags = retroarch_get_flags();
|
||||
content_ctx.flags = 0;
|
||||
|
||||
if (check_firmware_before_loading)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_CHECK_FW_BEFORE_LOADING;
|
||||
#ifdef HAVE_PATCH
|
||||
if (retroarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_IPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_IPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_BPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_BPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_UPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_UPS_PREF;
|
||||
if (runloop_st->flags & RUNLOOP_FLAG_PATCH_BLOCKED)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_PATCH_IS_BLOCKED;
|
||||
@ -2489,16 +2494,17 @@ static bool task_load_content_internal(
|
||||
const char *path_dir_system = settings->paths.directory_system;
|
||||
const char *path_dir_cache = settings->paths.directory_cache;
|
||||
|
||||
content_ctx.flags = 0;
|
||||
uint16_t rarch_flags = retroarch_get_flags();
|
||||
content_ctx.flags = 0;
|
||||
|
||||
if (check_firmware_before_loading)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_CHECK_FW_BEFORE_LOADING;
|
||||
#ifdef HAVE_PATCH
|
||||
if (retroarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_IPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_IPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_BPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_BPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_UPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_UPS_PREF;
|
||||
if (runloop_st->flags & RUNLOOP_FLAG_PATCH_BLOCKED)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_PATCH_IS_BLOCKED;
|
||||
@ -3024,6 +3030,7 @@ bool content_init(void)
|
||||
bool set_supports_no_game_enable = settings->bools.set_supports_no_game_enable;
|
||||
const char *path_dir_system = settings->paths.directory_system;
|
||||
const char *path_dir_cache = settings->paths.directory_cache;
|
||||
uint16_t rarch_flags = retroarch_get_flags();
|
||||
|
||||
content_file_list_free(p_content->content_list);
|
||||
p_content->content_list = NULL;
|
||||
@ -3033,11 +3040,11 @@ bool content_init(void)
|
||||
if (check_firmware_before_loading)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_CHECK_FW_BEFORE_LOADING;
|
||||
#ifdef HAVE_PATCH
|
||||
if (retroarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_IPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_IPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_BPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_BPS_PREF;
|
||||
if (retroarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL))
|
||||
if (rarch_flags & RARCH_FLAGS_UPS_PREF)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_IS_UPS_PREF;
|
||||
if (runloop_st->flags & RUNLOOP_FLAG_PATCH_BLOCKED)
|
||||
content_ctx.flags |= CONTENT_INFO_FLAG_PATCH_IS_BLOCKED;
|
||||
|
Loading…
x
Reference in New Issue
Block a user