summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/nwm/nwm_uds.cpp10
-rw-r--r--src/core/hle/service/nwm/nwm_uds.h7
-rw-r--r--src/core/hle/service/nwm/uds_beacon.h3
3 files changed, 15 insertions, 5 deletions
diff --git a/src/core/hle/service/nwm/nwm_uds.cpp b/src/core/hle/service/nwm/nwm_uds.cpp
index 6c4600f25..e92900d48 100644
--- a/src/core/hle/service/nwm/nwm_uds.cpp
+++ b/src/core/hle/service/nwm/nwm_uds.cpp
@@ -215,6 +215,11 @@ static void GetConnectionStatus(Interface* self) {
215 rb.Push(RESULT_SUCCESS); 215 rb.Push(RESULT_SUCCESS);
216 rb.PushRaw(connection_status); 216 rb.PushRaw(connection_status);
217 217
218 // Reset the bitmask of changed nodes after each call to this
219 // function to prevent falsely informing games of outstanding
220 // changes in subsequent calls.
221 connection_status.changed_nodes = 0;
222
218 LOG_DEBUG(Service_NWM, "called"); 223 LOG_DEBUG(Service_NWM, "called");
219} 224}
220 225
@@ -314,8 +319,11 @@ static void BeginHostingNetwork(Interface* self) {
314 // The host is always the first node 319 // The host is always the first node
315 connection_status.network_node_id = 1; 320 connection_status.network_node_id = 1;
316 node_info[0].network_node_id = 1; 321 node_info[0].network_node_id = 1;
322 connection_status.nodes[0] = connection_status.network_node_id;
317 // Set the bit 0 in the nodes bitmask to indicate that node 1 is already taken. 323 // Set the bit 0 in the nodes bitmask to indicate that node 1 is already taken.
318 connection_status.node_bitmask |= 1; 324 connection_status.node_bitmask |= 1;
325 // Notify the application that the first node was set.
326 connection_status.changed_nodes |= 1;
319 327
320 // If the game has a preferred channel, use that instead. 328 // If the game has a preferred channel, use that instead.
321 if (network_info.channel != 0) 329 if (network_info.channel != 0)
@@ -352,6 +360,8 @@ static void DestroyNetwork(Interface* self) {
352 // Unschedule the beacon broadcast event. 360 // Unschedule the beacon broadcast event.
353 CoreTiming::UnscheduleEvent(beacon_broadcast_event, 0); 361 CoreTiming::UnscheduleEvent(beacon_broadcast_event, 0);
354 362
363 // TODO(Subv): Check if connection_status is indeed reset after this call.
364 connection_status = {};
355 connection_status.status = static_cast<u8>(NetworkStatus::NotConnected); 365 connection_status.status = static_cast<u8>(NetworkStatus::NotConnected);
356 connection_status_event->Signal(); 366 connection_status_event->Signal();
357 367
diff --git a/src/core/hle/service/nwm/nwm_uds.h b/src/core/hle/service/nwm/nwm_uds.h
index 29b146569..141f49f9c 100644
--- a/src/core/hle/service/nwm/nwm_uds.h
+++ b/src/core/hle/service/nwm/nwm_uds.h
@@ -24,6 +24,9 @@ const double MillisecondsPerTU = 1.024;
24// Interval measured in TU, the default value is 100TU = 102.4ms 24// Interval measured in TU, the default value is 100TU = 102.4ms
25const u16 DefaultBeaconInterval = 100; 25const u16 DefaultBeaconInterval = 100;
26 26
27/// The maximum number of nodes that can exist in an UDS session.
28constexpr u32 UDSMaxNodes = 16;
29
27struct NodeInfo { 30struct NodeInfo {
28 u64_le friend_code_seed; 31 u64_le friend_code_seed;
29 std::array<u16_le, 10> username; 32 std::array<u16_le, 10> username;
@@ -47,8 +50,8 @@ struct ConnectionStatus {
47 u32_le status; 50 u32_le status;
48 INSERT_PADDING_WORDS(1); 51 INSERT_PADDING_WORDS(1);
49 u16_le network_node_id; 52 u16_le network_node_id;
50 INSERT_PADDING_BYTES(2); 53 u16_le changed_nodes;
51 INSERT_PADDING_BYTES(32); 54 u16_le nodes[UDSMaxNodes];
52 u8 total_nodes; 55 u8 total_nodes;
53 u8 max_nodes; 56 u8 max_nodes;
54 u16_le node_bitmask; 57 u16_le node_bitmask;
diff --git a/src/core/hle/service/nwm/uds_beacon.h b/src/core/hle/service/nwm/uds_beacon.h
index 6df4c4f47..caacf4c6f 100644
--- a/src/core/hle/service/nwm/uds_beacon.h
+++ b/src/core/hle/service/nwm/uds_beacon.h
@@ -15,9 +15,6 @@ namespace Service {
15namespace NWM { 15namespace NWM {
16 16
17using MacAddress = std::array<u8, 6>; 17using MacAddress = std::array<u8, 6>;
18
19/// The maximum number of nodes that can exist in an UDS session.
20constexpr u32 UDSMaxNodes = 16;
21constexpr std::array<u8, 3> NintendoOUI = {0x00, 0x1F, 0x32}; 18constexpr std::array<u8, 3> NintendoOUI = {0x00, 0x1F, 0x32};
22 19
23/// Additional block tag ids in the Beacon frames 20/// Additional block tag ids in the Beacon frames