From 4243c1198ff960bcf5cfaaf38cc5cc1689a2bafd Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 13 Mar 2017 22:21:01 -0500 Subject: [PATCH] Services/UDS: Store the entire NetworkInfo structure that was used to create the network. It will be needed when generating the beacon frames. --- src/core/hle/service/nwm/nwm_uds.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/core/hle/service/nwm/nwm_uds.cpp b/src/core/hle/service/nwm/nwm_uds.cpp index 7894764183..b69c90ef1d 100644 --- a/src/core/hle/service/nwm/nwm_uds.cpp +++ b/src/core/hle/service/nwm/nwm_uds.cpp @@ -38,11 +38,8 @@ static std::unordered_map> bind_node_event // Since we're not actually interacting with physical radio waves, this is just a dummy value. static u8 network_channel = DefaultNetworkChannel; -// The identifier of the network kind, this is used to filter away networks that we're not interested in. -static u32 wlan_comm_id = 0; - -// Application data that is sent when broadcasting the beacon frames. -static std::vector application_data; +// Information about the network that we're currently connected to. +static NetworkInfo network_info; /** * NWM_UDS::Shutdown service function @@ -244,12 +241,10 @@ static void BeginHostingNetwork(Interface* self) { LOG_DEBUG(Service_NWM, "called"); - NetworkInfo network_info; Memory::ReadBlock(network_info_address, &network_info, sizeof(NetworkInfo)); connection_status.status = static_cast(NetworkStatus::ConnectedAsHost); connection_status.max_nodes = network_info.max_nodes; - wlan_comm_id = network_info.wlan_comm_id; // There's currently only one node in the network (the host). connection_status.total_nodes = 1; @@ -263,9 +258,6 @@ static void BeginHostingNetwork(Interface* self) { if (network_info.channel != 0) network_channel = network_info.channel; - // Clear the pre-existing application data. - application_data.clear(); - connection_status_event->Signal(); // TODO(Subv): Start broadcasting the network, send a beacon frame every 102.4ms. @@ -333,8 +325,8 @@ static void SetApplicationData(Interface* self) { return; } - application_data.resize(size); - Memory::ReadBlock(address, application_data.data(), size); + network_info.application_data_size = size; + Memory::ReadBlock(address, network_info.application_data.data(), size); rb.Push(RESULT_SUCCESS); } @@ -379,7 +371,7 @@ NWM_UDS::NWM_UDS() { } NWM_UDS::~NWM_UDS() { - application_data.clear(); + network_info = {}; bind_node_events.clear(); connection_status_event = nullptr; recv_buffer_memory = nullptr;