diff --git a/libraries/libstratosphere/source/htcfs/htcfs_client_impl.cpp b/libraries/libstratosphere/source/htcfs/htcfs_client_impl.cpp index 67404632d..fbeacf55c 100644 --- a/libraries/libstratosphere/source/htcfs/htcfs_client_impl.cpp +++ b/libraries/libstratosphere/source/htcfs/htcfs_client_impl.cpp @@ -429,11 +429,13 @@ namespace ams::htcfs { R_TRY(this->CheckResponseHeader(response, request.packet_type)); /* Check the response body size. */ - R_UNLESS(response.body_size > 0, htcfs::ResultUnexpectedResponseBodySize()); + R_UNLESS(response.body_size >= 0, htcfs::ResultUnexpectedResponseBodySize()); R_UNLESS(static_cast(response.body_size) <= MaxPacketBodySize, htcfs::ResultUnexpectedResponseBodySize()); /* Receive the response body. */ - R_TRY(this->ReceiveFromRpcChannel(m_packet_buffer, response.body_size)); + if (response.body_size > 0) { + R_TRY(this->ReceiveFromRpcChannel(m_packet_buffer, response.body_size)); + } /* Check that we succeeded. */ R_TRY(ConvertHtcfsResult(response.params[0])); @@ -1332,7 +1334,7 @@ namespace ams::htcfs { m_header_factory.MakeWriteFileLargeHeader(std::addressof(request), handle, option.value, offset, buffer_size, DataChannelId); /* Send the request to the host. */ - R_TRY(this->SendRequest(request, buffer, buffer_size)); + R_TRY(this->SendRequest(request)); /* Receive response from the host. */ R_TRY(this->ReceiveFromRpcChannel(std::addressof(response), sizeof(response))); @@ -1537,4 +1539,5 @@ namespace ams::htcfs { return ResultSuccess(); } + } diff --git a/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl.cpp b/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl.cpp index b465eeadf..cbe7fed79 100644 --- a/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl.cpp +++ b/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl.cpp @@ -465,6 +465,9 @@ namespace ams::htclow::mux { /* Set max packet size. */ m_send_buffer.SetMaxPacketSize(max_packet_size); + + /* Set our total send size. */ + m_total_send_size = buf_size; } } diff --git a/libraries/libstratosphere/source/htclow/mux/htclow_mux_send_buffer.cpp b/libraries/libstratosphere/source/htclow/mux/htclow_mux_send_buffer.cpp index a7add6b21..4336d8d17 100644 --- a/libraries/libstratosphere/source/htclow/mux/htclow_mux_send_buffer.cpp +++ b/libraries/libstratosphere/source/htclow/mux/htclow_mux_send_buffer.cpp @@ -93,7 +93,7 @@ namespace ams::htclow::mux { /* Determine the sendable size. */ const auto offset = total_send_size - ring_buffer_data_size; - const auto sendable_size = std::min(share - offset, ring_buffer_data_size); + const auto sendable_size = m_flow_control_enabled ? std::min(share - offset, ring_buffer_data_size) : ring_buffer_data_size; if (sendable_size == 0) { return false; }