Commit Graph

247 Commits

Author SHA1 Message Date
Gregor Richards
c780e7db43 Accept the variable size quirk
Since the quirks protocol was that a core could report variable
savestate size, but the host then tells it "no", we should actually
accept the variable size quirk in netplay, since RetroArch refuses to
allow cores to actually produce variable-size states.
2016-12-20 22:17:15 -05:00
Gregor Richards
7bb26eb5c5 Fix some minor checked-return bugs
Should resolve Coverity reports 158862, 158861, 158860.

158863 is spurious but I have no idea how to convince Coverity of that.
2016-12-20 19:16:31 -05:00
Gregor Richards
8f35de9da0 Adding blocks in the empty-RECV case to (hopefully) suppress warnings 2016-12-19 17:31:24 -05:00
Twinaphex
1d36c5effa Silence warnings - remove unused variables 2016-12-19 23:19:59 +01:00
Alcaro
fc1c83d8c0 Shut up false positive warning 2016-12-19 16:38:55 +01:00
Gregor Richards
11a3063fc6 Forgot the other half of that last bugfix 2016-12-18 20:08:21 -05:00
Gregor Richards
8f8e6dfc5f Unset the netplay callbacks when we deinit netplay
This is a bugfix to master that hadn't migrated to my branch.
2016-12-18 19:54:01 -05:00
Gregor Richards
dcd4b3046b Making negative check_frames be "check only" mode 2016-12-18 19:28:44 -05:00
Gregor Richards
677ffa9ebd Support different forms of compression from different clients. 2016-12-18 19:28:44 -05:00
Gregor Richards
84c33634a6 Communicate paused-ness during initial connection SYNC. 2016-12-18 19:28:44 -05:00
Gregor Richards
60b81e3a51 Nominal support for server sending blank INFO 2016-12-18 19:28:44 -05:00
Gregor Richards
e79f30604f Better stall timing
We now stall not until we've reached parity (which makes no sense since
we expect latency), but only until we're not likely to stall again.
2016-12-18 19:28:44 -05:00
Gregor Richards
8195a5bcee Try to catch up if we're falling behind our peer, not anyone
In the previous catch-up system, we would only try to catch up if we
were falling behind the farthest-behind peer. However, as they would
also only try to catch up to us, everyone basically agreed to the
worst-case latency. It makes more sense to try to be in parity with your
direct peer than with indirect connections.
2016-12-18 19:28:44 -05:00
Gregor Richards
b535412914 Adding nick-changing
This is just to disambiguate multiple connections with the same nick
(usually Anonymous), which will now become e.g. Anonymous (2).
2016-12-18 19:28:44 -05:00
Gregor Richards
7c2f12fbd9 Removign some leftover debug code 2016-12-18 19:28:44 -05:00
Gregor Richards
04266cf4f7 Run synchronization even when stalled
Previously, we could be stalled by one player but still reading data
from another, which would wedge the client because we would never act
upon the newly-read data. Now we act upon data even if we're stalled.
Fixes bugs in initial connection with high latency.
2016-12-18 19:28:44 -05:00
Gregor Richards
d6d96704fd Don't panic about delta frames not being ready if we're not even fully
connected yet.
2016-12-18 19:28:43 -05:00
Gregor Richards
8b21014d07 Improvements to handshake protocol
Making the netplay handshake protocol send the core and content as an
explicit command, so that the other side can (notionally) choose to load
it. That isn't implemented, of course.
2016-12-18 19:28:43 -05:00
Gregor Richards
1fa60b396f Improvements to the communication of netplay pausing. 2016-12-18 19:28:43 -05:00
Gregor Richards
db2c8de44c Slightly changing how catch-up works to avoid spamming the console 2016-12-18 19:28:43 -05:00
Gregor Richards
1141825605 Documenting (somewhat) the new sync system. 2016-12-18 19:28:43 -05:00
Gregor Richards
a20e79bbb5 Server needs double the buffer frames since two connected clients could
be ahead and behind by the max frames
2016-12-18 19:28:43 -05:00
Gregor Richards
f7f6590156 Goodbye delay_frames! stateless_mode is the new delay_frames=0 2016-12-18 19:28:43 -05:00
Gregor Richards
45d732a014 New sync system
The idea:
   * Use a fixed number of delay_frames (eventually to be fixed at 120,
     currently still uses the config variable, 0 will still be an option)
   * Determine how long it takes to simulate a frame.
   * Stall only if resimulating the intervening frames would be
     sufficiently annoying (currently fixed at three frames worth of
     time)

