diff --git a/configuration.c b/configuration.c index 490263a7e3..b3cb84050d 100644 --- a/configuration.c +++ b/configuration.c @@ -1768,7 +1768,7 @@ static bool config_load_file(const char *path, bool set_defaults) config_get_path(conf, "joypad_autoconfig_dir", settings->input.autoconfig_dir, sizeof(settings->input.autoconfig_dir)); - if (!global->has_set.username) + if (!rarch_ctl(RARCH_CTL_HAS_SET_USERNAME, NULL)) config_get_path(conf, "netplay_nickname", settings->username, sizeof(settings->username)); CONFIG_GET_INT_BASE(conf, settings, user_language, "user_language"); #ifdef HAVE_NETPLAY diff --git a/retroarch.c b/retroarch.c index 04041efa06..092411b8ea 100644 --- a/retroarch.c +++ b/retroarch.c @@ -689,7 +689,9 @@ static void parse_input(int argc, char *argv[]) global->has_set.verbosity = false; global->has_set.netplay_mode = false; - global->has_set.username = false; + + rarch_ctl(RARCH_CTL_USERNAME_UNSET, NULL); + global->has_set.netplay_ip_address = false; global->has_set.netplay_delay_frames = false; global->has_set.netplay_ip_port = false; @@ -945,7 +947,7 @@ static void parse_input(int argc, char *argv[]) #endif case RA_OPT_NICK: - global->has_set.username = true; + rarch_ctl(RARCH_CTL_USERNAME_SET, NULL); strlcpy(settings->username, optarg, sizeof(settings->username)); break; @@ -1364,6 +1366,7 @@ static void rarch_main_deinit(void) bool rarch_ctl(enum rarch_ctl_state state, void *data) { + static bool has_set_username = false; static bool rarch_is_inited = false; static bool rarch_error_on_init = false; static bool rarch_block_config_read = false; @@ -1391,6 +1394,14 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) return (current_core_type == CORE_TYPE_PLAIN); case RARCH_CTL_IS_DUMMY_CORE: return (current_core_type == CORE_TYPE_DUMMY); + case RARCH_CTL_USERNAME_SET: + has_set_username = true; + break; + case RARCH_CTL_USERNAME_UNSET: + has_set_username = false; + break; + case RARCH_CTL_HAS_SET_USERNAME: + return has_set_username; case RARCH_CTL_IS_INITED: return rarch_is_inited; case RARCH_CTL_UNSET_INITED: @@ -1403,6 +1414,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) { int flags = DRIVERS_CMD_ALL; + has_set_username = false; rarch_is_inited = false; rarch_error_on_init = false; rarch_block_config_read = false; diff --git a/retroarch.h b/retroarch.h index c58fb58944..6305227873 100644 --- a/retroarch.h +++ b/retroarch.h @@ -129,6 +129,12 @@ enum rarch_ctl_state RARCH_CTL_UNSET_ERROR_ON_INIT, + RARCH_CTL_HAS_SET_USERNAME, + + RARCH_CTL_USERNAME_SET, + + RARCH_CTL_USERNAME_UNSET, + RARCH_CTL_IS_ERROR_ON_INIT }; diff --git a/runloop.h b/runloop.h index 68b4b0a28a..29747212bf 100644 --- a/runloop.h +++ b/runloop.h @@ -186,13 +186,13 @@ typedef struct global { bool save_path; bool state_path; + bool verbosity; + bool libretro_device[MAX_USERS]; bool libretro; bool libretro_directory; - bool verbosity; bool netplay_mode; - bool username; bool netplay_ip_address; bool netplay_delay_frames; bool netplay_ip_port;