From 16fb6a2c8dea36911caa03febb7b8a93d56d0530 Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Wed, 13 Mar 2019 00:03:10 -0400 Subject: [PATCH] UDS: implement ConnectToNetworkDeprecated and forward params to ConnectToNetwork --- src/core/hle/service/nwm/nwm_uds.cpp | 20 +++++++++++++++++++- src/core/hle/service/nwm/nwm_uds.h | 16 ++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/nwm/nwm_uds.cpp b/src/core/hle/service/nwm/nwm_uds.cpp index 98a2d84b8..c078e1b7d 100644 --- a/src/core/hle/service/nwm/nwm_uds.cpp +++ b/src/core/hle/service/nwm/nwm_uds.cpp @@ -1207,6 +1207,24 @@ void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NWM, "called"); } +void NWM_UDS::ConnectToNetworkDeprecated(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x09, 0x11, 2); + + // Similar to BeginHostingNetworkDeprecated, we only read the first 0x3C bytes into the network + // info + const auto network_info_buffer = rp.PopRaw>(); + + u8 connection_type = rp.Pop(); + u32 passphrase_size = rp.Pop(); + + 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"); +} + void NWM_UDS::SetApplicationData(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x10, 1, 2); @@ -1330,7 +1348,7 @@ NWM_UDS::NWM_UDS(Core::System& system) : ServiceFramework("nwm::UDS"), system(sy {0x00060000, nullptr, "EjectSpectator"}, {0x00070080, &NWM_UDS::UpdateNetworkAttribute, "UpdateNetworkAttribute"}, {0x00080000, &NWM_UDS::DestroyNetwork, "DestroyNetwork"}, - {0x00090442, nullptr, "ConnectNetwork (deprecated)"}, + {0x00090442, &NWM_UDS::ConnectToNetworkDeprecated, "ConnectToNetwork (deprecated)"}, {0x000A0000, &NWM_UDS::DisconnectNetwork, "DisconnectNetwork"}, {0x000B0000, &NWM_UDS::GetConnectionStatus, "GetConnectionStatus"}, {0x000D0040, &NWM_UDS::GetNodeInformation, "GetNodeInformation"}, diff --git a/src/core/hle/service/nwm/nwm_uds.h b/src/core/hle/service/nwm/nwm_uds.h index cd02e7000..28413d7cb 100644 --- a/src/core/hle/service/nwm/nwm_uds.h +++ b/src/core/hle/service/nwm/nwm_uds.h @@ -378,6 +378,22 @@ private: */ void ConnectToNetwork(Kernel::HLERequestContext& ctx); + /** + * NWM_UDS::ConnectToNetwork Deprecatedservice function. + * This connects to the specified network + * Inputs: + * 0 : Command header + * 1 - 15 : the NetworkInfo structure, excluding application data + * 16 : Connection type: 0x1 = Client, 0x2 = Spectator. + * 17 : Passphrase buffer size + * 18 : (PassphraseSize<<12) | 2 + * 19 : Input passphrase buffer ptr + * Outputs: + * 0 : Return header + * 1 : Result of function, 0 on success, otherwise error code + */ + void ConnectToNetworkDeprecated(Kernel::HLERequestContext& ctx); + /** * NWM_UDS::DecryptBeaconData service function. * Decrypts the encrypted data tags contained in the 802.11 beacons.