Skip to content

Commit afa2724

Browse files
committed
Ignore sensor delta values that look like they're out of range
1 parent cd98b66 commit afa2724

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/joystick/hidapi/SDL_hidapi_8bitdo.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,10 @@ static void HIDAPI_Driver8BitDo_HandleStatePacket(SDL_Joystick *joystick, SDL_Dr
589589
} else {
590590
delta = (SDL_MAX_UINT32 - ctx->last_tick + tick + 1);
591591
}
592-
ctx->sensor_timestamp_interval = SDL_US_TO_NS(delta);
592+
// Sanity check the delta value
593+
if (delta < 100000) {
594+
ctx->sensor_timestamp_interval = SDL_US_TO_NS(delta);
595+
}
593596
}
594597
ctx->last_tick = tick;
595598
}

0 commit comments

Comments
 (0)