Revert "Revert "Backport netplay changes from forum member""

This reverts commit 38a6b9f086.
This commit is contained in:
twinaphex 2021-11-05 18:52:56 +01:00
parent 38a6b9f086
commit 7f33a03423
13 changed files with 641 additions and 402 deletions

View file

@ -1019,6 +1019,10 @@ static const bool audio_enable_menu_bgm = false;
#define DEFAULT_NOTIFICATION_SHOW_REFRESH_RATE true
#endif
#ifdef HAVE_NETWORKING
#define DEFAULT_NOTIFICATION_SHOW_NETPLAY_EXTRA false
#endif
/* Output samplerate. */
#ifdef GEKKO
#define DEFAULT_OUTPUT_RATE 32000
@ -1170,6 +1174,7 @@ static const bool netplay_use_mitm_server = false;
#define DEFAULT_NETPLAY_MITM_SERVER "nyc"
#ifdef HAVE_NETWORKING
static const unsigned netplay_max_connections = 3;
static const unsigned netplay_share_digital = RARCH_NETPLAY_SHARE_DIGITAL_NO_PREFERENCE;
static const unsigned netplay_share_analog = RARCH_NETPLAY_SHARE_ANALOG_NO_PREFERENCE;

View file

@ -1702,6 +1702,9 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("notification_show_screenshot", &settings->bools.notification_show_screenshot, true, DEFAULT_NOTIFICATION_SHOW_SCREENSHOT, false);
#endif
SETTING_BOOL("notification_show_refresh_rate", &settings->bools.notification_show_refresh_rate, true, DEFAULT_NOTIFICATION_SHOW_REFRESH_RATE, false);
#ifdef HAVE_NETWORKING
SETTING_BOOL("notification_show_netplay_extra", &settings->bools.notification_show_netplay_extra, true, DEFAULT_NOTIFICATION_SHOW_NETPLAY_EXTRA, false);
#endif
SETTING_BOOL("menu_widget_scale_auto", &settings->bools.menu_widget_scale_auto, true, DEFAULT_MENU_WIDGET_SCALE_AUTO, false);
SETTING_BOOL("audio_enable_menu", &settings->bools.audio_enable_menu, true, audio_enable_menu, false);
SETTING_BOOL("audio_enable_menu_ok", &settings->bools.audio_enable_menu_ok, true, audio_enable_menu_ok, false);
@ -2200,6 +2203,7 @@ static struct config_uint_setting *populate_settings_uint(
#endif
#ifdef HAVE_NETWORKING
SETTING_UINT("netplay_ip_port", &settings->uints.netplay_port, true, RARCH_DEFAULT_PORT, false);
SETTING_UINT("netplay_max_connections", &settings->uints.netplay_max_connections, true, netplay_max_connections, false);
SETTING_OVERRIDE(RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT);
SETTING_UINT("netplay_input_latency_frames_min",&settings->uints.netplay_input_latency_frames_min, true, 0, false);
SETTING_UINT("netplay_input_latency_frames_range",&settings->uints.netplay_input_latency_frames_range, true, 0, false);

View file

@ -200,6 +200,7 @@ typedef struct settings
unsigned input_max_users;
unsigned netplay_port;
unsigned netplay_max_connections;
unsigned netplay_input_latency_frames_min;
unsigned netplay_input_latency_frames_range;
unsigned netplay_share_digital;
@ -624,6 +625,7 @@ typedef struct settings
bool notification_show_screenshot;
#endif
bool notification_show_refresh_rate;
bool notification_show_netplay_extra;
bool menu_widget_scale_auto;
bool menu_show_start_screen;
bool menu_pause_libretro;

View file

@ -3945,6 +3945,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_REFRESH_RATE,
"Muestra un mensaje en pantalla al cambiar la frecuencia de actualización."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_NETPLAY_EXTRA,
"Notificaciones extras de netplay"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA,
"Muestra mensajes no esenciales de netplay en la pantalla."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH,
"Fuente de notificaciones"
@ -5142,6 +5150,10 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_NETPLAY_TCP_UDP_PORT,
"Indica el puerto del servidor a conectar. Puede ser TCP o UDP."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_MAX_CONNECTIONS,
"Max Conexiones Simultáneas"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_PASSWORD,
"Contraseña del servidor"

View file

@ -1974,6 +1974,10 @@ MSG_HASH(
MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT,
"netplay_tcp_udp_port"
)
MSG_HASH(
MENU_ENUM_LABEL_NETPLAY_MAX_CONNECTIONS,
"netplay_max_connections"
)
MSG_HASH(
MENU_ENUM_LABEL_NETPLAY_LAN_SCAN_SETTINGS,
"Search for and connect to netplay hosts on the local network."
@ -4768,6 +4772,10 @@ MSG_HASH(
MENU_ENUM_LABEL_NOTIFICATION_SHOW_REFRESH_RATE,
"notification_show_refresh_rate"
)
MSG_HASH(
MENU_ENUM_LABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA,
"notification_show_netplay_extra"
)
MSG_HASH(
MENU_ENUM_LABEL_VIDEO_SHADERS_ENABLE,
"video_shader_enable"

View file

@ -3921,6 +3921,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_REFRESH_RATE,
"Exibe uma mensagem na tela ao definir a taxa de atualização."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_NETPLAY_EXTRA,
"Notificações extras de netplay"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA,
"Exibe mensagens não essenciais de netplay na tela."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH,
"Fonte das notificações na tela"
@ -5114,6 +5122,10 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_NETPLAY_TCP_UDP_PORT,
"Porta do endereço de IP do anfitrião. Pode ser uma porta TCP ou uma porta UDP."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_MAX_CONNECTIONS,
"Max Conexões Simultâneas"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_PASSWORD,
"Senha do servidor"

View file

@ -4009,6 +4009,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_REFRESH_RATE,
"Display an on-screen message when setting the refresh rate."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_NETPLAY_EXTRA,
"Extra Netplay Notifications"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA,
"Display non-essential netplay on-screen messages."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH,
"Notification Font"
@ -5206,6 +5214,10 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_NETPLAY_TCP_UDP_PORT,
"The port of the host IP address. Can be either a TCP or UDP port."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_MAX_CONNECTIONS,
"Max Simultaneous Connections"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_PASSWORD,
"Server Password"
@ -12057,6 +12069,22 @@ MSG_HASH(
MSG_FAILED_TO_SET_INITIAL_DISK,
"Failed to set last used disc..."
)
MSG_HASH(
MSG_FAILED_TO_CONNECT_TO_CLIENT,
"Failed to connect to client"
)
MSG_HASH(
MSG_FAILED_TO_CONNECT_TO_HOST,
"Failed to connect to host"
)
MSG_HASH(
MSG_NETPLAY_HOST_FULL,
"Netplay host full"
)
MSG_HASH(
MSG_FAILED_TO_RECEIVE_HEADER_FROM_HOST,
"Failed to receive header from host"
)
MSG_HASH(
MSG_CHEEVOS_HARDCORE_MODE_DISABLED,
"A save state was loaded. Achievements Hardcore Mode disabled for the current session."

View file

@ -441,6 +441,9 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_screenshot_duratio
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_screenshot_flash, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH)
#endif
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_refresh_rate, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_REFRESH_RATE)
#ifdef HAVE_NETWORKING
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_netplay_extra, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA)
#endif
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_width, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_height, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_auto_width_max, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_AUTO_WIDTH_MAX)
@ -3477,6 +3480,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_NOTIFICATION_SHOW_REFRESH_RATE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_refresh_rate);
break;
#ifdef HAVE_NETWORKING
case MENU_ENUM_LABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_netplay_extra);
break;
#endif
case MENU_ENUM_LABEL_RESTART_RETROARCH:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_restart_retroarch);
break;

