summaryrefslogtreecommitdiff
path: root/Source/Core/Common/SFMLHelper.cpp
diff options
context:
space:
mode:
authorspycrab <spycrab@users.noreply.github.com>2018-07-21 02:09:02 +0200
committerGitHub <noreply@github.com>2018-07-21 02:09:02 +0200
commitc141511c87a8edfa1f273e8fdb13609def89efa8 (patch)
treebc5e0c9ab8db9b31101fc69dfaa88abce3043207 /Source/Core/Common/SFMLHelper.cpp
parentbcd2a76f2b19c3f091a91201c39fe6839a416970 (diff)
parent4407854e9cbffeb8da1d7a8e70186b6d7498bccb (diff)
Merge pull request #7222 from Techjar/netplay-sync-saves
NetPlay save data synchronization
Diffstat (limited to 'Source/Core/Common/SFMLHelper.cpp')
-rw-r--r--Source/Core/Common/SFMLHelper.cpp38
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