From 107686493567674563d6aa389e8ffbd8b5bea2aa Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Tue, 12 Mar 2019 21:53:07 -0400 Subject: [PATCH] UDS: implement InitializeDeprecated and forward params to Initialize --- src/core/hle/service/nwm/nwm_uds.cpp | 18 +++++++++++++++++- src/core/hle/service/nwm/nwm_uds.h | 15 +++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/nwm/nwm_uds.cpp b/src/core/hle/service/nwm/nwm_uds.cpp index 439764f225..3fb9326c55 100644 --- a/src/core/hle/service/nwm/nwm_uds.cpp +++ b/src/core/hle/service/nwm/nwm_uds.cpp @@ -664,6 +664,22 @@ void NWM_UDS::InitializeWithVersion(Kernel::HLERequestContext& ctx) { version); } +void NWM_UDS::InitializeDeprecated(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x01, 11, 2); + u32 sharedmem_size = rp.Pop(); + auto node = rp.PopRaw(); + auto sharedmem = rp.PopObject(); + + // The deprecated version uses fixed 0x100 as the version + auto result = Initialize(sharedmem_size, node, 0x100, std::move(sharedmem)); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(result.Code()); + rb.PushCopyObjects(result.ValueOr(nullptr)); + + LOG_DEBUG(Service_NWM, "called sharedmem_size=0x{:08X}", sharedmem_size); +} + void NWM_UDS::GetConnectionStatus(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0xB, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(13, 0); @@ -1272,7 +1288,7 @@ void NWM_UDS::BeaconBroadcastCallback(u64 userdata, s64 cycles_late) { NWM_UDS::NWM_UDS(Core::System& system) : ServiceFramework("nwm::UDS"), system(system) { static const FunctionInfo functions[] = { - {0x000102C2, nullptr, "Initialize (deprecated)"}, + {0x000102C2, &NWM_UDS::InitializeDeprecated, "Initialize (deprecated)"}, {0x00020000, nullptr, "Scrap"}, {0x00030000, &NWM_UDS::Shutdown, "Shutdown"}, {0x00040402, nullptr, "CreateNetwork (deprecated)"}, diff --git a/src/core/hle/service/nwm/nwm_uds.h b/src/core/hle/service/nwm/nwm_uds.h index 4008753551..0b59abd55a 100644 --- a/src/core/hle/service/nwm/nwm_uds.h +++ b/src/core/hle/service/nwm/nwm_uds.h @@ -320,6 +320,21 @@ private: */ void InitializeWithVersion(Kernel::HLERequestContext& ctx); + /** + * NWM_UDS::InitializeDeprecated service function + * Inputs: + * 1 : Shared memory size + * 2-11 : Input NodeInfo Structure + * 13 : Value 0 + * 14 : Shared memory handle + * Outputs: + * 0 : Return header + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Value 0 + * 3 : Output event handle + */ + void InitializeDeprecated(Kernel::HLERequestContext& ctx); + /** * NWM_UDS::BeginHostingNetwork service function. * Creates a network and starts broadcasting its presence.