File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
src/main/java/nekomods/deckcontrols Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,7 @@ public void run() {
167
167
int lastPressedButtons = 0 ;
168
168
long last_frame_id = -1 ;
169
169
long last_frame_nanos = -1 ;
170
+ long last_reenable_gyro_nanos = -1 ;
170
171
int frame_times_i = 0 ;
171
172
// mouse smoothing
172
173
int last_mouse_pad_x = 0 ;
@@ -190,6 +191,12 @@ public void run() {
190
191
191
192
long current_nanos = Util .getNanos ();
192
193
194
+ // Turn gyro back on every second; fix for new Steam client
195
+ if (current_nanos - last_reenable_gyro_nanos > 1_000_000_000 ) {
196
+ turnGyroOn ();
197
+ last_reenable_gyro_nanos = current_nanos ;
198
+ }
199
+
193
200
long frame_id = (buf [4 ] & 0xFF ) | ((buf [5 ] & 0xFF ) << 8 ) | ((buf [6 ] & 0xFF ) << 16 ) | ((buf [7 ] & 0xFF ) << 24 );
194
201
if (last_frame_id != -1 ) {
195
202
if (last_frame_id - frame_id > 1 ) {
@@ -435,4 +442,19 @@ public boolean tick(boolean leftRight) {
435
442
// HIDIOCSFEATURE
436
443
return LibcIo .ioctl (fd , 0xC0414806 , buf ) == 0 ;
437
444
}
445
+
446
+ public boolean turnGyroOn () {
447
+ // no, we never want to turn the gyro off
448
+
449
+ byte [] buf = new byte [65 ];
450
+ buf [0 ] = 0x00 ;
451
+ buf [1 ] = (byte )0x87 ;
452
+ buf [2 ] = 0x03 ;
453
+ buf [3 ] = 0x30 ;
454
+ buf [4 ] = 0x18 ;
455
+ buf [5 ] = 0x00 ;
456
+
457
+ // HIDIOCSFEATURE
458
+ return LibcIo .ioctl (fd , 0xC0414806 , buf ) == 0 ;
459
+ }
438
460
}
You can’t perform that action at this time.
0 commit comments