src/joystick/hidapi/SDL_hidapi_xboxone.c
changeset 13348 448528dc13da
parent 13344 0532eba8e423
child 13354 8c22865bd138
equal deleted inserted replaced
13347:99ecd178999f 13348:448528dc13da
   296     if (hid_write(dev, rumble_packet, sizeof(rumble_packet)) != sizeof(rumble_packet)) {
   296     if (hid_write(dev, rumble_packet, sizeof(rumble_packet)) != sizeof(rumble_packet)) {
   297         return SDL_SetError("Couldn't send rumble packet");
   297         return SDL_SetError("Couldn't send rumble packet");
   298     }
   298     }
   299 
   299 
   300     if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) {
   300     if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) {
   301         ctx->rumble_expiration = SDL_GetTicks() + duration_ms;
   301         ctx->rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS);
   302     } else {
   302     } else {
   303         ctx->rumble_expiration = 0;
   303         ctx->rumble_expiration = 0;
   304     }
   304     }
   305     return 0;
   305     return 0;
   306 }
   306 }