From 8e435a66eb1b7413b774b3bdb066901cfc48b7a3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 30 Jan 2016 00:23:22 +0100 Subject: [PATCH] (Netplay) Backport - [PATCH] Should fix few issues with netplay. One perf fix and 3/4 player fix. --- netplay/netplay.c | 7 +++++++ netplay/netplay_net.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/netplay/netplay.c b/netplay/netplay.c index d3eaecfde6..6af88650c6 100644 --- a/netplay/netplay.c +++ b/netplay/netplay.c @@ -568,8 +568,15 @@ int16_t input_state_net(unsigned port, unsigned device, unsigned idx, unsigned id) { netplay_t *netplay = (netplay_t*)netplay_data; + if (netplay_is_alive(netplay)) + { + /* Only two players for now. */ + if (port > 1) + return 0; + return netplay_input_state(netplay, port, device, idx, id); + } return netplay->cbs.state_cb(port, device, idx, id); } diff --git a/netplay/netplay_net.c b/netplay/netplay_net.c index 198e64234d..9cd6f815d1 100644 --- a/netplay/netplay_net.c +++ b/netplay/netplay_net.c @@ -56,7 +56,7 @@ static void netplay_net_post_frame(netplay_t *netplay) { const struct delta_frame *ptr = &netplay->buffer[netplay->other_ptr]; - if ((ptr->simulated_input_state != ptr->real_input_state) + if (memcmp(ptr->simulated_input_state, ptr->real_input_state, sizeof(ptr->real_input_state)) != 0 && !ptr->used_real) break; netplay->other_ptr = NEXT_PTR(netplay->other_ptr);