diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index e28dbf4b2a..ce3aed705e 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -334,9 +334,8 @@ static void menu_common_entries_init(menu_handle_t *menu, unsigned menu_type) file_list_push(menu->selection_buf, "", "netplay_mode", MENU_SETTINGS_NETPLAY_MODE, 0); if ((current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "netplay_spectator_mode_enable"))) file_list_push(menu->selection_buf, "", "netplay_spectator_mode_enable", MENU_SETTINGS_NETPLAY_SPECTATOR_MODE_ENABLE, 0); -#ifdef HAVE_NETPLAY - file_list_push(menu->selection_buf, "Host IP Address", "", MENU_SETTINGS_NETPLAY_HOST_IP_ADDRESS, 0); -#endif + if ((current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "netplay_ip_address"))) + file_list_push(menu->selection_buf, "", "netplay_ip_address", MENU_SETTINGS_NETPLAY_HOST_IP_ADDRESS, 0); if ((current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "netplay_tcp_udp_port"))) file_list_push(menu->selection_buf, "", "netplay_tcp_udp_port", MENU_SETTINGS_NETPLAY_TCP_UDP_PORT, 0); if ((current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "netplay_delay_frames"))) @@ -3413,7 +3412,7 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t break; case MENU_SETTINGS_DRIVER_AUDIO_DEVICE: if (action == MENU_ACTION_OK) - menu_key_start_line(driver.menu, "Audio Device Name / IP: ", "audio_device", audio_device_callback); + menu_key_start_line(driver.menu, "Audio Device Name / IP: ", "audio_device", st_string_callback); else if (action == MENU_ACTION_START) *g_settings.audio.device = '\0'; break; @@ -3668,7 +3667,7 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t #ifdef HAVE_NETPLAY case MENU_SETTINGS_NETPLAY_HOST_IP_ADDRESS: if (action == MENU_ACTION_OK) - menu_key_start_line(driver.menu, "IP Address: ", "netplay_ip_address", netplay_ipaddress_callback); + menu_key_start_line(driver.menu, "IP Address: ", "netplay_ip_address", st_string_callback); else if (action == MENU_ACTION_START) *g_extern.netplay_server = '\0'; break; @@ -4030,11 +4029,6 @@ static void menu_common_setting_set_label(char *type_str, strlcpy(type_str, modes[g_settings.user_language], type_str_size); } break; -#ifdef HAVE_NETPLAY - case MENU_SETTINGS_NETPLAY_HOST_IP_ADDRESS: - strlcpy(type_str, g_extern.netplay_server, type_str_size); - break; -#endif default: *type_str = '\0'; *w = 0; diff --git a/frontend/menu/menu_input_line_cb.c b/frontend/menu/menu_input_line_cb.c index e976a2ad2c..017aa0c11e 100644 --- a/frontend/menu/menu_input_line_cb.c +++ b/frontend/menu/menu_input_line_cb.c @@ -99,27 +99,6 @@ void st_string_callback(void *userdata, const char *str) menu_key_end_line(menu); } -#ifdef HAVE_NETPLAY -void netplay_ipaddress_callback(void *userdata, const char *str) -{ - menu_handle_t *menu = (menu_handle_t*)userdata; - - if (str && *str) - strlcpy(g_extern.netplay_server, str, sizeof(g_extern.netplay_server)); - menu_key_end_line(menu); -} -#endif - - -void audio_device_callback(void *userdata, const char *str) -{ - menu_handle_t *menu = (menu_handle_t*)userdata; - - if (str && *str) - strlcpy(g_settings.audio.device, str, sizeof(g_settings.audio.device)); - menu_key_end_line(menu); -} - #ifdef HAVE_SHADER_MANAGER void preset_filename_callback(void *userdata, const char *str) { diff --git a/frontend/menu/menu_input_line_cb.h b/frontend/menu/menu_input_line_cb.h index 74c9fd4249..cbf980115f 100644 --- a/frontend/menu/menu_input_line_cb.h +++ b/frontend/menu/menu_input_line_cb.h @@ -28,8 +28,6 @@ void menu_key_start_line(void *data, const char *label, void st_uint_callback(void *userdata, const char *str); void st_string_callback(void *userdata, const char *str); -void netplay_ipaddress_callback(void *userdata, const char *str); -void audio_device_callback(void *userdata, const char *str); void preset_filename_callback(void *userdata, const char *str); #endif diff --git a/settings_data.c b/settings_data.c index 7271b530c7..bdb27bbbb2 100644 --- a/settings_data.c +++ b/settings_data.c @@ -1216,6 +1216,10 @@ static void general_read_handler(const void *data) *setting->value.boolean = g_settings.osk.enable; else if (!strcmp(setting->name, "user_language")) *setting->value.unsigned_integer = g_settings.user_language; + else if (!strcmp(setting->name, "netplay_nickname")) + strlcpy(setting->value.string, g_settings.username, setting->size); + else if (!strcmp(setting->name, "netplay_ip_address")) + strlcpy(setting->value.string, g_extern.netplay_server, setting->size); } static void general_write_handler(const void *data) @@ -1503,6 +1507,10 @@ static void general_write_handler(const void *data) strlcpy(g_settings.content_history_path, setting->value.string, sizeof(g_settings.content_history_path)); else if (!strcmp(setting->name, "video_filter_dir")) strlcpy(g_settings.video.filter_dir, setting->value.string, sizeof(g_settings.video.filter_dir)); + else if (!strcmp(setting->name, "netplay_nickname")) + strlcpy(g_settings.username, setting->value.string, sizeof(g_settings.username)); + else if (!strcmp(setting->name, "netplay_ip_address")) + strlcpy(g_extern.netplay_server, setting->value.string, sizeof(g_extern.netplay_server)); else if (!strcmp(setting->name, "audio_filter_dir")) strlcpy(g_settings.audio.filter_dir, setting->value.string, sizeof(g_settings.audio.filter_dir)); else if (!strcmp(setting->name, "video_shader_dir")) @@ -1861,6 +1869,7 @@ rarch_setting_t* setting_data_get_list(void) START_GROUP("Netplay Options") START_SUB_GROUP("State") CONFIG_BOOL(g_extern.netplay_enable, "netplay_enable", "Netplay Enable", false, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) + CONFIG_STRING(g_extern.netplay_server, "netplay_ip_address", "IP Address", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) CONFIG_BOOL(g_extern.netplay_is_client, "netplay_mode", "Netplay Client Enable", false, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) CONFIG_BOOL(g_extern.netplay_is_spectate, "netplay_spectator_mode_enable", "Netplay Spectator Enable", false, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) CONFIG_UINT(g_extern.netplay_sync_frames, "netplay_delay_frames", "Netplay Delay Frames", 0, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 10, 1, true, false)