From d7500b36088ec11b170d98a75199da36124d327a Mon Sep 17 00:00:00 2001 From: yellows8 Date: Thu, 7 Apr 2016 10:04:48 -0400 Subject: [PATCH] Properly load the UDS network wifi channel, apparently it was hard-coded to channel 1 previously. This fixed the udsConnectNetwork() failures with the example app(not yet available under the 3ds-examples repo). --- libctru/include/3ds/services/uds.h | 9 ++++++--- libctru/source/services/uds.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libctru/include/3ds/services/uds.h b/libctru/include/3ds/services/uds.h index e894310..34fb566 100644 --- a/libctru/include/3ds/services/uds.h +++ b/libctru/include/3ds/services/uds.h @@ -39,8 +39,8 @@ typedef struct { /// Network struct stored as big-endian. typedef struct { u8 host_macaddress[6]; - u8 hostmacaddr_flag;//"This flag being set to non-zero presumably indicates that the MAC address is set." - u8 unk_x7; + u8 channel;//Wifi channel for this network. + u8 pad_x7; u8 initialized_flag;//Must be non-zero otherwise NWM-module will use zeros internally instead of the actual field data, for most/all(?) of the fields in this struct. @@ -95,7 +95,10 @@ typedef struct { /// General NWM output structure from AP scanning, for each entry. typedef struct { u32 size;//"Size of this entire entry. The next entry starts at curentry_startoffset+curentry_size." - u32 unk_x4; + u8 unk_x4; + u8 channel;//Wifi channel for the AP. + u8 unk_x6; + u8 unk_x7; u8 mac_address[6];//"AP MAC address." u8 unk_xe[6]; u32 unk_x14; diff --git a/libctru/source/services/uds.c b/libctru/source/services/uds.c index 1434f76..ded5e1d 100644 --- a/libctru/source/services/uds.c +++ b/libctru/source/services/uds.c @@ -694,7 +694,7 @@ static Result usd_parsebeacon(u8 *buf, u32 size, udsNetworkScanInfo *networkscan if(appdata_size)memcpy(networkscan->network.appdata, &tagptr[0x34], appdata_size); networkscan->network.initialized_flag = 1; - networkscan->network.hostmacaddr_flag = 1; + networkscan->network.channel = networkscan->datareply_entry.channel; memcpy(networkscan->network.host_macaddress, networkscan->datareply_entry.mac_address, sizeof(networkscan->network.host_macaddress)); }