moonlight-stream / moonlight-qt

GameStream client for PCs (Windows, Mac, Linux, and Steam Link)
GNU General Public License v3.0
10.82k stars 631 forks source link

Moonlight client gamepad not being detected in some games #510

Closed DeeeFoo closed 3 years ago

DeeeFoo commented 3 years ago

Hello all. So this is an issue that I've experienced in Moonlight, but am not sure if it's because of something in Moonlight, or because of something else.

Describe the bug So we know that if there's a controller configured to work with Moonlight, then it streams that gamepad's input as a Virtual USB Device to the host PC. The issue I'm experiencing is, if there's already a USB controller/gamepad connected to the host PC, then the controller used with Moonlight on the client side will not be detected in certain games. Is there a way to set controller priority so that the Moonlight client gamepad is always prioritized as Player 1? Or perhaps force both gamepads to appear as Player 1 so that there's no priority conflict?

Steps to reproduce Plug a USB controller/gamepad into the host PC, and keep it plugged in. It could be wired (like a Logitech F310), or a wireless 2.4Ghz USB dongle (this issue doesn't occur with Bluetooth gamepads like the Xbox One S controller). Then start up Moonlight on the client, and launch a game from the below list (I'm sure there are more games that are affected by this, but I've only tested the below). In certain games, the gamepad/controller on the client side won't be recognized/detected. If the USB controller is unplugged from the host PC and the game is re-launched, the client-side controller will be properly detected again.

Affected games Samurai Warriors: Spirit of Sanada (Steam) Resident Evil 7 (GamePass) Doom Eternal (GamePass) Star Wars Battlefront II (Epic)

Other Moonlight clients The same exact issue happens on the Android client, whether it's a physical gamepad connected to the device or the onscreen virtual gamepad.

Moonlight settings (please complete the following information)

Client PC details (please complete the following information)

Server PC details (please complete the following information)

Additional context So basically, what I think is happening is that the USB controller on the host PC is being detected first, and is assigned as Player 1. What's weird is that this even happens with wireless controllers when they're powered off. So long as the wireless USB dongle is connected, it doesn't matter if the controller itself is on or off, that controller will be detected first. When Moonlight on the client is launched and the gamepad is connected, it gets detected by the host PC as a Virtual USB Device, and is assigned as Player 2. Some games will scan for any input from all controllers, and whichever gamepad actuates an input first, the game then assigns that controller as Player 1. These games aren't an issue. However, some games (certain single-player games) only support 1 gamepad, and will usually just default to whatever controller is assigned the Player 1 slot. In this case, it's the USB controller connected to the host PC. If that USB controller is unplugged before the game launches, then the Moonlight controller will be detected properly.

However, since I split my usage evenly between gaming on the host PC and on Moonlight, I'd rather not have to remember to unplug the USB controller from the PC anytime I want to use Moonlight. Ideally, I'd just leave it plugged in, and the Moonlight controller will still work properly.

I've tried various fixes, such as uninstalling/removing all controllers from Device Manager, and then connecting them in the desired order (Moonlight gamepad first, then the USB). It worked for a while, but eventually it just reverts back to prioritizing the USB gamepad.

If this isn't an issue with Moonlight itself, then I apologize. If there's a workaround/fix for this outside of Moonlight, then I'm open to suggestions and ideas. Thank you.

cgutman commented 3 years ago

Yeah, your analysis is likely correct. Unfortunately this isn't something we can fix in Moonlight.

We report the controllers as they appear to us (starting with player 1), but if there are already controllers on the PC, the result will be unpredictable. Years ago, Nvidia did override connected controllers in GameStream, but I think they stopped doing that because it broke 2 player remote play.

DeeeFoo commented 3 years ago

Thanks for the response. I had a hunch that it was something out of Moonlight's control.

Do you have any ideas on any workarounds/fixes that can bypass this issue? I love Moonlight btw, it's awesome!

cgutman commented 3 years ago

Nothing specifically. Not sure if maybe InputMapper can do that?

Firegogglez commented 1 year ago

Hey guys did this ever get resolved or worked around? I have an original rumblepad I would love to get working over moonlight .. well it works sometimes.. it's really strange. I'm not even sure what I do to get it to work at this point I tried so many combinations. It would seem when I have the xbox controller on at the same time. it somehow makes the game see my rumblepad.. very weird.. the game I'm streaming is Star Wars Galaxies:Legends btw.. Any new info at all would be much appreciated.

Fell commented 3 months ago

Hey guys did this ever get resolved or worked around? I have an original rumblepad I would love to get working over moonlight .. well it works sometimes.. it's really strange. I'm not even sure what I do to get it to work at this point I tried so many combinations. It would seem when I have the xbox controller on at the same time. it somehow makes the game see my rumblepad.. very weird.. the game I'm streaming is Star Wars Galaxies:Legends btw.. Any new info at all would be much appreciated.

Your problem sounds an awful lot like what I had. If your host computer is Linux, then what I wrote here might help you.

Basically, some games were picking up devices that weren't even gamepads, like VR gear.