You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -51,6 +52,11 @@ The latest version of JoyShockLibrary can always be found [here](https://github.
51
52
***float accelX, accelY, accelZ** - accelerometer X axis, Y axis, and Z axis, respectively, in g (g-force).
52
53
***float gyroX, gyroY, gyroZ** - gyroscope angular velocity X, Y, and Z, respectively, in dps (degrees per second), when correctly calibrated.
53
54
55
+
**struct MOTION_STATE** - The MOTION_STATE reports the orientation of the device as calculated using a sensor fusion solution to combine gyro and accelerometer data.
56
+
***float quatW, quatX, quatY, quatZ** - a quaternion representing the orientation of the device.
57
+
***float accelX, accelY, accelZ** - local acceleration after accounting for and removing the effect of gravity.
58
+
***float gravX, gravY, gravZ** - local gravity direction.
59
+
54
60
### Functions
55
61
56
62
All these functions *should* be thread-safe, and none of them should cause any harm if given the wrong handle. If they do, please report this to me as an isuse.
@@ -65,7 +71,9 @@ All these functions *should* be thread-safe, and none of them should cause any h
65
71
66
72
**IMU\_STATE JslGetIMUState(int deviceId)** - Get the latest accelerometer + gyroscope state for the controller with the given id.
67
73
68
-
**TOUCH_STATE JslGetTouchState(int deviceId)** - Get the latest touchpad state for the controller with the given id. Only DualShock 4s support this.
74
+
**MOTION\_STATE JslGetMotionState(int deviceId)** - Get the latest motion state for the controller with the given id.
75
+
76
+
**TOUCH\_STATE JslGetTouchState(int deviceId)** - Get the latest touchpad state for the controller with the given id. Only DualShock 4s support this.
69
77
70
78
**int JslGetButtons(int deviceId)** - Get the latest button state for the controller with the given id. If you want more than just the buttons, it's more efficient to use JslGetSimpleState.
71
79
@@ -137,9 +145,16 @@ The Nintendo devices report every 15ms, but their IMUs actually report every 5ms
137
145
138
146
In a future version I hope to either combine the 3 rotations in a way that works better in 3D, or to add a way for a single controller event to report several IMU events at the same time.
139
147
148
+
## Backwards Compatibility
149
+
JoyShockLibrary v2 changes the gyro and accelerometer axes from previous versions. Previous versions were inconsistent between gyro and accelerometer. When upgrading to JoyShockLibrary v2, in order to maintain previous behaviour:
150
+
* Invert Gyro X
151
+
* Swap Accel Z and Y
152
+
* Then invert Accel Z
153
+
140
154
## Credits
141
155
I'm Jibb Smart, and I made JoyShockLibrary. JoyShockLibrary has also benefited from the contributions of:
142
156
* Romeo Calota (Linux support + general portability improvements)
157
+
* RollinBarrel (touchpad support)
143
158
144
159
JoyShockLibrary uses substantial portions of mfosse's [JoyCon-Driver](https://github.com/mfosse/JoyCon-Driver), a [vJoy](http://vjoystick.sourceforge.net/site/) feeder for most communication with Nintendo devices, building on it with info from dekuNukem's [Nintendo Switch Reverse Engineering](https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/) page in order to (for example) unpack all gyro and accelerometer samples from each report.
145
160
@@ -152,7 +167,7 @@ This software depends on signal11's [HIDAPI](https://github.com/signal11/hidapi)
152
167
* Why gyro controls make gaming better;
153
168
* How developers can do a better job implementing gyro controls;
154
169
* How to use JoyShockLibrary;
155
-
* How gamers can play any PC game with gyro controls using [JoyShockMapper](https://github.com/JibbSmart/JoyShockMapper).
170
+
* How gamers can play any PC game with gyro controls using [JoyShockMapper](https://github.com/JibbSmart/JoyShockMapper), which uses JoyShockLibrary to read from supported controllers.
156
171
157
172
## License
158
173
JoyShockLibrary is licensed under the MIT License - see [LICENSE.md](LICENSE.md).
0 commit comments