citra-emu
/
citra-canary
Archived
1
0
Fork 0

UDS: Add non zero mac address to the shared page

Apparently several games check the shared page mac address and wifi
link level values, and will refuse to start UDS if they are not correct.
This change gives a default value (in case you aren't connected to a
network) and will read the value from Room if you are connected.
This commit is contained in:
James Rowe 2018-02-16 18:38:28 -07:00
parent e2eab46535
commit ffe94421b2
3 changed files with 33 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include "core/hle/service/nwm/uds_beacon.h" #include "core/hle/service/nwm/uds_beacon.h"
#include "core/hle/service/nwm/uds_connection.h" #include "core/hle/service/nwm/uds_connection.h"
#include "core/hle/service/nwm/uds_data.h" #include "core/hle/service/nwm/uds_data.h"
#include "core/hle/shared_page.h"
#include "core/memory.h" #include "core/memory.h"
#include "network/network.h" #include "network/network.h"
@ -592,6 +593,12 @@ void NWM_UDS::InitializeWithVersion(Kernel::HLERequestContext& ctx) {
node_info.push_back(current_node); node_info.push_back(current_node);
} }
if (auto room_member = Network::GetRoomMember().lock()) {
if (room_member->IsConnected()) {
SharedPage::SetMacAddress(static_cast<SharedPage::MacAddress>(room_member->GetMacAddress()));
}
}
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(connection_status_event); rb.PushCopyObjects(connection_status_event);

View File

@ -83,6 +83,17 @@ void Init() {
update_time_event = update_time_event =
CoreTiming::RegisterEvent("SharedPage::UpdateTimeCallback", UpdateTimeCallback); CoreTiming::RegisterEvent("SharedPage::UpdateTimeCallback", UpdateTimeCallback);
CoreTiming::ScheduleEvent(0, update_time_event); 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<u8>(level);
} }
} // namespace } // namespace

View File

@ -37,6 +37,17 @@ union BatteryState {
BitField<2, 3, u8> charge_level; BitField<2, 3, u8> charge_level;
}; };
using MacAddress = std::array<u8, 6>;
// 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 { struct SharedPageDef {
// Most of these names are taken from the 3dbrew page linked above. // Most of these names are taken from the 3dbrew page linked above.
u32_le date_time_counter; // 0 u32_le date_time_counter; // 0
@ -66,4 +77,8 @@ extern SharedPageDef shared_page;
void Init(); void Init();
void SetMacAddress(const MacAddress&);
void SetWifiLinkLevel(WifiLinkLevel);
} // namespace } // namespace