Being more careful with serialization

This commit is contained in:
Gregor Richards 2016-10-04 22:24:33 -04:00
parent 49d520c5d5
commit 68cee3b409

View File

@ -68,9 +68,10 @@ static bool netplay_net_pre_frame(netplay_t *netplay)
serial_info.data = netplay->buffer[netplay->self_ptr].state; serial_info.data = netplay->buffer[netplay->self_ptr].state;
serial_info.size = netplay->state_size; serial_info.size = netplay->state_size;
memset(serial_info.data, 0, serial_info.size);
if (netplay->savestates_work && core_serialize(&serial_info)) if (netplay->savestates_work && core_serialize(&serial_info))
{ {
if (netplay->force_send_savestate) if (netplay->force_send_savestate && !netplay->stall)
{ {
/* Send this along to the other side */ /* Send this along to the other side */
serial_info.data_const = netplay->buffer[netplay->self_ptr].state; serial_info.data_const = netplay->buffer[netplay->self_ptr].state;
@ -231,6 +232,7 @@ static void netplay_net_post_frame(netplay_t *netplay)
serial_info.data_const = NULL; serial_info.data_const = NULL;
/* Remember the current state */ /* Remember the current state */
memset(serial_info.data, 0, serial_info.size);
core_serialize(&serial_info); core_serialize(&serial_info);
if (netplay->replay_frame_count < netplay->read_frame_count) if (netplay->replay_frame_count < netplay->read_frame_count)
netplay_handle_frame_hash(netplay, ptr); netplay_handle_frame_hash(netplay, ptr);