View file

@ -7295,6 +7295,7 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_NETPLAY_MITM_SERVER, PARSE_ONLY_STRING, false},
{MENU_ENUM_LABEL_NETPLAY_IP_ADDRESS, PARSE_ONLY_STRING, true},
{MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_NETPLAY_MAX_CONNECTIONS, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_NETPLAY_PASSWORD, PARSE_ONLY_STRING, true},
{MENU_ENUM_LABEL_NETPLAY_SPECTATE_PASSWORD, PARSE_ONLY_STRING, true},
{MENU_ENUM_LABEL_NETPLAY_START_AS_SPECTATOR, PARSE_ONLY_BOOL, true},
@ -8629,6 +8630,9 @@ unsigned menu_displaylist_build_list(
#endif
#endif
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_REFRESH_RATE, PARSE_ONLY_BOOL, false },
#ifdef HAVE_NETWORKING
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA, PARSE_ONLY_BOOL, false },
#endif
};
for (i = 0; i < ARRAY_SIZE(build_list); i++)
@ -9870,6 +9874,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
file_list_t *list = info->list;
menu_displaylist_build_info_selective_t build_list[] = {
{MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_NETPLAY_MAX_CONNECTIONS, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_NETPLAY_PUBLIC_ANNOUNCE, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NETPLAY_USE_MITM_SERVER, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NETPLAY_MITM_SERVER, PARSE_ONLY_STRING, false},

View file

@ -13651,6 +13651,7 @@ static bool setting_append_list(
(*list)[list_info->index - 1].offset_by = 1;
menu_settings_list_current_add_range(list, list_info, 1, 65536, 1, true, true);
CONFIG_UINT(
list, list_info,
&settings->uints.video_stream_quality,
@ -14564,6 +14565,23 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
#ifdef HAVE_NETWORKING
CONFIG_BOOL(
list, list_info,
&settings->bools.notification_show_netplay_extra,
MENU_ENUM_LABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA,
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_NETPLAY_EXTRA,
DEFAULT_NOTIFICATION_SHOW_NETPLAY_EXTRA,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
#endif
END_SUB_GROUP(list, list_info, parent_group);
END_GROUP(list, list_info, parent_group);
break;
@ -19031,6 +19049,21 @@ static bool setting_append_list(
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ALLOW_INPUT);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ADVANCED);
CONFIG_UINT(
list, list_info,
&settings->uints.netplay_max_connections,
MENU_ENUM_LABEL_NETPLAY_MAX_CONNECTIONS,
MENU_ENUM_LABEL_VALUE_NETPLAY_MAX_CONNECTIONS,
netplay_max_connections,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_SPINBOX;
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
menu_settings_list_current_add_range(list, list_info, 1, 31, 1, true, true);
CONFIG_STRING(
list, list_info,
settings->paths.netplay_password,

View file

@ -175,6 +175,10 @@ enum msg_hash_enums
MSG_SETTING_DISK_IN_TRAY,
MSG_FAILED_TO_SET_DISK,
MSG_FAILED_TO_SET_INITIAL_DISK,
MSG_FAILED_TO_CONNECT_TO_CLIENT,
MSG_FAILED_TO_CONNECT_TO_HOST,
MSG_NETPLAY_HOST_FULL,
MSG_FAILED_TO_RECEIVE_HEADER_FROM_HOST,
MSG_NETPLAY_FAILED,
MSG_UNKNOWN_NETPLAY_COMMAND_RECEIVED,
MSG_CONNECTING_TO_NETPLAY_HOST,
@ -1897,6 +1901,7 @@ enum msg_hash_enums
MENU_LABEL(NETPLAY_INPUT_LATENCY_FRAMES_RANGE),
MENU_LABEL(NETPLAY_SPECTATOR_MODE_ENABLE),
MENU_LABEL(NETPLAY_TCP_UDP_PORT),
MENU_LABEL(NETPLAY_MAX_CONNECTIONS),
MENU_LABEL(NETPLAY_NAT_TRAVERSAL),
MENU_LABEL(NETPLAY_REQUEST_DEVICE_I),
MENU_ENUM_LABEL_NETPLAY_REQUEST_DEVICE_1,
@ -2860,6 +2865,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_FLASH_FAST,
MENU_LABEL(NOTIFICATION_SHOW_REFRESH_RATE),
MENU_LABEL(NOTIFICATION_SHOW_NETPLAY_EXTRA),
MENU_LABEL(SELECT_FILE),
MENU_LABEL(SELECT_FROM_PLAYLIST),

File diff suppressed because it is too large Load diff

View file

@ -416,6 +416,7 @@ QWidget *NetplayPage::widget()
serverForm->add(MENU_ENUM_LABEL_NETPLAY_IP_ADDRESS);
serverForm->add(MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT);
serverForm->add(MENU_ENUM_LABEL_NETPLAY_MAX_CONNECTIONS);
serverForm->add(MENU_ENUM_LABEL_NETPLAY_PASSWORD);
serverForm->add(MENU_ENUM_LABEL_NETPLAY_SPECTATE_PASSWORD);
serverForm->add(MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL);
@ -593,6 +594,7 @@ QWidget *NotificationsPage::widget()
notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION);
notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH);
notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_REFRESH_RATE);
notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA);
layout->addWidget(notificationsGroup);