[Solved] Multiple Mice on Flycast and lr-fbneo
pjft last edited by pjft
Apologies for the topic, but after reading a lot of materials (documentation such as https://retropie.org.uk/docs/Spinners,-Trackballs,-Lightguns,-and-other-Mouse-Devices/ or topics https://retropie.org.uk/forum/topic/25132/are-multiple-mice-supported-or-was-that-feature-trashed/21?_=1601226041031) and still being stuck, I'm starting to think that maybe it's something really obvious that I'm failing to figure out.
I'm trying to get dual mouse/lightgun controls on lr-fbneo and lr-flycast, but I'm consistently failing to do so. I can do it in lr-mame2003 without any issue using the same approach and I'm stuck at the exact same place/symptoms as https://github.com/libretro/flycast/issues/562 , which may suggest it's an actual bug in the core or even RetroArch, but before raising it there I wanted to run this be the wider community.
What can I get to work:
- The emulators recognize the two devices, and the buttons from each device register independently and correctly to the expected player in-game. This is done by mapping the Mouse Index to the specific Input in RetroArch's Settings > Input menu. I'm also using the udev input and joypad drivers.
What happens that doesn't work:
- The two mouse devices end up controlling the exact same crosshair. I cannot for the life of me figure out why. In lr-mame2003 this is not the case - I can get both crosshairs to control independently.
I have set different mouse indexes, I'm a bit at a loss here.
Has anyone tried this successfully, or can point me in the right direction?
I'm on RetroArch 1.8.4 and using Flycast from the recent binary from September 3rd. I confirm that the two mice register separately when I run
1. Official image, Raspberry Pi 4, etc. Testing it out with two USB mice, but result is the same with two USB lightguns (which is what I'm trying to set up).
An easy way to see this happen is to turn on the crosshair icons in the Flycast options - for instance, red and blue - you'll see it show with a purple hue (which results from both crosshairs overlapping).
Here are my logs:
runcommand.log - https://pastebin.com/ZLta5Fv4
The main interesting thing are two lines saying:
[INFO] Connecting to port 4: Light Gun (ID: 1). [INFO] Connecting to port 4: Light Gun (ID: 2).
in the sense that I expected them to be connected to different ports each, but what do I know.
Here are my config files:
and core options: https://pastebin.com/xu3VVt05
Any help and pointers appreciated. I am inclined to believe this may be an issue with the actual cores, but would love to hear your thoughts on anything else I might be missing or should explore.
So, a small update. I tried in a fresh RetroPie image and the same happens.
Now, when I messed in FBNeo, it failed the same way when in Lightgun mode, but if I set the device to pointer it works independently (though it brings other problems). The way it fails is the same as in Flycast - the cursor is controlled by both - which may suggest that the issue is further upstream in the RetroArch Lightgun device implementation.
I'll go look into it and if I find something I'll share.
@pjft I did a bit of debug on this, whether i query device for p1 or device for p2, retroarch is returning the same values, i believe it's because those device types (at the very least, when a mouse is used) query the absolute coordinates of your pointer on the screen from your OS, and OS doesn't understand the concept of having 2 different mouse with 2 different pointers on the screen.
@barbudreadmon Hi, long time no chat! Thank you so much for your time here.
I've also been debugging this, and after digging into the actual RetroArch code I managed to fix it, but I'm still figuring out what the best way to address it.
This branch here on the Pi doesn't work well:
It should run the code in the "else" branch - then it works.
I'm trying to figure out if it's something we can fix on the build script on RetroPie, or if I should submit the code upstream to RetroArch.
If you use the udev driver on Linux, this code works as intended.
What did you test it in, if you don't mind me asking? I have no way to test it on the other scenario and knowing if it's correct.
nvm, it actually does work after setting retroarch properly on my side.
i tested with FBNeo's
lethalenon desktop pc, with udev as
input_driverand "pointer" as device type for both controllers.
my prior error was that i had udev only for
@barbudreadmon Thanks. If you have the chance, could you test with "lightgun" on both? Pointer works on my end, but lightgun was the one that was broken.
In this cases, it's because we're compiling RA with the X11 flags, which take the code through a codepath that produces incorrect results. The non-X11 path there works correctly on the Pi.
If you don't have the time, it's alright - I'd just like to confirm whether I might break something by changing the X11 codepath.
Thank you for taking the time and hope you're doing well!
Pointer works on my end, but lightgun was the one that was broken.
Afaik, on pi/odroid and probably any SoC device, lightgun never worked with a mouse, that's actually why i added the pointer device type to FBNeo as a workaround.
Yes, i'm doing well :)
@barbudreadmon Good to hear :)
Thanks for the reply then - I'll propose a PR upstream, and I hope that others who know more about the original code might help shed some more light there.
Have a great day!