Commit Graph

50 Commits

Author SHA1 Message Date
025eac9062 NetPlayClient: const correctness 2017-03-19 09:32:58 -04:00
1834833edd NetPlay: use move semantics instead of unique_ptrs 2017-02-28 14:29:27 -08:00
9cab4e414c HW: Change u8 pad specifier params to int where applicable
Using u8 as indexers is kind of silly, since the rest of the public API
essentially uses int for this sort of thing. Changing these to int also
gets rid of quite a few implicit truncations.

This also allows for getting rid of similar silliness in the netplay API.
2016-10-07 08:14:12 -04:00
111182d9a3 Wiimote netplay: Check the reporting mode instead of the size 2016-08-14 19:25:00 +02:00
dca22e08eb Use Common::Flag and Common::Event when possible
Replaces old and simple usages of std::atomic<bool> with Common::Flag
(which was introduced after the initial usage), so it's clear that
the variable is a flag and because Common::Flag is well tested.

This also replaces the ready logic in WiimoteReal with Common::Event
since it was basically just unnecessarily reimplementing Common::Event.
2016-08-10 16:08:15 +02:00
1760b3bdad Rewrite NetPlayClient input wait logic to use std::condition_variable's
Instead of sleeping in NetPlayClient::GetNetPads and NetPlayClient::WiimoteUpdate,
now use std::condition_variable. This allows for finer control over these blocking
areas.
2016-07-26 21:34:35 +02:00
6a0fc4c438 Improve netplay setup dialog UX
* Focus "Hash Code" / "IP address" text box by default in "Connect"
* Focus game list in "Host" tab
* RETURN keypress now host/join depending on selected tab
* Remember last hosted game
* Remove PanicAlertT:
	* Simply log message to netplay window
	* Remove them when they are useless
* Show some netplay message in OSD
	* Chat messages
	* Pad buffer changes
	* Desync alerts
* Stop the game consistently when another player disconnects / crashes
* Prettify chat textbox
* Log netplay ping to OSD

Join scenario:
* Copy netplay code
* Open netplay
* Paste code
* Press enter

Host scenario:
* Open netplay
* Go to host tab
* Press enter
2016-07-23 20:58:51 +02:00
1a81735527 Merge pull request #3859 from Aestek/feature/netplay-md5
Netplay: add md5 testing
2016-07-18 09:20:37 -05:00
51c77e8eea Add md5 testing to netplay
Allows to test current game, an arbitrary game or the sdcard of all players
at once.
2016-07-16 22:48:46 +02:00
8b7bfe6cf9 Netplay: Fix synchronization for the Wiinote netplay
The old implementation always polled the local 1st Wiimote and used that as input for the Wiimote that is mapped to the player. But the reporting mode for Wiimotes can be different, even when using the same extensions. So an input for Wiimote 1 with a data size 4 could be used for Wiimote 2, which actually requires data size 7 at that time for example.

The 2nd problem was that the code added a dummy input into the buffer, when the reporting mode changed. But when the data from the other player hasn't arrived yet, the data in the buffer is out of order. Well, i think this is the problem, i'm not 100% sure, because i don't fully understand how the buffer works. But on the other hand, i'm pretty sure this will just force sync the players on reporting mode changes, instead of allowing them to be apart.

Pros:
- No more desyncs caused by big bugs in the code.
- Can use different extensions for different players.

Cons:
- Higher latency, because instead of polling 1 controller per player at once, all controllers are polled in order, send to the other players, before the next is processed.
- Have to setup the Wiimote, which the player is going to use, instead of the 1st one.

Now, if the controller config could temporarily be overridden with the one from another slot, the 2nd problem could be fixed. But at the same time, we would lose the ability to use different extensions. (unless we hack around it somehow, or properly send the used extension to the other players)
2016-07-16 13:00:54 +02:00
cd9a58b704 Check if all players have the game before starting netplay
https://bugs.dolphin-emu.org/issues/8885
2016-07-10 10:13:34 +02:00
b962c1f392 Fix running more than one session with Wiimotes
A static var is not a good idea, when the value needs to be reset for every session. Also, the variable holds the data size, so it makes sense to set the data size, where the data is added.
2016-07-08 23:30:24 +02:00
3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
1d90719abe Fix latency regression
On master, when polling the 1st in-game controller, Dolphin would poll all the 1st local controllers. With the 1st commit, each client waits its turn, which would dramatically increase the lag.

