diff options
| author | 2020-06-21 13:02:43 -0400 | |
|---|---|---|
| committer | 2020-06-21 13:02:43 -0400 | |
| commit | 0076a08d04017036b12405bfb933fa9272f8b0cd (patch) | |
| tree | 69eda77b0bc11a6f13a002f62517c333fa7635a2 /src/input_common/udp/protocol.h | |
| parent | Add libusb dependency (diff) | |
| download | yuzu-0076a08d04017036b12405bfb933fa9272f8b0cd.tar.gz yuzu-0076a08d04017036b12405bfb933fa9272f8b0cd.tar.xz yuzu-0076a08d04017036b12405bfb933fa9272f8b0cd.zip | |
Cleanup after linter
Diffstat (limited to 'src/input_common/udp/protocol.h')
| -rw-r--r-- | src/input_common/udp/protocol.h | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/src/input_common/udp/protocol.h b/src/input_common/udp/protocol.h index 2b31846db..3ba4d1fc8 100644 --- a/src/input_common/udp/protocol.h +++ b/src/input_common/udp/protocol.h | |||
| @@ -35,7 +35,6 @@ struct Header { | |||
| 35 | ///> the data | 35 | ///> the data |
| 36 | Type type{}; | 36 | Type type{}; |
| 37 | }; | 37 | }; |
| 38 | |||
| 39 | static_assert(sizeof(Header) == 20, "UDP Message Header struct has wrong size"); | 38 | static_assert(sizeof(Header) == 20, "UDP Message Header struct has wrong size"); |
| 40 | static_assert(std::is_trivially_copyable_v<Header>, "UDP Message Header is not trivially copyable"); | 39 | static_assert(std::is_trivially_copyable_v<Header>, "UDP Message Header is not trivially copyable"); |
| 41 | 40 | ||
| @@ -55,9 +54,7 @@ constexpr Type GetMessageType(); | |||
| 55 | 54 | ||
| 56 | namespace Request { | 55 | namespace Request { |
| 57 | 56 | ||
| 58 | struct Version { | 57 | struct Version {}; |
| 59 | }; | ||
| 60 | |||
| 61 | /** | 58 | /** |
| 62 | * Requests the server to send information about what controllers are plugged into the ports | 59 | * Requests the server to send information about what controllers are plugged into the ports |
| 63 | * In citra's case, we only have one controller, so for simplicity's sake, we can just send a | 60 | * In citra's case, we only have one controller, so for simplicity's sake, we can just send a |
| @@ -65,14 +62,12 @@ struct Version { | |||
| 65 | * nice to make this configurable | 62 | * nice to make this configurable |
| 66 | */ | 63 | */ |
| 67 | constexpr u32 MAX_PORTS = 4; | 64 | constexpr u32 MAX_PORTS = 4; |
| 68 | |||
| 69 | struct PortInfo { | 65 | struct PortInfo { |
| 70 | u32_le pad_count{}; ///> Number of ports to request data for | 66 | u32_le pad_count{}; ///> Number of ports to request data for |
| 71 | std::array<u8, MAX_PORTS> port; | 67 | std::array<u8, MAX_PORTS> port; |
| 72 | }; | 68 | }; |
| 73 | |||
| 74 | static_assert(std::is_trivially_copyable_v<PortInfo>, | 69 | static_assert(std::is_trivially_copyable_v<PortInfo>, |
| 75 | "UDP Request PortInfo is not trivially copyable"); | 70 | "UDP Request PortInfo is not trivially copyable"); |
| 76 | 71 | ||
| 77 | /** | 72 | /** |
| 78 | * Request the latest pad information from the server. If the server hasn't received this message | 73 | * Request the latest pad information from the server. If the server hasn't received this message |
| @@ -85,7 +80,6 @@ struct PadData { | |||
| 85 | Id, | 80 | Id, |
| 86 | Mac, | 81 | Mac, |
| 87 | }; | 82 | }; |
| 88 | |||
| 89 | /// Determines which method will be used as a look up for the controller | 83 | /// Determines which method will be used as a look up for the controller |
| 90 | Flags flags{}; | 84 | Flags flags{}; |
| 91 | /// Index of the port of the controller to retrieve data about | 85 | /// Index of the port of the controller to retrieve data about |
| @@ -93,10 +87,9 @@ struct PadData { | |||
| 93 | /// Mac address of the controller to retrieve data about | 87 | /// Mac address of the controller to retrieve data about |
| 94 | MacAddress mac; | 88 | MacAddress mac; |
| 95 | }; | 89 | }; |
| 96 | |||
| 97 | static_assert(sizeof(PadData) == 8, "UDP Request PadData struct has wrong size"); | 90 | static_assert(sizeof(PadData) == 8, "UDP Request PadData struct has wrong size"); |
| 98 | static_assert(std::is_trivially_copyable_v<PadData>, | 91 | static_assert(std::is_trivially_copyable_v<PadData>, |
| 99 | "UDP Request PadData is not trivially copyable"); | 92 | "UDP Request PadData is not trivially copyable"); |
| 100 | 93 | ||
| 101 | /** | 94 | /** |
| 102 | * Creates a message with the proper header data that can be sent to the server. | 95 | * Creates a message with the proper header data that can be sent to the server. |
| @@ -121,10 +114,9 @@ namespace Response { | |||
| 121 | struct Version { | 114 | struct Version { |
| 122 | u16_le version{}; | 115 | u16_le version{}; |
| 123 | }; | 116 | }; |
| 124 | |||
| 125 | static_assert(sizeof(Version) == 2, "UDP Response Version struct has wrong size"); | 117 | static_assert(sizeof(Version) == 2, "UDP Response Version struct has wrong size"); |
| 126 | static_assert(std::is_trivially_copyable_v<Version>, | 118 | static_assert(std::is_trivially_copyable_v<Version>, |
| 127 | "UDP Response Version is not trivially copyable"); | 119 | "UDP Response Version is not trivially copyable"); |
| 128 | 120 | ||
| 129 | struct PortInfo { | 121 | struct PortInfo { |
| 130 | u8 id{}; | 122 | u8 id{}; |
| @@ -135,10 +127,9 @@ struct PortInfo { | |||
| 135 | u8 battery{}; | 127 | u8 battery{}; |
| 136 | u8 is_pad_active{}; | 128 | u8 is_pad_active{}; |
| 137 | }; | 129 | }; |
| 138 | |||
| 139 | static_assert(sizeof(PortInfo) == 12, "UDP Response PortInfo struct has wrong size"); | 130 | static_assert(sizeof(PortInfo) == 12, "UDP Response PortInfo struct has wrong size"); |
| 140 | static_assert(std::is_trivially_copyable_v<PortInfo>, | 131 | static_assert(std::is_trivially_copyable_v<PortInfo>, |
| 141 | "UDP Response PortInfo is not trivially copyable"); | 132 | "UDP Response PortInfo is not trivially copyable"); |
| 142 | 133 | ||
| 143 | #pragma pack(push, 1) | 134 | #pragma pack(push, 1) |
| 144 | struct PadData { | 135 | struct PadData { |
| @@ -215,16 +206,16 @@ struct PadData { | |||
| 215 | 206 | ||
| 216 | static_assert(sizeof(PadData) == 80, "UDP Response PadData struct has wrong size "); | 207 | static_assert(sizeof(PadData) == 80, "UDP Response PadData struct has wrong size "); |
| 217 | static_assert(std::is_trivially_copyable_v<PadData>, | 208 | static_assert(std::is_trivially_copyable_v<PadData>, |
| 218 | "UDP Response PadData is not trivially copyable"); | 209 | "UDP Response PadData is not trivially copyable"); |
| 219 | 210 | ||
| 220 | static_assert(sizeof(Message<PadData>) == MAX_PACKET_SIZE, | 211 | static_assert(sizeof(Message<PadData>) == MAX_PACKET_SIZE, |
| 221 | "UDP MAX_PACKET_SIZE is no longer larger than Message<PadData>"); | 212 | "UDP MAX_PACKET_SIZE is no longer larger than Message<PadData>"); |
| 222 | 213 | ||
| 223 | static_assert(sizeof(PadData::AnalogButton) == 12, | 214 | static_assert(sizeof(PadData::AnalogButton) == 12, |
| 224 | "UDP Response AnalogButton struct has wrong size "); | 215 | "UDP Response AnalogButton struct has wrong size "); |
| 225 | static_assert(sizeof(PadData::TouchPad) == 6, "UDP Response TouchPad struct has wrong size "); | 216 | static_assert(sizeof(PadData::TouchPad) == 6, "UDP Response TouchPad struct has wrong size "); |
| 226 | static_assert(sizeof(PadData::Accelerometer) == 12, | 217 | static_assert(sizeof(PadData::Accelerometer) == 12, |
| 227 | "UDP Response Accelerometer struct has wrong size "); | 218 | "UDP Response Accelerometer struct has wrong size "); |
| 228 | static_assert(sizeof(PadData::Gyroscope) == 12, "UDP Response Gyroscope struct has wrong size "); | 219 | static_assert(sizeof(PadData::Gyroscope) == 12, "UDP Response Gyroscope struct has wrong size "); |
| 229 | 220 | ||
| 230 | /** | 221 | /** |
| @@ -241,27 +232,22 @@ template <> | |||
| 241 | constexpr Type GetMessageType<Request::Version>() { | 232 | constexpr Type GetMessageType<Request::Version>() { |
| 242 | return Type::Version; | 233 | return Type::Version; |
| 243 | } | 234 | } |
| 244 | |||
| 245 | template <> | 235 | template <> |
| 246 | constexpr Type GetMessageType<Request::PortInfo>() { | 236 | constexpr Type GetMessageType<Request::PortInfo>() { |
| 247 | return Type::PortInfo; | 237 | return Type::PortInfo; |
| 248 | } | 238 | } |
| 249 | |||
| 250 | template <> | 239 | template <> |
| 251 | constexpr Type GetMessageType<Request::PadData>() { | 240 | constexpr Type GetMessageType<Request::PadData>() { |
| 252 | return Type::PadData; | 241 | return Type::PadData; |
| 253 | } | 242 | } |
| 254 | |||
| 255 | template <> | 243 | template <> |
| 256 | constexpr Type GetMessageType<Response::Version>() { | 244 | constexpr Type GetMessageType<Response::Version>() { |
| 257 | return Type::Version; | 245 | return Type::Version; |
| 258 | } | 246 | } |
| 259 | |||
| 260 | template <> | 247 | template <> |
| 261 | constexpr Type GetMessageType<Response::PortInfo>() { | 248 | constexpr Type GetMessageType<Response::PortInfo>() { |
| 262 | return Type::PortInfo; | 249 | return Type::PortInfo; |
| 263 | } | 250 | } |
| 264 | |||
| 265 | template <> | 251 | template <> |
| 266 | constexpr Type GetMessageType<Response::PadData>() { | 252 | constexpr Type GetMessageType<Response::PadData>() { |
| 267 | return Type::PadData; | 253 | return Type::PadData; |