
Hi all,
I've recently been inspired to attempt to Emulate USB devices for the Dolphin, and in particular the "Portal of Power" for the Skylanders games, heavily inspired by the work done in RPCS3. I've managed to make good progress on the Control Transfers in particular, where responses should occur instantaneously, however I am caught now trying to handle Interrupt transfers. As Interrupt Transfers take a while to process (approx. 22ms), these need to be handled Asynchronously, to allow other transfers to continue to occur as the game runs. RPCS3 has a 'Usb Handler Thread' where they handle responses to fake transfers made, but currently Dolphin only uses Libusb to handle real USB transfers, and these transfers have a Callback function which then processes the IPC reply. When I have tried to implement a Fake Transfer Thread, I get a segmentation faults or bus errors, presumably as I am trying to reference the TransferCommand out of scope or simply this Fake Transfer Thread cannot access the area of memory in which the Transfer Command exists.
I have an M1 Macbook Pro and a real Skylanders Trap Team portal, so I know what needs to be returned based on what protocol is being called, but any guidance on how/where to handle callbacks for Fake Transfers would be greatly appreciated! Or if anyone wants to try to implement something similar, maybe we can try to combine our powers and see what we can achieve...
The link to my fork is here, and I still need to implement a few other smarts around checking for whether a real device is connected or not, however with no real device attached the game believes that the real portal is attached, so that's a start!
I've recently been inspired to attempt to Emulate USB devices for the Dolphin, and in particular the "Portal of Power" for the Skylanders games, heavily inspired by the work done in RPCS3. I've managed to make good progress on the Control Transfers in particular, where responses should occur instantaneously, however I am caught now trying to handle Interrupt transfers. As Interrupt Transfers take a while to process (approx. 22ms), these need to be handled Asynchronously, to allow other transfers to continue to occur as the game runs. RPCS3 has a 'Usb Handler Thread' where they handle responses to fake transfers made, but currently Dolphin only uses Libusb to handle real USB transfers, and these transfers have a Callback function which then processes the IPC reply. When I have tried to implement a Fake Transfer Thread, I get a segmentation faults or bus errors, presumably as I am trying to reference the TransferCommand out of scope or simply this Fake Transfer Thread cannot access the area of memory in which the Transfer Command exists.
I have an M1 Macbook Pro and a real Skylanders Trap Team portal, so I know what needs to be returned based on what protocol is being called, but any guidance on how/where to handle callbacks for Fake Transfers would be greatly appreciated! Or if anyone wants to try to implement something similar, maybe we can try to combine our powers and see what we can achieve...
The link to my fork is here, and I still need to implement a few other smarts around checking for whether a real device is connected or not, however with no real device attached the game believes that the real portal is attached, so that's a start!