diff --git a/src/core/hle/service/nwm/nwm_uds.cpp b/src/core/hle/service/nwm/nwm_uds.cpp index 43dbe59020..19bcf87e24 100644 --- a/src/core/hle/service/nwm/nwm_uds.cpp +++ b/src/core/hle/service/nwm/nwm_uds.cpp @@ -23,6 +23,7 @@ #include "core/hle/service/nwm/uds_beacon.h" #include "core/hle/service/nwm/uds_connection.h" #include "core/hle/service/nwm/uds_data.h" +#include "core/hle/shared_page.h" #include "core/memory.h" #include "network/network.h" @@ -592,6 +593,12 @@ void NWM_UDS::InitializeWithVersion(Kernel::HLERequestContext& ctx) { node_info.push_back(current_node); } + if (auto room_member = Network::GetRoomMember().lock()) { + if (room_member->IsConnected()) { + SharedPage::SetMacAddress(static_cast(room_member->GetMacAddress())); + } + } + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(connection_status_event); diff --git a/src/core/hle/shared_page.cpp b/src/core/hle/shared_page.cpp index eb9a874386..47e6369ef5 100644 --- a/src/core/hle/shared_page.cpp +++ b/src/core/hle/shared_page.cpp @@ -83,6 +83,17 @@ void Init() { update_time_event = CoreTiming::RegisterEvent("SharedPage::UpdateTimeCallback", UpdateTimeCallback); CoreTiming::ScheduleEvent(0, update_time_event); + + SetWifiLinkLevel(WifiLinkLevel::POOR); + SetMacAddress(DefaultMac); +} + +void SetMacAddress(const MacAddress& addr) { + std::memcpy(shared_page.wifi_macaddr, addr.data(), sizeof(MacAddress)); +} + +void SetWifiLinkLevel(WifiLinkLevel level) { + shared_page.wifi_link_level = static_cast(level); } } // namespace diff --git a/src/core/hle/shared_page.h b/src/core/hle/shared_page.h index 864695ae14..181932c4b9 100644 --- a/src/core/hle/shared_page.h +++ b/src/core/hle/shared_page.h @@ -37,6 +37,17 @@ union BatteryState { BitField<2, 3, u8> charge_level; }; +using MacAddress = std::array; + +// Default MAC address in the nintendo 3ds range +constexpr MacAddress DefaultMac = { 0x40, 0xF4, 0x07, 0x00, 0x00, 0x00 }; + +enum class WifiLinkLevel : u8 { + POOR = 0, + GOOD = 1, + BEST = 2, +}; + struct SharedPageDef { // Most of these names are taken from the 3dbrew page linked above. u32_le date_time_counter; // 0 @@ -66,4 +77,8 @@ extern SharedPageDef shared_page; void Init(); +void SetMacAddress(const MacAddress&); + +void SetWifiLinkLevel(WifiLinkLevel); + } // namespace