Created
January 29, 2016 23:14
-
-
Save Themaister/3b7b15063d6e93795691 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From cc3255fa6810e63b34d8c1fa98bec1b2037625d4 Mon Sep 17 00:00:00 2001 | |
From: Hans-Kristian Arntzen <[email protected]> | |
Date: Sat, 30 Jan 2016 00:14:00 +0100 | |
Subject: [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 98a02c7..bf8569d 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 198e642..9cd6f81 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); | |
-- | |
2.7.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment