diff --git a/network/netplay/netplay_common.c b/network/netplay/netplay_common.c index 52bd5b4c65..5820bd0f2d 100644 --- a/network/netplay/netplay_common.c +++ b/network/netplay/netplay_common.c @@ -73,90 +73,6 @@ bool netplay_send_nickname(netplay_t *netplay, int fd) return true; } -uint32_t *netplay_bsv_header_generate(size_t *size, uint32_t magic) -{ - retro_ctx_serialize_info_t serial_info; - retro_ctx_size_info_t info; - uint32_t *content_crc_ptr; - size_t serialize_size, header_size; - uint32_t *header, bsv_header[4] = {0}; - - core_serialize_size(&info); - - serialize_size = info.size; - header_size = sizeof(bsv_header) + serialize_size; - *size = header_size; - header = (uint32_t*)malloc(header_size); - if (!header) - goto error; - - content_get_crc(&content_crc_ptr); - - bsv_header[MAGIC_INDEX] = swap_if_little32(BSV_MAGIC); - bsv_header[SERIALIZER_INDEX] = swap_if_big32(magic); - bsv_header[CRC_INDEX] = swap_if_big32(*content_crc_ptr); - bsv_header[STATE_SIZE_INDEX] = swap_if_big32(serialize_size); - - serial_info.data = header + 4; - serial_info.size = serialize_size; - - if (serialize_size && !core_serialize(&serial_info)) - goto error; - - memcpy(header, bsv_header, sizeof(bsv_header)); - return header; - -error: - if (header) - free(header); - return NULL; -} - -bool netplay_bsv_parse_header(const uint32_t *header, uint32_t magic) -{ - retro_ctx_size_info_t info; - uint32_t *content_crc_ptr; - uint32_t in_crc, in_magic, in_state_size; - uint32_t in_bsv = swap_if_little32(header[MAGIC_INDEX]); - - if (in_bsv != BSV_MAGIC) - { - RARCH_ERR("BSV magic mismatch, got 0x%x, expected 0x%x.\n", - in_bsv, BSV_MAGIC); - return false; - } - - in_magic = swap_if_big32(header[SERIALIZER_INDEX]); - if (in_magic != magic) - { - RARCH_ERR("Magic mismatch, got 0x%x, expected 0x%x.\n", in_magic, magic); - return false; - } - - in_crc = swap_if_big32(header[CRC_INDEX]); - - content_get_crc(&content_crc_ptr); - - if (in_crc != *content_crc_ptr) - { - RARCH_ERR("CRC32 mismatch, got 0x%x, expected 0x%x.\n", in_crc, - *content_crc_ptr); - return false; - } - - core_serialize_size(&info); - - in_state_size = swap_if_big32(header[STATE_SIZE_INDEX]); - if (in_state_size != info.size) - { - RARCH_ERR("Serialization size mismatch, got 0x%x, expected 0x%x.\n", - (unsigned)in_state_size, (unsigned)info.size); - return false; - } - - return true; -} - /** * netplay_impl_magic: * diff --git a/network/netplay/netplay_private.h b/network/netplay/netplay_private.h index 852cf158c4..e8082899e8 100644 --- a/network/netplay/netplay_private.h +++ b/network/netplay/netplay_private.h @@ -180,10 +180,6 @@ bool netplay_send_nickname(netplay_t *netplay, int fd); bool netplay_send_info(netplay_t *netplay); -uint32_t *netplay_bsv_header_generate(size_t *size, uint32_t magic); - -bool netplay_bsv_parse_header(const uint32_t *header, uint32_t magic); - uint32_t netplay_impl_magic(void); bool netplay_send_info(netplay_t *netplay);