mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
c5b4e1a5f6
Switch to using additional overloads of sf::Packet, so we can eliminate some of the messy code and just use the normal syntax for BigEndianValue. We can't avoid helper functions with u64 due to SFML's non-standard way of defining 64-bit integer types.
44 lines
847 B
C++
44 lines
847 B
C++
// Copyright 2018 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#include "Common/SFMLHelper.h"
|
|
|
|
#include <SFML/Network/Packet.hpp>
|
|
|
|
sf::Packet& operator>>(sf::Packet& packet, Common::BigEndianValue<u16>& data)
|
|
{
|
|
u16 tmp;
|
|
packet >> tmp;
|
|
data = tmp;
|
|
return packet;
|
|
}
|
|
|
|
sf::Packet& operator>>(sf::Packet& packet, Common::BigEndianValue<u32>& data)
|
|
{
|
|
u32 tmp;
|
|
packet >> tmp;
|
|
data = tmp;
|
|
return packet;
|
|
}
|
|
|
|
sf::Packet& operator>>(sf::Packet& packet, Common::BigEndianValue<u64>& data)
|
|
{
|
|
sf::Uint64 tmp;
|
|
packet >> tmp;
|
|
data = tmp;
|
|
return packet;
|
|
}
|
|
|
|
namespace Common
|
|
{
|
|
// SFML's Uint64 type is different depending on platform,
|
|
// so we have this for cleaner code.
|
|
u64 PacketReadU64(sf::Packet& packet)
|
|
{
|
|
sf::Uint64 value;
|
|
packet >> value;
|
|
return value;
|
|
}
|
|
} // namespace Common
|