Ryochan7 / sc-controller

User-mode driver and GTK3 based GUI for Steam Controller
GNU General Public License v2.0
176 stars 23 forks source link

Fix CemuHook not working after controller left idle when using Dongle #81

Closed alexmaras closed 1 year ago

alexmaras commented 1 year ago

This issue affects the steam controller using the dongle. When it idles, the PT_IDLE check means that the controller no longer sends gyro input. Cemu will drop the server and ignore further input after some period of time if sc-controller isn't sending new UDP packets.

This starts up a new thread and sends all zeroes as the position of the gyro (which Cemu interprets as no movement) and keeps that cemuhook server alive. The pings will only be sent if no input has been seen for a second.

I've tested this leaving the controller flat on a table for a significant period and the gyro still works after returning. No phantom input is apparent. This will also allow the controller to completely shut off after being idle for long enough. Turning the controller back on will immediately send new gyro input and Cemu will carry on happily.

This is an issue present on this branch and on the original kozec repo. There is an issue here: https://github.com/kozec/sc-controller/issues/699

My PR on that repo also fixes the issue on the C branch, but it seems like both of these repos are stalled. This repo is the one packaged up for the arch AUR, so it would be nice to see it merged in for that.

Ryochan7 commented 1 year ago

With the current way the controller is initialized (in Dongle mode), this scenario would likely only happen when the controller is resting on a surface. I will test this out in a bit but I am not sure it is absolutely necessary.

alexmaras commented 1 year ago

Thanks. The problem I experienced is that I put my controller down, turn on cemu, launch the game and come back to it once the menu is up. By the time that happens, cemu and sc-controller have both dropped their connections and they won't reconnect until cemu is restarted.

Also putting the controller down during a cutscene doesn't seem particularly unusual to me, or even just placing it down on pause to go answer the door or anything like that. It only takes a few seconds for it to hit idle, and then a few seconds more for cemu to give up on the server. I'm often playing while working, so I pick up the controller while something I'm working on is deploying. Having to restart cemu every time makes that totally impractical.

Ryochan7 commented 1 year ago

Changes seem good. I would be curious if there is some form of flag to keep the connection alive even with no current input though. Might have to test some values when running the configure routine.