Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support using android device's gyros as mouse, for aiming assist #1200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Williangalvani
Copy link

This allows for a Breath-of-the-wild-ish experience. This does confuse a couple of games such as Red dead redemption (where the tips keep switching between keyboard/mouse and joystick very fast).

This also makes using the touchscreen as mouse a bit weird.

Maybe this should add the mouse movement to the joystick readings instead?

anyway, opening this for visibility and feedback =]

Related to #1155 ?

@comanel
Copy link

comanel commented May 26, 2023

@Williangalvani, i've noticed that when using Steam controller gyro set as mouse input, if i also send a low value analog input (like left trigger, but lower than any game's input threshold) at the same time, the interface won't switch from Xinput to KB/M. Could you pass on some ghost analog input value when you do the conn.SendMouseMove(x, y) ?

not to mention that an in-stream toggle would also be helpful (maybe mirror from turning mouse emulation on/off by holing the start button, one can do the same by holding the select button)

@Williangalvani
Copy link
Author

@comanel great ideas, I'll try it. I also experimented with sending only joystick values instead, but that didn't quite do it either. I'll try your suggestions!

@csolisr
Copy link

csolisr commented Jul 12, 2023

Any plans to continue on this PR? Can we merge it as it currently is, and leave the "gyro as stick" to another PR?

@comanel
Copy link

comanel commented Jul 13, 2023 via email

@cgutman
Copy link
Member

cgutman commented Jul 14, 2023

It's a good PoC, but this PR can't be merged as is. There are a few issues:

  • It changes the manifest so Moonlight won't install on devices without a gyroscope
  • There's no way to actually turn it off (SensorEventListener is always registered using additional power)
  • Sensor readings come in a fixed orientation and need to be adjusted for the orientation of the screen (landscape vs reverse landscape)
  • It doesn't disable sensors when the activity enters PiP mode

Now that we can send motion events to the host natively using the new Sunshine protocol extensions, I think the best approach is to implement 4 gyro control options:

  • Use gamepad motion sensors (already implemented)
  • Use device motion sensors for gamepads that lack motion sensors
  • Use device motion sensors for on-screen controls
  • Use device motion sensors for mouse control

I suspect the first 3 will cover the vast majority of use cases. Since we're passing the gyroscope and accelerometer data to the host via the emulated DualShock 4 controller now in Sunshine nightly, users can do whatever stuff they want with it using Steam Input or similar tools. They can use it natively in games that support motion controls or map it to whatever control they want with Steam Input.

I can take a look at implementing these since I've been working on sensor stuff the last few days already.

@Williangalvani
Copy link
Author

I'm sorry, I've been low on time and last time I tried, the docker I used to build the apk was no longer working properly, my apks were not getting sensor data, idk why.
I'll try to pick this up again soon, but dealing with build issues is very frustrating.

@comanel
Copy link

comanel commented Jul 21, 2023 via email

@cgutman
Copy link
Member

cgutman commented Jul 24, 2023

Any chance you could mirror device sensor data as you do with controller gyro sensor data ?

Yep that's the plan.

@cgutman
Copy link
Member

cgutman commented Sep 17, 2023

The latest code in master adds support for gamepad motion sensor emulation using device sensors (off by default). Let me know how that works for you all.

@Marocco2
Copy link
Contributor

The latest code in master adds support for gamepad motion sensor emulation using device sensors (off by default). Let me know how that works for you all.

I've compiled and tried it on a Pixel 7 Pro but Steam won't recognize gyro even with DS4 and all options checked (Sunshine nightly)

@comanel
Copy link

comanel commented Sep 17, 2023 via email

@Marocco2
Copy link
Contributor

The latest code in master adds support for gamepad motion sensor emulation using device sensors (off by default). Let me know how that works for you all.

I've compiled and tried it on a Pixel 7 Pro but Steam won't recognize gyro even with DS4 and all options checked (Sunshine nightly)

Nevermind. Apparently it doesn't work with touch controls. Attaching a real controller and disabling gamepad motion but leaving emulation enabled will work as intended

@Marocco2
Copy link
Contributor

Marocco2 commented Sep 17, 2023

Could you please share a link with the android build, build on appveyor and I can't build it myself too soon..

I can share my compiled version: https://send.vis.ee/download/24e7ddf2be463119/#QGyF4fUiOUAJ_9vh13L6Ug

@comanel
Copy link

comanel commented Sep 17, 2023 via email

@comanel
Copy link

comanel commented Sep 17, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants