moonlight-stream / moonlight-android

GameStream client for Android
GNU General Public License v3.0
4k stars 632 forks source link

Bug: Moonlight not properly disconnecting USB virtual gamepad like it used to before exiting session #1091

Open sentix001 opened 2 years ago

sentix001 commented 2 years ago

Version 10.5

So the problem is when I then go leave the TV and go to the host PC if I turn on the XBOX Wireless controller it connects on P2 mode also shows 2 gamepads connecting

It didn't used to do do that, also what I tried was on the Android Box instead of using a USB gamepad as usual I connected a bluetooth one instead which I can turn off - if I turn it off before exiting the moonlight session it works fine and PC removes the extra virtual device correctly

So the problem is when exiting it's not removing the devices properly like it used to but since not all controllers have a turn off feature this like the bluetooth one I used this needs to be addressed

cgutman commented 2 years ago

This is actually (currently) intended behavior.

If you just disconnect from your gaming session on Moonlight (rather than using the Quit option in Moonlight to actually close the game), Moonlight leaves the controller state alone because it doesn't know if you're going to reconnect (maybe you just quit to change some streaming settings?). Some games don't support proper controller hotplugging, so removing the virtual controllers when you disconnect the stream will result in broken input when you reconnect.

However, Moonlight clients do have a compatibility option for legacy games (called "Automatic gamepad presence detection" on the Android client) which controls whether gamepad hotplug is enabled. If it is off, there will always be a single gamepad present for the lifetime of the launched app. I could implement this controller removal such that virtual controllers are only removed on stream disconnection if gamepad hotplug is enabled. Note that this would only work for graceful disconnections, because obviously you can't tell the PC to do anything if the connection is unexpectedly severed. Does that sound like it would meet your needs?

sentix001 commented 2 years ago

Sorry I meant i'm exiting the session fully, I always do that due to having sound disabled when connected

On Thu, Jun 30, 2022, 5:08 AM Cameron Gutman @.***> wrote:

This is actually (currently) intended behavior.

If you just disconnect from your gaming session on Moonlight (rather than using the Quit option in Moonlight to actually close the game), Moonlight leaves the controller state alone because it doesn't know if you're going to reconnect (maybe you just quit to change some streaming settings?). Some games don't support proper controller hotplugging, so removing the virtual controllers when you disconnect the stream will result in broken input when you reconnect.

However, Moonlight clients do have a compatibility option for legacy games (called "Automatic gamepad presence detection" on the Android client) which controls whether gamepad hotplug is enabled. If it is off, there will always be a single gamepad present for the lifetime of the launched app. I could implement this controller removal such that virtual controllers are only removed on stream disconnection if gamepad hotplug is enabled. Note that this would only work for graceful disconnections, because obviously you can't tell the PC to do anything if the connection is unexpectedly severed. Does that sound like it would meet your needs?

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1091#issuecomment-1170700349, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2V4QJSHPJY5W3MK6UMP4TVRUFTRANCNFSM52HTUEMA . You are receiving this because you authored the thread.Message ID: @.***>

cgutman commented 2 years ago

Hmm, removing virtual gamepads when the game is terminated is something handled by GeForce Experience. I'm running the latest GeForce Experience 3.25.1.27 on my host and it's removing the gamepads properly when I exit the session.

sentix001 commented 2 years ago

Ok, figured it out so the bug doesn't happen if you have enabled the usb gamepad driver option. I figured since my android box recognized my gamepad on native games it didn't need the driver.

What's that actually for then?

Anyways it's still might effect next person who has it off so you might get take a look at it from my end with it enabled works good

Thanks for your time

On Thu, Jun 30, 2022, 5:30 AM Cameron Gutman @.***> wrote:

Hmm, removing virtual gamepads when the game is terminated is something handled by GeForce Experience. I'm running the latest GeForce Experience 3.25.1.27 on my host and it's removing the gamepads properly when I exit the session.

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1091#issuecomment-1170710285, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2V4QMSCMYCRFG7KTWCNS3VRUIEVANCNFSM52HTUEMA . You are receiving this because you authored the thread.Message ID: @.***>