Ryochan7 / sc-controller

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

Steam Deck roll axis is inverted when sent via cemuhook #88

Closed cyrozap closed 1 year ago

cyrozap commented 1 year ago

When using the gyroscope via sc-controller's cemuhook server, the motion doesn't appear to be mapped correctly. Specifically, the roll axis appears to be inverted.

I fixed the issue for myself with the following hack:

diff --git a/scc/special_actions.py b/scc/special_actions.py
index 08ffa3f8..69ae34f9 100644
--- a/scc/special_actions.py
+++ b/scc/special_actions.py
@@ -766,7 +766,7 @@ class CemuHookAction(Action, SpecialAction):
            mapper.state.accel_y / CemuHookAction.ACC_RES_PER_G, # AccelY
            pyr[0] * CemuHookAction.MAGIC_GYRO, # Gyro Pitch
            -pyr[1] * CemuHookAction.MAGIC_GYRO, # Gyro Yaw
-           -pyr[2] * CemuHookAction.MAGIC_GYRO, # Gyro Roll
+           pyr[2] * CemuHookAction.MAGIC_GYRO, # Gyro Roll
        )
        #log.debug(sa_data)
        self.execute(mapper, sa_data)

I assume we'll want to do the inversion earlier, though, to account for different controllers having different axis mappings/inversions. Or, maybe the gyro axis mapping/inversion could be made configurable.

Ryochan7 commented 1 year ago

I do not have a Steam Deck so I cannot test what the orientation for the Steam Deck gyro axes are. I am not familiar with any references (outside of this project) either. All actions should be using the same orientation system as the original Steam Controller. Going to have to edit the driver module and invert the roll there. Will edit that later.

Ryochan7 commented 1 year ago

Got the change submitted

cyrozap commented 1 year ago

Thanks, I'll try to test those changes (1737c41c49e405c18b91a2e27bcb3d821bdae606 and a2cc56584e6e74bee8ef14cabaa0e26129a426dc) this weekend and report the results.

I think the issue is with the difference in orientations relative to the screen between the Steam Controller and the Steam Deck's controller. That is to say, the Steam Controller is usually used with the plane of the ABXY buttons perpendicular to the plane of the screen, while the Steam Deck's controller is oriented with the ABXY buttons and the screen in the same plane.

If you want to test if the issue is present with the original Steam Controller as well (which I might just test myself, since I have one), it's easy to encounter the issue when emulating a certain popular action-adventure game by a certain litigious video game publisher. One of the puzzles in that game involves guiding a ball through a maze, where the orientation of the maze is controlled directly by the orientation of the gamepad. This puzzle makes it very easy to debug issues with the mapping of the gyroscopic inputs, since an incorrect mapping will immediately be reflected in the mismatched orientation of the ball maze.