mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Ignore check_frames if CRCs are utterly inconsistent
This effectively disables check_frames if frame 1's CRC differs between host and client. This is necessary because some important cores have nondeterminism in core_run, thus mandating check_frames, while some important cores have nondeterminism in core_serialize, thus mandating no check_frames.
This commit is contained in:
parent
49b4143687
commit
60153e7035
@ -31,22 +31,33 @@
|
||||
|
||||
static void netplay_handle_frame_hash(netplay_t *netplay, struct delta_frame *delta)
|
||||
{
|
||||
static bool crcs_valid = true;
|
||||
if (netplay_is_server(netplay))
|
||||
{
|
||||
if (netplay->check_frames && delta->frame % netplay->check_frames == 0)
|
||||
if (netplay->check_frames &&
|
||||
(delta->frame % netplay->check_frames == 0 || delta->frame == 1))
|
||||
{
|
||||
delta->crc = netplay_delta_frame_crc(netplay, delta);
|
||||
netplay_cmd_crc(netplay, delta);
|
||||
}
|
||||
}
|
||||
else if (delta->crc)
|
||||
else if (delta->crc && crcs_valid)
|
||||
{
|
||||
/* We have a remote CRC, so check it */
|
||||
uint32_t local_crc = netplay_delta_frame_crc(netplay, delta);
|
||||
if (local_crc != delta->crc)
|
||||
{
|
||||
/* Fix this! */
|
||||
netplay_cmd_request_savestate(netplay);
|
||||
if (delta->frame == 1)
|
||||
{
|
||||
/* We check frame 1 just to make sure the CRCs make sense at all.
|
||||
* If we've diverged at frame 1, we assume CRCs are not useful. */
|
||||
crcs_valid = false;
|
||||
}
|
||||
else if (crcs_valid)
|
||||
{
|
||||
/* Fix this! */
|
||||
netplay_cmd_request_savestate(netplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user