mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 06:29:00 +01:00
IOS/USB: Fix TransferCommand length type
The total buffer size for isochronous transfers should be a u32, not a u16. It is easy to hit the bug with devices such as cameras, which require larger buffers. This fixes Your Shape. This also fixes the length type for bulk and interrupt transfers, which should be u32 as that's what IOS supports. I'm not sure why I made them u16... probably because OH0 uses u16 for most lengths...
This commit is contained in:
parent
5226d6103a
commit
a6da38d75d
@ -127,14 +127,14 @@ struct CtrlMessage : TransferCommand
|
||||
|
||||
struct BulkMessage : TransferCommand
|
||||
{
|
||||
u16 length = 0;
|
||||
u32 length = 0;
|
||||
u8 endpoint = 0;
|
||||
using TransferCommand::TransferCommand;
|
||||
};
|
||||
|
||||
struct IntrMessage : TransferCommand
|
||||
{
|
||||
u16 length = 0;
|
||||
u32 length = 0;
|
||||
u8 endpoint = 0;
|
||||
using TransferCommand::TransferCommand;
|
||||
};
|
||||
@ -143,7 +143,7 @@ struct IsoMessage : TransferCommand
|
||||
{
|
||||
u32 packet_sizes_addr = 0;
|
||||
std::vector<u16> packet_sizes;
|
||||
u16 length = 0;
|
||||
u32 length = 0;
|
||||
u8 num_packets = 0;
|
||||
u8 endpoint = 0;
|
||||
using TransferCommand::TransferCommand;
|
||||
|
@ -87,7 +87,7 @@ V4IntrMessage::V4IntrMessage(Kernel& ios, const IOCtlRequest& ioctl) : IntrMessa
|
||||
{
|
||||
HIDRequest hid_request;
|
||||
Memory::CopyFromEmu(&hid_request, ioctl.buffer_in, sizeof(hid_request));
|
||||
length = static_cast<u16>(Common::swap32(hid_request.interrupt.length));
|
||||
length = Common::swap32(hid_request.interrupt.length);
|
||||
endpoint = static_cast<u8>(Common::swap32(hid_request.interrupt.endpoint));
|
||||
data_address = Common::swap32(hid_request.data_addr);
|
||||
}
|
||||
|
@ -31,14 +31,14 @@ V5CtrlMessage::V5CtrlMessage(Kernel& ios, const IOCtlVRequest& ioctlv)
|
||||
V5BulkMessage::V5BulkMessage(Kernel& ios, const IOCtlVRequest& ioctlv)
|
||||
: BulkMessage(ios, ioctlv, ioctlv.GetVector(1)->address)
|
||||
{
|
||||
length = static_cast<u16>(ioctlv.GetVector(1)->size);
|
||||
length = ioctlv.GetVector(1)->size;
|
||||
endpoint = Memory::Read_U8(ioctlv.in_vectors[0].address + 18);
|
||||
}
|
||||
|
||||
V5IntrMessage::V5IntrMessage(Kernel& ios, const IOCtlVRequest& ioctlv)
|
||||
: IntrMessage(ios, ioctlv, ioctlv.GetVector(1)->address)
|
||||
{
|
||||
length = static_cast<u16>(ioctlv.GetVector(1)->size);
|
||||
length = ioctlv.GetVector(1)->size;
|
||||
endpoint = Memory::Read_U8(ioctlv.in_vectors[0].address + 14);
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ V5IsoMessage::V5IsoMessage(Kernel& ios, const IOCtlVRequest& ioctlv)
|
||||
packet_sizes_addr = ioctlv.GetVector(1)->address;
|
||||
for (size_t i = 0; i < num_packets; ++i)
|
||||
packet_sizes.push_back(Memory::Read_U16(static_cast<u32>(packet_sizes_addr + i * sizeof(u16))));
|
||||
length = static_cast<u16>(ioctlv.GetVector(2)->size);
|
||||
length = ioctlv.GetVector(2)->size;
|
||||
}
|
||||
} // namespace USB
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user