mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 06:32:48 +00:00
(Netplay) Improve check frames menu entry (#14320)
This commit is contained in:
parent
8914f0b6fe
commit
c180560165
@ -20071,8 +20071,8 @@ static bool setting_append_list(
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_SPINBOX;
|
||||
menu_settings_list_current_add_range(list, list_info, -600, 600, 1, false, false);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 5184000, 1, true, false);
|
||||
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_INT(
|
||||
|
@ -3085,43 +3085,39 @@ static void netplay_handle_frame_hash(netplay_t *netplay,
|
||||
{
|
||||
if (netplay->is_server)
|
||||
{
|
||||
if (netplay->check_frames &&
|
||||
delta->frame % abs(netplay->check_frames) == 0)
|
||||
if (netplay->check_frames && (delta->frame % netplay->check_frames) == 0)
|
||||
{
|
||||
if (netplay->state_size)
|
||||
delta->crc = netplay_delta_frame_crc(netplay, delta);
|
||||
else
|
||||
delta->crc = 0;
|
||||
delta->crc = netplay->state_size ?
|
||||
netplay_delta_frame_crc(netplay, delta) : 0;
|
||||
netplay_cmd_crc(netplay, delta);
|
||||
}
|
||||
}
|
||||
else if (delta->crc && netplay->crcs_valid)
|
||||
else
|
||||
{
|
||||
/* We have a remote CRC, so check it */
|
||||
uint32_t local_crc = 0;
|
||||
if (netplay->state_size)
|
||||
local_crc = netplay_delta_frame_crc(netplay, delta);
|
||||
|
||||
if (local_crc != delta->crc)
|
||||
if (netplay->crcs_valid && delta->crc)
|
||||
{
|
||||
/* If the very first check frame is wrong,
|
||||
* they probably just don't work */
|
||||
if (!netplay->crc_validity_checked)
|
||||
netplay->crcs_valid = false;
|
||||
else if (netplay->crcs_valid)
|
||||
/* We have a remote CRC, so check it. */
|
||||
uint32_t local_crc = netplay->state_size ?
|
||||
netplay_delta_frame_crc(netplay, delta) : 0;
|
||||
|
||||
if (local_crc != delta->crc)
|
||||
{
|
||||
/* Fix this! */
|
||||
if (netplay->check_frames < 0)
|
||||
/* If the very first check frame is wrong,
|
||||
they probably just don't work. */
|
||||
if (!netplay->crc_validity_checked)
|
||||
{
|
||||
/* Just report */
|
||||
RARCH_ERR("[Netplay] Netplay CRCs mismatch!\n");
|
||||
netplay->crcs_valid = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
if (netplay->check_frames)
|
||||
netplay_cmd_request_savestate(netplay);
|
||||
else
|
||||
RARCH_WARN("[Netplay] Netplay CRCs mismatch!\n");
|
||||
}
|
||||
else
|
||||
netplay->crc_validity_checked = true;
|
||||
}
|
||||
else if (!netplay->crc_validity_checked)
|
||||
netplay->crc_validity_checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6969,8 +6965,8 @@ static void netplay_free(netplay_t *netplay)
|
||||
*/
|
||||
static netplay_t *netplay_new(const char *server, const char *mitm,
|
||||
uint16_t port, const char *mitm_session,
|
||||
int check_frames, const struct retro_callbacks *cb, bool nat_traversal,
|
||||
const char *nick, uint32_t quirks)
|
||||
uint32_t check_frames, const struct retro_callbacks *cb,
|
||||
bool nat_traversal, const char *nick, uint32_t quirks)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
netplay_t *netplay = (netplay_t*)calloc(1, sizeof(*netplay));
|
||||
|
@ -566,6 +566,9 @@ struct netplay
|
||||
uint32_t server_frame_count;
|
||||
uint32_t replay_frame_count;
|
||||
|
||||
/* Frequency with which to check CRCs */
|
||||
uint32_t check_frames;
|
||||
|
||||
/* How far behind did we fall? */
|
||||
uint32_t catch_up_behind;
|
||||
|
||||
@ -582,9 +585,6 @@ struct netplay
|
||||
|
||||
int frame_run_time_ptr;
|
||||
|
||||
/* Frequency with which to check CRCs */
|
||||
int check_frames;
|
||||
|
||||
/* Latency frames; positive to hide network latency,
|
||||
* negative to hide input latency */
|
||||
int input_latency_frames;
|
||||
|
Loading…
x
Reference in New Issue
Block a user