mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-10-20 07:24:42 +00:00
Adjust emulated rumble strength (#1288)
This commit is contained in:
@@ -2121,7 +2121,16 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
||||
else if (foundMatchingDevice && !vibrated && prefConfig.vibrateFallbackToDevice) {
|
||||
// We found a device to vibrate but it didn't have rumble support. The user
|
||||
// has requested us to vibrate the device in this case.
|
||||
rumbleSingleVibrator(deviceVibrator, lowFreqMotor, highFreqMotor);
|
||||
|
||||
// We cast the unsigned short value to a signed int before multiplying by
|
||||
// the preferred strength. The resulting value is capped at 65534 before
|
||||
// we cast it back to a short so it doesn't go above 100%.
|
||||
short lowFreqMotorAdjusted = (short)(Math.min((((lowFreqMotor & 0xffff)
|
||||
* prefConfig.vibrateFallbackToDeviceStrength) / 100), Short.MAX_VALUE*2));
|
||||
short highFreqMotorAdjusted = (short)(Math.min((((highFreqMotor & 0xffff)
|
||||
* prefConfig.vibrateFallbackToDeviceStrength) / 100), Short.MAX_VALUE*2));
|
||||
|
||||
rumbleSingleVibrator(deviceVibrator, lowFreqMotorAdjusted, highFreqMotorAdjusted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user