diff --git a/configuration.h b/configuration.h index 4f32cef7ff..8b77811b82 100644 --- a/configuration.h +++ b/configuration.h @@ -402,7 +402,7 @@ typedef struct settings char server[255]; unsigned port; bool stateless_mode; - unsigned check_frames; + int check_frames; bool swap_input; bool nat_traversal; char password[128]; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 3689071fd3..e056ff6a32 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4703,7 +4703,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES, - PARSE_ONLY_UINT, false) != -1) + PARSE_ONLY_INT, false) != -1) count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 1a8499c44f..01c874b680 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -1728,15 +1728,9 @@ void general_write_handler(void *data) break; case MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES: #ifdef HAVE_NETWORKING - { - bool val = (settings->netplay.check_frames > 0); - - if (val) - retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES, NULL); - else - retroarch_override_setting_unset(RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES, NULL); - } + retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES, NULL); #endif + break; default: break; } @@ -5624,7 +5618,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); - menu_settings_list_current_add_range(list, list_info, 0, 600, 1, true, false); + menu_settings_list_current_add_range(list, list_info, -600, 600, 1, true, false); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_BOOL( diff --git a/network/netplay/netplay_init.c b/network/netplay/netplay_init.c index 650d9f3c78..63609a10a4 100644 --- a/network/netplay/netplay_init.c +++ b/network/netplay/netplay_init.c @@ -414,7 +414,7 @@ static bool netplay_init_buffers(netplay_t *netplay) */ netplay_t *netplay_new(void *direct_host, const char *server, uint16_t port, const char *play_password, const char *spectate_password, - bool stateless_mode, unsigned check_frames, + bool stateless_mode, int check_frames, const struct retro_callbacks *cb, bool nat_traversal, const char *nick, uint64_t quirks) { diff --git a/network/netplay/netplay_private.h b/network/netplay/netplay_private.h index 3133a07e4e..e0794f0faa 100644 --- a/network/netplay/netplay_private.h +++ b/network/netplay/netplay_private.h @@ -442,7 +442,7 @@ struct netplay bool catch_up; /* Frequency with which to check CRCs */ - uint32_t check_frames; + int check_frames; /* Have we checked whether CRCs are valid at all? */ bool crc_validity_checked; @@ -647,7 +647,7 @@ bool netplay_wait_and_init_serialization(netplay_t *netplay); */ netplay_t *netplay_new(void *direct_host, const char *server, uint16_t port, const char *play_password, const char *spectate_password, - bool stateless_mode, unsigned check_frames, + bool stateless_mode, int check_frames, const struct retro_callbacks *cb, bool nat_traversal, const char *nick, uint64_t quirks); diff --git a/network/netplay/netplay_sync.c b/network/netplay/netplay_sync.c index 72b2e2125d..fe163c50f4 100644 --- a/network/netplay/netplay_sync.c +++ b/network/netplay/netplay_sync.c @@ -137,7 +137,7 @@ static void netplay_handle_frame_hash(netplay_t *netplay, struct delta_frame *de if (netplay->is_server) { if (netplay->check_frames && - delta->frame % netplay->check_frames == 0) + delta->frame % abs(netplay->check_frames) == 0) { delta->crc = netplay_delta_frame_crc(netplay, delta); netplay_cmd_crc(netplay, delta); @@ -158,7 +158,15 @@ static void netplay_handle_frame_hash(netplay_t *netplay, struct delta_frame *de else if (netplay->crcs_valid) { /* Fix this! */ - netplay_cmd_request_savestate(netplay); + if (netplay->check_frames < 0) + { + /* Just report */ + RARCH_ERR("Netplay CRCs mismatch!\n"); + } + else + { + netplay_cmd_request_savestate(netplay); + } } } else if (!netplay->crc_validity_checked)