mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-15 05:30:05 +00:00
NWM_UDS: use sizeof(<var being used>) instead of hard-coded type (#4093)
* NWM_UDS: use sizeof(<var being used>) instead of hard-coded type Intend to fix #4090. ` node_map.node.second` type was changed to `u16` in #3985. However the type change wasn't reflected here. Should have used variable name instead to automatically do type change * NWM_UDS: ... and also the node.first one * NWM_UDS: ... and here * Network: bump version because we changed UDS packet layout * Update nwm_uds.cpp
This commit is contained in:
parent
c18a7896e0
commit
1b1439c6af
@ -161,14 +161,15 @@ static void BroadcastNodeMap() {
|
||||
packet.type = Network::WifiPacket::PacketType::NodeMap;
|
||||
packet.destination_address = Network::BroadcastMac;
|
||||
size_t size = node_map.size();
|
||||
packet.data.resize(sizeof(size) + (sizeof(Network::MacAddress) + sizeof(u32)) * size);
|
||||
using node_t = decltype(node_map)::value_type;
|
||||
packet.data.resize(sizeof(size) + (sizeof(node_t::first) + sizeof(node_t::second)) * size);
|
||||
std::memcpy(packet.data.data(), &size, sizeof(size));
|
||||
size_t offset = sizeof(size);
|
||||
for (const auto& node : node_map) {
|
||||
std::memcpy(packet.data.data() + offset, node.first.data(), sizeof(node.first));
|
||||
std::memcpy(packet.data.data() + offset + sizeof(node.first), &node.second,
|
||||
sizeof(node.second));
|
||||
offset += sizeof(Network::MacAddress) + sizeof(u32);
|
||||
offset += sizeof(node.first) + sizeof(node.second);
|
||||
}
|
||||
|
||||
SendPacket(packet);
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace Network {
|
||||
|
||||
constexpr u32 network_version = 2; ///< The version of this Room and RoomMember
|
||||
constexpr u32 network_version = 3; ///< The version of this Room and RoomMember
|
||||
|
||||
constexpr u16 DefaultRoomPort = 24872;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user