From fc0fe5c3c0c7a70690aa6a72b18a359d9432d144 Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Tue, 12 Mar 2019 23:53:03 -0400 Subject: [PATCH] UDS: devide IPC and impl for ConnectToNetwork --- src/core/hle/service/nwm/nwm_uds.cpp | 32 +++++++++++++++++----------- src/core/hle/service/nwm/nwm_uds.h | 4 ++++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/core/hle/service/nwm/nwm_uds.cpp b/src/core/hle/service/nwm/nwm_uds.cpp index 380417cc2..98a2d84b8 100644 --- a/src/core/hle/service/nwm/nwm_uds.cpp +++ b/src/core/hle/service/nwm/nwm_uds.cpp @@ -1165,18 +1165,11 @@ void NWM_UDS::GetChannel(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NWM, "called"); } -void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx) { - IPC::RequestParser rp(ctx, 0x1E, 2, 4); - - u8 connection_type = rp.Pop(); - u32 passphrase_size = rp.Pop(); - - const std::vector network_struct_buffer = rp.PopStaticBuffer(); - ASSERT(network_struct_buffer.size() == sizeof(NetworkInfo)); - - const std::vector passphrase = rp.PopStaticBuffer(); - - std::memcpy(&network_info, network_struct_buffer.data(), sizeof(network_info)); +void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx, const u8* network_info_buffer, + std::size_t network_info_size, u8 connection_type, + std::vector passphrase) { + network_info = {}; + std::memcpy(&network_info, network_info_buffer, network_info_size); // Start the connection sequence StartConnectionSequence(network_info.host_mac_address); @@ -1195,6 +1188,21 @@ void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); LOG_DEBUG(Service_NWM, "connection sequence finished"); }); +} + +void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x1E, 2, 4); + + u8 connection_type = rp.Pop(); + u32 passphrase_size = rp.Pop(); + + const std::vector network_info_buffer = rp.PopStaticBuffer(); + ASSERT(network_info_buffer.size() == sizeof(NetworkInfo)); + + std::vector passphrase = rp.PopStaticBuffer(); + + ConnectToNetwork(ctx, network_info_buffer.data(), network_info_buffer.size(), connection_type, + std::move(passphrase)); LOG_DEBUG(Service_NWM, "called"); } diff --git a/src/core/hle/service/nwm/nwm_uds.h b/src/core/hle/service/nwm/nwm_uds.h index 25898f7e4..cd02e7000 100644 --- a/src/core/hle/service/nwm/nwm_uds.h +++ b/src/core/hle/service/nwm/nwm_uds.h @@ -404,6 +404,10 @@ private: ResultCode BeginHostingNetwork(const u8* network_info_buffer, std::size_t network_info_size, std::vector passphrase); + void ConnectToNetwork(Kernel::HLERequestContext& ctx, const u8* network_info_buffer, + std::size_t network_info_size, u8 connection_type, + std::vector passphrase); + void BeaconBroadcastCallback(u64 userdata, s64 cycles_late); /**