Skip to content

Commit f9f1ea4

Browse files
authored
Fix accelerometer axis to have correct data for orientation (#563)
1 parent 36346c1 commit f9f1ea4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

BetterJoyForCemu/Joycon.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,13 +1005,19 @@ private void ExtractIMUValues(byte[] report_buf, int n = 0) {
10051005
if (other == null && !isPro) { // single joycon mode; Z do not swap, rest do
10061006
if (isLeft) {
10071007
acc_g.X = -acc_g.X;
1008+
acc_g.Y = -acc_g.Y;
10081009
gyr_g.X = -gyr_g.X;
10091010
} else {
10101011
gyr_g.Y = -gyr_g.Y;
10111012
}
10121013

1013-
float temp = acc_g.X; acc_g.X = acc_g.Y; acc_g.Y = temp;
1014-
temp = gyr_g.X; gyr_g.X = gyr_g.Y; gyr_g.Y = temp;
1014+
float temp = acc_g.X;
1015+
acc_g.X = acc_g.Y;
1016+
acc_g.Y = -temp;
1017+
1018+
temp = gyr_g.X;
1019+
gyr_g.X = gyr_g.Y;
1020+
gyr_g.Y = temp;
10151021
}
10161022
}
10171023
}

0 commit comments

Comments
 (0)