UDS: implement InitializeDeprecated and forward params to Initialize

This commit is contained in:
Weiyi Wang 2019-03-12 21:53:07 -04:00
parent 021c77bc9f
commit 1076864935
2 changed files with 32 additions and 1 deletions

View File

@ -664,6 +664,22 @@ void NWM_UDS::InitializeWithVersion(Kernel::HLERequestContext& ctx) {
version); version);
} }
void NWM_UDS::InitializeDeprecated(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x01, 11, 2);
u32 sharedmem_size = rp.Pop<u32>();
auto node = rp.PopRaw<NodeInfo>();
auto sharedmem = rp.PopObject<Kernel::SharedMemory>();
// 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) { void NWM_UDS::GetConnectionStatus(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xB, 0, 0); IPC::RequestParser rp(ctx, 0xB, 0, 0);
IPC::RequestBuilder rb = rp.MakeBuilder(13, 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) { NWM_UDS::NWM_UDS(Core::System& system) : ServiceFramework("nwm::UDS"), system(system) {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0x000102C2, nullptr, "Initialize (deprecated)"}, {0x000102C2, &NWM_UDS::InitializeDeprecated, "Initialize (deprecated)"},
{0x00020000, nullptr, "Scrap"}, {0x00020000, nullptr, "Scrap"},
{0x00030000, &NWM_UDS::Shutdown, "Shutdown"}, {0x00030000, &NWM_UDS::Shutdown, "Shutdown"},
{0x00040402, nullptr, "CreateNetwork (deprecated)"}, {0x00040402, nullptr, "CreateNetwork (deprecated)"},

View File

@ -320,6 +320,21 @@ private:
*/ */
void InitializeWithVersion(Kernel::HLERequestContext& ctx); 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. * NWM_UDS::BeginHostingNetwork service function.
* Creates a network and starts broadcasting its presence. * Creates a network and starts broadcasting its presence.