Now with this commit, it even polls all local controllers at once, so it should have even less latency than master in a few setups. Like one player with 3 controllers and the 2nd one with just one controller.
2016-05-24 22:13:40 +02:00
c434b5b3a9 NetPlayClient: Use std::array instead of C arrays for buffers 2016-01-25 04:57:21 -05:00
e6ad76fa70 NetPlayClient: Extract control mapping checking to its own function 2016-01-25 04:57:19 -05:00
8588c8fd31 NetPlayClient: Make SendAsync take a unique_ptr as a parameter 2016-01-25 04:57:18 -05:00
c2deb337aa NetPlayClient: In-class initialize variables where possible 2016-01-25 04:57:17 -05:00
1d8ff504a5 NetPlayClient: Make m_state private
Also turns it into an enum class.
2016-01-25 04:57:16 -05:00
102672a797 NetPlayClient: Make is_connected private
This is only queried, there's no need to expose it for writing.
Even if it was written to, a data member shouldn't be part of
your public API unless its part of a dumb object or trivial struct.
2016-01-25 04:57:04 -05:00
d9f87b8030 NetPlayClient: Remove unnecessary includes
Replace with needed ones
2016-01-24 21:46:49 -05:00
633be0387d General: Remove unimplemented function prototypes 2015-09-05 22:01:07 -04:00
11f3ded296 NetPlay: Return mapping arrays and player list vectors directly
Simplifies pad map dialog initialization
2015-08-17 21:56:25 -04:00
b1af2a6bbc NetPlay: Use std::array for the pad mappings 2015-08-16 00:08:09 -04:00
9c63b78397 Fix indeterminism in GPU thread mode. 2015-06-06 02:14:06 -04:00
04ca54623c Compare timebase of netplay users to detect desyncs. 2015-06-06 00:52:02 -04:00
de2e84344d Core: Convert volatile bools to atomics
Converts over bools that are typically used as loop checks into atomics.
2015-06-04 21:21:11 -04:00
ac26f8e79f Pass strings by const reference where possible 2015-05-28 20:54:55 -04:00
23c11b3f27 Thread: Remove unused Barrier class 2015-05-26 19:25:59 -04:00
30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
76bbd46829 Core: Remove some header inclusions in header files
Replaces them with forward declarations of used types, or removes them entirely if they aren't used at all. This also replaces certain Common headers with less inclusive ones (in terms of definitions they pull in).
2015-05-08 22:38:59 -04:00
8ee402863d NetPlay: Remove RunOnThread and add SendAsync methods
Add std::unique_ptr<sf::Packet> objects to a queue instead of functions,
makes things easier to read, and avoids headaches while checking the
lifetime of the concerned objects.
2015-03-18 10:16:11 +01:00
44d7207a1c NetPlay: add a Common/ENetUtil namespace
Move WakeupThread in it
2015-03-18 09:23:44 +01:00
603fe25349 NetPlay: use a workaround from comex’s dc-netplay to interrupt enet 2015-03-18 09:23:44 +01:00
a629555e6b Added Gui elements in Netplay Setup Diag so a person can choose a traversal server
Fixed bug with UPnP so that it will grab the proper address and protocal
Fixed bug that caused dolphin to freeze when host codes were to large
2015-02-25 18:28:26 -08:00
074d688884 Change netplay initial gctime to be determined by the hosts initial time 2015-02-25 18:28:26 -08:00
4cdc307b87 Moved Traversal Client code over from old netplay
Moved over gui code for copying host code
added gui to netplay diag setup to switch between direct and traversal connection
2015-02-25 18:28:25 -08:00
461a54338b Switched tcp over to enet 2015-02-25 18:17:50 -08:00
a93f86330e Port dolphin to SFML 2.1 2014-11-25 16:44:38 +00:00
0f3194abc3 Get rid of netpad and just send the GCPadStatus in netplay. 2014-10-16 13:20:00 -04:00
b06ec302d1 Remove some unnecessary semicolons 2014-09-11 13:05:31 -04:00
fbc64984ca Include CommonTypes.h instead of Common.h. 2014-09-08 15:39:58 -04:00
6faed31a44 Core: Get rid of calls to mem_fn in thread instantiations
These are not necessary for the same behavior.
2014-08-09 12:46:05 -04:00
896d7e5685 Change SPADStatus struct name to GCPadStatus
Also get rid of the typedef, since this is unnecessary in C++
2014-07-10 22:02:38 -04:00
2afe215271 Convert all includes to relative paths. 2014-02-18 02:19:10 -05:00
6c4ee1753a Fix some vertical alignments
ie. uses spaces for alignment.
2014-02-16 20:12:05 -05:00
d2038049f5 Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
ebb48d019e Clean up some struct indentations
Also cleaned up the indentations of some variable declarations.
2014-02-09 19:40:11 -05:00
34692ab826 Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00