JayFoxRox / xqemu

Personal development repository for XQEMU (original Xbox Emulator)
14 stars 1 forks source link

Improve XID based on tests with real hardware #4

Closed JayFoxRox closed 6 years ago

JayFoxRox commented 6 years ago

This PR implements XID_GET_CAPABILITIES; corrects behaviour with interrupt-out; more accurately implements STALL conditions and truncations to actual length. The XID descriptor has also been dumped from a real gamepad.

I used a small test script to test behaviour of a real gamepad and then documented my findings on XboxDevWiki.

This fix is intended for Rallisport Challenge, but the following list of games was known to have input issues in XQEMU and should be tested again:

When testing this PR, don't forget to add ,port=3 to your input option to use "Port 1" on the virtual Xbox. Not all games accept gamepads of controllers plugged into other ports.

Working input after this change (most of which previously weren't working):

Probably errornously mentioned as input issues, not affected by PR:

Remaining work

This only patches xid.c (which was enough work already and required hours of testing). I hope someone else solves FIXME PR or manually moves these changes xid-sdl.c temporarily.

Furthermore the handling out output packets / force feedback was not checked. Due to the importance of this PR (fixes many games) I do not want to delay it further. As I'm unfamiliar with the QEMU API (which I find weird), the output-specific code can be considered pseudo-code only. When moving changes to xid-sdl this definitely has to be reviewed (as that provides an implementation of force feedback for the host).

I originally wanted to test this PR on Linux, comparing a real gamepad to the xid.c using my script. However, I did not find time for this. I'm confident this change is mostly correct, and direct comparisons with real hardware can be done later.

JayFoxRox commented 6 years ago

I have some of those games and will re-test them, then send a PR upstream - I'll create an issue about xid-sdl seperately.

(Also great idea to use a diff to color-code them! I'll probably adopt that technique, but use # to mark lines without changes)

JayFoxRox commented 6 years ago

TODO: Test like this on arch with this:

 make && x86_64-softmmu/qemu-system-x86_64 ~/Data/Downloads/archlinux-2018.07.01-x86_64.iso -m 512 -machine accel=kvm -fsdev local,security_model=passthrough,id=fsdev0,path=/home/fox/Data/Projects/xqemu-controller-test/ -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=h -nic user,model=virtio-net-pci -usb -device usb-xbox-gamepad -device usb-host,vendorid=0x45e,productid=0x289

In guest (maybe not entirely correct?):

mkdir h
mount -t 9p -o trans=virtio h h
pacman -S python-pip
pip3 install libusb1
JayFoxRox commented 6 years ago

Moved upstream.. finally!