mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-13 22:08:34 +00:00
Fix concurrency issue with global->verbose
This commit is contained in:
parent
f806e7b9c1
commit
d65a445acd
@ -625,7 +625,8 @@ bool network_cmd_send(const char *cmd_)
|
||||
const char *host = NULL;
|
||||
const char *port_ = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
bool old_verbose = global ? global->verbosity : false;
|
||||
bool *verbose = retro_main_verbosity();
|
||||
bool old_verbose = global ? *verbose : false;
|
||||
uint16_t port = DEFAULT_NETWORK_CMD_PORT;
|
||||
|
||||
if (!network_init())
|
||||
@ -634,7 +635,7 @@ bool network_cmd_send(const char *cmd_)
|
||||
if (!(command = strdup(cmd_)))
|
||||
return false;
|
||||
|
||||
global->verbosity = true;
|
||||
*verbose = true;
|
||||
|
||||
cmd = strtok_r(command, ";", &save);
|
||||
if (cmd)
|
||||
@ -661,7 +662,7 @@ bool network_cmd_send(const char *cmd_)
|
||||
ret = verify_command(cmd) && send_udp_packet(host, port, cmd);
|
||||
free(command);
|
||||
|
||||
global->verbosity = old_verbose;
|
||||
*verbose = old_verbose;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
@ -1176,6 +1176,7 @@ static void config_get_hex_base(config_file_t *conf, const char *key, unsigned *
|
||||
static bool config_load_file(const char *path, bool set_defaults)
|
||||
{
|
||||
unsigned i;
|
||||
bool tmp_bool;
|
||||
char *save = NULL;
|
||||
const char *extra_path = NULL;
|
||||
char tmp_str[PATH_MAX_LENGTH] = {0};
|
||||
@ -1537,7 +1538,14 @@ static bool config_load_file(const char *path, bool set_defaults)
|
||||
CONFIG_GET_INT_BASE(conf, settings, libretro_log_level, "libretro_log_level");
|
||||
|
||||
if (!global->has_set.verbosity)
|
||||
CONFIG_GET_BOOL_BASE(conf, global, verbosity, "log_verbosity");
|
||||
{
|
||||
if (config_get_bool(conf, "log_verbosity", &tmp_bool))
|
||||
{
|
||||
bool *verbose = retro_main_verbosity();
|
||||
if (verbose)
|
||||
*verbose = tmp_bool;
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG_GET_BOOL_BASE(conf, global, perfcnt_enable, "perfcnt_enable");
|
||||
|
||||
@ -2761,7 +2769,7 @@ bool config_save_file(const char *path)
|
||||
config_set_bool(conf, "sort_savestates_enable",
|
||||
settings->sort_savestates_enable);
|
||||
config_set_int(conf, "libretro_log_level", settings->libretro_log_level);
|
||||
config_set_bool(conf, "log_verbosity", global->verbosity);
|
||||
config_set_bool(conf, "log_verbosity", *retro_main_verbosity());
|
||||
config_set_bool(conf, "perfcnt_enable", global->perfcnt_enable);
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
|
@ -65,21 +65,18 @@ FILE *retro_main_log_file(void);
|
||||
#define PROGRAM_NAME "N/A"
|
||||
#endif
|
||||
|
||||
#if defined(RARCH_INTERNAL) && !defined(ANDROID)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
static INLINE bool RARCH_LOG_VERBOSE(void)
|
||||
{
|
||||
bool *verbose = NULL;
|
||||
#ifdef RARCH_INTERNAL
|
||||
extern bool *retro_main_verbosity(void);
|
||||
verbose = retro_main_verbosity();
|
||||
#endif
|
||||
bool retro_main_verbosity(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
if (!verbose)
|
||||
return false;
|
||||
return *verbose;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define RARCH_LOG_VERBOSE (retro_main_verbosity())
|
||||
#else
|
||||
#define RARCH_LOG_VERBOSE (true)
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_IPHONE && defined(RARCH_INTERNAL) && !TARGET_IPHONE_SIMULATOR
|
||||
static aslclient asl_client;
|
||||
@ -178,7 +175,7 @@ void logger_send_v(const char *__format, va_list args);
|
||||
#else
|
||||
static INLINE void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
|
||||
{
|
||||
if (!RARCH_LOG_VERBOSE)
|
||||
if (!RARCH_LOG_VERBOSE())
|
||||
return;
|
||||
#if TARGET_OS_IPHONE && defined(RARCH_INTERNAL)
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
@ -226,7 +223,7 @@ static INLINE void RARCH_LOG(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (!RARCH_LOG_VERBOSE)
|
||||
if (!RARCH_LOG_VERBOSE())
|
||||
return;
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
@ -42,7 +42,7 @@ static void menu_environment_get(int *argc, char *argv[],
|
||||
|
||||
wrap_args->no_content = menu->load_no_content;
|
||||
if (!global->has_set.verbosity)
|
||||
wrap_args->verbose = global->verbosity;
|
||||
wrap_args->verbose = *retro_main_verbosity();
|
||||
|
||||
wrap_args->config_path = *global->path.config ? global->path.config : NULL;
|
||||
wrap_args->sram_path = *global->dir.savefile ? global->dir.savefile : NULL;
|
||||
|
@ -2847,8 +2847,12 @@ void general_write_handler(void *data)
|
||||
settings->input.joypad_map[4] = *setting->value.integer;
|
||||
break;
|
||||
case MENU_LABEL_LOG_VERBOSITY:
|
||||
global->verbosity = *setting->value.boolean;
|
||||
global->has_set.verbosity = *setting->value.boolean;
|
||||
{
|
||||
bool *verbose = retro_main_verbosity();
|
||||
|
||||
*verbose = *setting->value.boolean;
|
||||
global->has_set.verbosity = *setting->value.boolean;
|
||||
}
|
||||
break;
|
||||
case MENU_LABEL_VIDEO_SMOOTH:
|
||||
video_driver_set_filtering(1, settings->video.smooth);
|
||||
@ -3895,7 +3899,7 @@ static bool setting_append_list_logging_options(
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&global->verbosity,
|
||||
retro_main_verbosity(),
|
||||
menu_hash_to_str(MENU_LABEL_LOG_VERBOSITY),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_LOG_VERBOSITY),
|
||||
false,
|
||||
|
13
retroarch.c
13
retroarch.c
@ -680,8 +680,12 @@ static void parse_input(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
global->verbosity = true;
|
||||
global->has_set.verbosity = true;
|
||||
{
|
||||
bool *verbosity = retro_main_verbosity();
|
||||
if (verbosity)
|
||||
*verbosity = true;
|
||||
global->has_set.verbosity = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
@ -1125,6 +1129,7 @@ void rarch_init_system_av_info(void)
|
||||
int rarch_main_init(int argc, char *argv[])
|
||||
{
|
||||
int sjlj_ret;
|
||||
bool *verbosity = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
init_state();
|
||||
@ -1138,7 +1143,9 @@ int rarch_main_init(int argc, char *argv[])
|
||||
global->log_file = stderr;
|
||||
parse_input(argc, argv);
|
||||
|
||||
if (global->verbosity)
|
||||
verbosity = retro_main_verbosity();
|
||||
|
||||
if (verbosity && *verbosity)
|
||||
{
|
||||
char str[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
|
@ -49,6 +49,7 @@ static struct global g_extern;
|
||||
static bool main_is_idle;
|
||||
static bool main_is_paused;
|
||||
static bool main_is_slowmotion;
|
||||
static bool main_verbosity;
|
||||
|
||||
static unsigned main_max_frames;
|
||||
|
||||
@ -766,12 +767,9 @@ static void rarch_main_iterate_linefeed_overlay(driver_t *driver,
|
||||
}
|
||||
#endif
|
||||
|
||||
bool retro_main_verbosity(void)
|
||||
bool *retro_main_verbosity(void)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (!global)
|
||||
return false;
|
||||
return global->verbosity;
|
||||
return &main_verbosity;
|
||||
}
|
||||
|
||||
FILE *retro_main_log_file(void)
|
||||
|
@ -111,7 +111,6 @@ typedef struct rarch_resolution
|
||||
|
||||
typedef struct global
|
||||
{
|
||||
bool verbosity;
|
||||
bool perfcnt_enable;
|
||||
bool force_fullscreen;
|
||||
bool core_shutdown_initiated;
|
||||
@ -355,7 +354,7 @@ void rarch_main_msg_queue_free(void);
|
||||
|
||||
void rarch_main_msg_queue_init(void);
|
||||
|
||||
bool rarch_main_verbosity(void);
|
||||
bool *retro_main_verbosity(void);
|
||||
|
||||
FILE *retro_main_log_file(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user