NWM_UDS: More of wwyleles comments
This commit is contained in:
parent
cbf514190e
commit
237835a8b6
@ -519,8 +519,7 @@ void NWM_UDS::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) {
|
|||||||
Kernel::MappedBuffer out_buffer = rp.PopMappedBuffer();
|
Kernel::MappedBuffer out_buffer = rp.PopMappedBuffer();
|
||||||
ASSERT(out_buffer.GetSize() == out_buffer_size);
|
ASSERT(out_buffer.GetSize() == out_buffer_size);
|
||||||
|
|
||||||
size_t offset = sizeof(BeaconDataReplyHeader);
|
size_t cur_buffer_size = sizeof(BeaconDataReplyHeader);
|
||||||
u32 total_size = sizeof(BeaconDataReplyHeader);
|
|
||||||
|
|
||||||
// Retrieve all beacon frames that were received from the desired mac address.
|
// Retrieve all beacon frames that were received from the desired mac address.
|
||||||
auto beacons = GetReceivedBeacons(mac_address);
|
auto beacons = GetReceivedBeacons(mac_address);
|
||||||
@ -539,20 +538,18 @@ void NWM_UDS::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) {
|
|||||||
entry.header_size = sizeof(BeaconEntryHeader);
|
entry.header_size = sizeof(BeaconEntryHeader);
|
||||||
entry.mac_address = beacon.transmitter_address;
|
entry.mac_address = beacon.transmitter_address;
|
||||||
|
|
||||||
ASSERT(offset < out_buffer_size);
|
ASSERT(cur_buffer_size < out_buffer_size);
|
||||||
|
|
||||||
out_buffer.Write(&entry, offset, sizeof(BeaconEntryHeader));
|
out_buffer.Write(&entry, cur_buffer_size, sizeof(BeaconEntryHeader));
|
||||||
offset += sizeof(BeaconEntryHeader);
|
cur_buffer_size += sizeof(BeaconEntryHeader);
|
||||||
const unsigned char* beacon_data = beacon.data.data();
|
const unsigned char* beacon_data = beacon.data.data();
|
||||||
out_buffer.Write(beacon_data, offset,
|
out_buffer.Write(beacon_data, cur_buffer_size,
|
||||||
beacon.data.size());
|
beacon.data.size());
|
||||||
offset += beacon.data.size();
|
cur_buffer_size += beacon.data.size();
|
||||||
|
|
||||||
total_size += static_cast<u32>(sizeof(BeaconEntryHeader) + beacon.data.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the total size in the structure and write it to the buffer again.
|
// Update the total size in the structure and write it to the buffer again.
|
||||||
data_reply_header.total_size = total_size;
|
data_reply_header.total_size = cur_buffer_size;
|
||||||
out_buffer.Write(&data_reply_header, 0, sizeof(BeaconDataReplyHeader));
|
out_buffer.Write(&data_reply_header, 0, sizeof(BeaconDataReplyHeader));
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 1);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 1);
|
||||||
@ -561,7 +558,7 @@ void NWM_UDS::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
LOG_DEBUG(Service_NWM, "called out_buffer_size=0x%08X, wlan_comm_id=0x%08X, id=0x%08X,"
|
LOG_DEBUG(Service_NWM, "called out_buffer_size=0x%08X, wlan_comm_id=0x%08X, id=0x%08X,"
|
||||||
"unk1=0x%08X, unk2=0x%08X, offset=%zu",
|
"unk1=0x%08X, unk2=0x%08X, offset=%zu",
|
||||||
out_buffer_size, wlan_comm_id, id, unk1, unk2, offset);
|
out_buffer_size, wlan_comm_id, id, unk1, unk2, cur_buffer_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NWM_UDS::InitializeWithVersion(Kernel::HLERequestContext& ctx) {
|
void NWM_UDS::InitializeWithVersion(Kernel::HLERequestContext& ctx) {
|
||||||
@ -1087,8 +1084,8 @@ void NWM_UDS::SetApplicationData(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
u32 size = rp.Pop<u32>();
|
u32 size = rp.Pop<u32>();
|
||||||
|
|
||||||
const std::vector<u8> address = rp.PopStaticBuffer();
|
const std::vector<u8> application_data = rp.PopStaticBuffer();
|
||||||
ASSERT(address.size() == size);
|
ASSERT(application_data.size() == size);
|
||||||
|
|
||||||
LOG_DEBUG(Service_NWM, "called");
|
LOG_DEBUG(Service_NWM, "called");
|
||||||
|
|
||||||
@ -1101,7 +1098,7 @@ void NWM_UDS::SetApplicationData(Kernel::HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
network_info.application_data_size = size;
|
network_info.application_data_size = size;
|
||||||
std::memcpy(network_info.application_data.data(), address.data(), size);
|
std::memcpy(network_info.application_data.data(), application_data.data(), size);
|
||||||
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -181,6 +181,7 @@ private:
|
|||||||
* Outputs:
|
* Outputs:
|
||||||
* 0 : Return header
|
* 0 : Return header
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
|
* 2, 3: output buffer return descriptor & ptr
|
||||||
*/
|
*/
|
||||||
void RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx);
|
void RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
@ -337,6 +338,7 @@ private:
|
|||||||
* Outputs:
|
* Outputs:
|
||||||
* 0 : Return header
|
* 0 : Return header
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
|
* 2, 3: output buffer return descriptor & ptr
|
||||||
*/
|
*/
|
||||||
void DecryptBeaconData(Kernel::HLERequestContext& ctx);
|
void DecryptBeaconData(Kernel::HLERequestContext& ctx);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user