haze: pretend to be able to write MTP server code

This commit is contained in:
Liam 2023-10-16 17:31:09 -04:00
parent edb4e2ea56
commit 7f4450f930

View file

@ -257,10 +257,21 @@ namespace haze {
return property_code == -1 || code == property_code; return property_code == -1 || code == property_code;
}; };
/* Determine how many output elements we will report. */
u32 num_output_elements = 0;
for (const auto obj_property : SupportedObjectProperties) {
if (ShouldIncludeProperty(obj_property)) {
num_output_elements++;
}
}
/* Begin writing the requested object properties. */ /* Begin writing the requested object properties. */
PtpDataBuilder db(m_buffers->usb_bulk_write_buffer, std::addressof(m_usb_server)); PtpDataBuilder db(m_buffers->usb_bulk_write_buffer, std::addressof(m_usb_server));
R_TRY(db.WriteVariableLengthData(m_request_header, [&] { R_TRY(db.WriteVariableLengthData(m_request_header, [&] {
/* Report the number of elements. */
R_TRY(db.Add(num_output_elements));
for (const auto obj_property : SupportedObjectProperties) { for (const auto obj_property : SupportedObjectProperties) {
if (!ShouldIncludeProperty(obj_property)) { if (!ShouldIncludeProperty(obj_property)) {
continue; continue;