diff options
| author | Techjar <tecknojar@gmail.com> | 2018-07-04 17:01:50 -0400 |
|---|---|---|
| committer | Techjar <tecknojar@gmail.com> | 2018-07-19 18:09:20 -0400 |
| commit | 4407854e9cbffeb8da1d7a8e70186b6d7498bccb (patch) | |
| tree | f3e356855c3cfc7bada351cb13e66aa75c77c188 /Source/Core/Common/SFMLHelper.cpp | |
| parent | f5e8af7b6ca24962f1a9fea14b989a0092bae210 (diff) | |
NetPlay save data synchronization
This adds the functionality of sending the host's save data (raw memory
cards, as well as GCI files and Wii saves with a matching GameID) to
all other clients. The data is compressed using LZO1X to greatly reduce
its size while keeping compression/decompression fast. Save
synchronization is enabled by default, and toggleable with a checkbox
in the NetPlay dialog.
On clicking start, if the option is enabled, game boot will be delayed
until all players have received the save data sent by the host. If any
player fails to receive it properly, boot will be cancelled to prevent
desyncs.
Diffstat (limited to 'Source/Core/Common/SFMLHelper.cpp')
| -rw-r--r-- | Source/Core/Common/SFMLHelper.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Source/Core/Common/SFMLHelper.cpp b/Source/Core/Common/SFMLHelper.cpp new file mode 100644 index 0000000000..367bd93a9e --- /dev/null +++ b/Source/Core/Common/SFMLHelper.cpp @@ -0,0 +1,38 @@ +// Copyright 2018 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "Common/SFMLHelper.h" + +#include <SFML/Network/Packet.hpp> + +namespace Common +{ +// This only exists as a helper for BigEndianValue +u16 PacketReadU16(sf::Packet& packet) +{ + u16 tmp; + packet >> tmp; + return tmp; +} + +// This only exists as a helper for BigEndianValue +u32 PacketReadU32(sf::Packet& packet) +{ + u32 tmp; + packet >> tmp; + return tmp; +} + +u64 PacketReadU64(sf::Packet& packet) +{ + u32 low, high; + packet >> low >> high; + return low | (static_cast<u64>(high) << 32); +} + +void PacketWriteU64(sf::Packet& packet, const u64 value) +{ + packet << static_cast<u32>(value) << static_cast<u32>(value >> 32); +} +} // namespace Common |