Because clients always try to catch up, the actual frame delay works out
automatically to be minimally zero and maximally the latency. If one
client is underpowered but the other is fine, the powerful one will
automatically take up the slack. Seems like the most reasonable system.
2016-12-18 19:28:43 -05:00
Gregor Richards
6890456ac0 Updated error messages and fixed some stall-related disconnected-client
bugs.
2016-12-18 19:28:43 -05:00
Gregor Richards
6658826759 CRC validity checking. Ignore CRCs if they don't work. 2016-12-18 19:28:43 -05:00
Gregor Richards
a6cd8c3aa1 Error reporting when a password is refused, plus a bugfix so that
socket_receive_all_nonblocking actually reports disconnects.
2016-12-18 19:28:43 -05:00
Gregor Richards
df2600fbf4 Added error reporting when a player is not allowed to play. 2016-12-18 19:28:43 -05:00
Gregor Richards
bade067d9a Support for catching up if the netplay peer is ahead of us. 2016-12-18 19:28:43 -05:00
Gregor Richards
4e01481b39 Only allow clients to load state if there's no further synchronization 2016-12-18 19:28:43 -05:00
Gregor Richards
70d04ec6a5 Apparently the frontend gets really pissy if it can't check the flip state 2016-12-18 19:28:43 -05:00
Gregor Richards
da7efcb939 Cleaning up netplay headers. 2016-12-18 19:28:43 -05:00
Gregor Richards
9c6ac2b934 Only the server can flip users. 2016-12-18 19:28:43 -05:00
Gregor Richards
03415c261d Added netplay spectator password separate from play password 2016-12-18 19:28:43 -05:00
Gregor Richards
694b7a9723 Don't allow more players to join than are actually being polled 2016-12-18 19:28:43 -05:00
Gregor Richards
7ad4e3f115 Per-connection stalling 2016-12-18 19:28:43 -05:00
Gregor Richards
1b22191869 Deduplicating some code. 2016-12-18 19:28:43 -05:00
Gregor Richards
f619789e48 Refactoring: netplay_common.c -> netplay_handshake.c/netplay_delta.c
Refactoring netplay_common into its two actual components, the handshake
and delta-frame related functions.
2016-12-18 19:28:43 -05:00
Gregor Richards
4e905bf524 Refactoring: netplay_sync.c
Renamed netplay_net.c to netplay_sync.c, as all that remains in that
file is synchronization-related functions.
2016-12-18 19:28:43 -05:00
Gregor Richards
257c5d3188 Refactoring netplay_init.c/netplay_net.c
Split the remainder of netplay.c into netplay_init.c and netplay_net.c
(which will soon be netplay_sync.c)
2016-12-18 19:28:43 -05:00
Gregor Richards
7e2465ef1f Refactoring: Moving I/O functionality into netplay_io.c 2016-12-18 19:28:43 -05:00
Gregor Richards
8c59c7dd77 Starting to refactor: Separating frontend stuff into netplay_frontend.c 2016-12-18 19:28:43 -05:00
Gregor Richards
ab989d7f41 More careful disconnection. 2016-12-18 19:28:43 -05:00
Gregor Richards
c8bba9a981 Simplistic builtin randomizer. 2016-12-18 19:28:43 -05:00
Gregor Richards
28e331b5fd Remove some magic numbers 2016-12-18 19:28:43 -05:00
Gregor Richards
6e6f2bfdbe Use a proper password hash across the line. 2016-12-18 19:28:42 -05:00
Gregor Richards
763a657f82 Terrible first cut at password (sent in plain text D-8) 2016-12-18 19:28:42 -05:00
Gregor Richards
5a0328dc09 Transfer pad configuration over netplay. 2016-12-18 19:28:42 -05:00
Gregor Richards
888e45c88b Updates to allow the server to toggle game/watch 2016-12-18 19:28:42 -05:00
Gregor Richards
3631ff74ff Very, very partial support for the server spectating 2016-12-18 19:28:42 -05:00