From 9771615f1638c2a548067717c12426539ad60541 Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 13 Mar 2017 16:53:20 -0500 Subject: Services/UDS: Initial support for hosting local-wlan networks. Currently it will let games create a network as hosts, but will not broadcast it anywhere and will not allow clients to connect. --- src/core/hle/service/nwm/nwm_uds.h | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'src/core/hle/service/nwm/nwm_uds.h') diff --git a/src/core/hle/service/nwm/nwm_uds.h b/src/core/hle/service/nwm/nwm_uds.h index 55db748f6..3dfc32de8 100644 --- a/src/core/hle/service/nwm/nwm_uds.h +++ b/src/core/hle/service/nwm/nwm_uds.h @@ -4,6 +4,10 @@ #pragma once +#include +#include +#include "common/common_types.h" +#include "common/swap.h" #include "core/hle/service/service.h" // Local-WLAN service @@ -11,6 +15,63 @@ namespace Service { namespace NWM { +const size_t ApplicationDataSize = 0xC8; +const u8 DefaultNetworkChannel = 11; + +struct NodeInfo { + u64_le friend_code_seed; + std::array username; + INSERT_PADDING_BYTES(4); + u16_le network_node_id; + INSERT_PADDING_BYTES(6); +}; + +static_assert(sizeof(NodeInfo) == 40, "NodeInfo has incorrect size."); + +enum class NetworkStatus { + NotConnected = 3, + ConnectedAsHost = 6, + ConnectedAsClient = 9, + ConnectedAsSpectator = 10, +}; + +struct ConnectionStatus { + u32_le status; + INSERT_PADDING_WORDS(1); + u16_le network_node_id; + INSERT_PADDING_BYTES(2); + INSERT_PADDING_BYTES(32); + u8 total_nodes; + u8 max_nodes; + u16_le node_bitmask; +}; + +static_assert(sizeof(ConnectionStatus) == 0x30, "ConnectionStatus has incorrect size."); + +struct NetworkInfo { + std::array host_mac_address; + u8 channel; + INSERT_PADDING_BYTES(1); + u8 initialized; + INSERT_PADDING_BYTES(3); + std::array oui_value; + u8 oui_type; + // This field is received as BigEndian from the game. + u32_be wlan_comm_id; + u8 id; + INSERT_PADDING_BYTES(1); + u16_be attributes; + u32_be network_id; + u8 total_nodes; + u8 max_nodes; + INSERT_PADDING_BYTES(2); + INSERT_PADDING_BYTES(0x1F); + u8 application_data_size; + std::array application_data; +}; + +static_assert(sizeof(NetworkInfo) == 0x108, "NetworkInfo has incorrect size."); + class NWM_UDS final : public Interface { public: NWM_UDS(); -- cgit v1.2.3