mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
UDS: Return the correct error messages in SendTo when not connected to a network or trying to send to itself.
This commit is contained in:
parent
7efb64132d
commit
61ce89a55a
1 changed files with 13 additions and 6 deletions
|
@ -404,16 +404,23 @@ static void SendTo(Interface* self) {
|
||||||
const VAddr input_address = rp.PopStaticBuffer(&desc_size, false);
|
const VAddr input_address = rp.PopStaticBuffer(&desc_size, false);
|
||||||
ASSERT(desc_size == data_size);
|
ASSERT(desc_size == data_size);
|
||||||
|
|
||||||
// TODO(Subv): Figure out the error if this is called while not connected to a network.
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
if (connection_status.status == static_cast<u32>(NetworkStatus::ConnectedAsClient) ||
|
|
||||||
connection_status.status == static_cast<u32>(NetworkStatus::ConnectedAsHost)) {
|
if (connection_status.status != static_cast<u32>(NetworkStatus::ConnectedAsClient) &&
|
||||||
ASSERT_MSG(false, "Not connected to a network (unimplemented)");
|
connection_status.status != static_cast<u32>(NetworkStatus::ConnectedAsHost)) {
|
||||||
|
rb.Push(ResultCode(ErrorDescription::NotAuthorized, ErrorModule::UDS,
|
||||||
|
ErrorSummary::InvalidState, ErrorLevel::Status));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dest_node_id == connection_status.network_node_id) {
|
||||||
|
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::UDS,
|
||||||
|
ErrorSummary::WrongArgument, ErrorLevel::Status));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(Subv): Do something with the flags.
|
// TODO(Subv): Do something with the flags.
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
||||||
|
|
||||||
constexpr size_t MaxSize = 0x5C6;
|
constexpr size_t MaxSize = 0x5C6;
|
||||||
if (data_size > MaxSize) {
|
if (data_size > MaxSize) {
|
||||||
rb.Push(ResultCode(ErrorDescription::TooLarge, ErrorModule::UDS,
|
rb.Push(ResultCode(ErrorDescription::TooLarge, ErrorModule::UDS,
|
||||||
|
|
Loading…
Reference in a new issue