UDS: divide IPC and impl for InitializeWithVersion

This commit is contained in:
Weiyi Wang 2019-03-12 21:44:04 -04:00
parent acaca4188e
commit 021c77bc9f
2 changed files with 23 additions and 13 deletions

View File

@ -615,20 +615,14 @@ void NWM_UDS::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) {
out_buffer_size, wlan_comm_id, id, unk1, unk2, cur_buffer_size);
}
void NWM_UDS::InitializeWithVersion(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x1B, 12, 2);
u32 sharedmem_size = rp.Pop<u32>();
// Update the node information with the data the game gave us.
rp.PopRaw(current_node);
u16 version = rp.Pop<u16>();
recv_buffer_memory = rp.PopObject<Kernel::SharedMemory>();
ResultVal<Kernel::SharedPtr<Kernel::Event>> NWM_UDS::Initialize(
u32 sharedmem_size, const NodeInfo& node, u16 version,
Kernel::SharedPtr<Kernel::SharedMemory> sharedmem) {
current_node = node;
initialized = true;
recv_buffer_memory = std::move(sharedmem);
ASSERT_MSG(recv_buffer_memory->GetSize() == sharedmem_size, "Invalid shared memory size.");
if (auto room_member = Network::GetRoomMember().lock()) {
@ -650,9 +644,21 @@ void NWM_UDS::InitializeWithVersion(Kernel::HLERequestContext& ctx) {
channel_data.clear();
}
return MakeResult(connection_status_event);
}
void NWM_UDS::InitializeWithVersion(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x1B, 12, 2);
u32 sharedmem_size = rp.Pop<u32>();
auto node = rp.PopRaw<NodeInfo>();
u16 version = rp.Pop<u16>();
auto sharedmem = rp.PopObject<Kernel::SharedMemory>();
auto result = Initialize(sharedmem_size, node, version, std::move(sharedmem));
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(connection_status_event);
rb.Push(result.Code());
rb.PushCopyObjects(result.ValueOr(nullptr));
LOG_DEBUG(Service_NWM, "called sharedmem_size=0x{:08X}, version=0x{:08X}", sharedmem_size,
version);

View File

@ -369,6 +369,10 @@ private:
*/
void DecryptBeaconData(Kernel::HLERequestContext& ctx);
ResultVal<Kernel::SharedPtr<Kernel::Event>> Initialize(
u32 sharedmem_size, const NodeInfo& node, u16 version,
Kernel::SharedPtr<Kernel::SharedMemory> sharedmem);
void BeaconBroadcastCallback(u64 userdata, s64 cycles_late);
/**