1
0
forked from Clones/Controlify

✏️ Make rumble effects merge together rather than pausing one another when playing in unison (plays the stronger magnitude for both motors)

This commit is contained in:
isXander
2023-08-10 23:59:43 +01:00
parent 421b8abfc2
commit 58fe5c7043
9 changed files with 71 additions and 49 deletions

View File

@ -91,16 +91,9 @@ public class SingleJoystickController extends AbstractController<JoystickState,
}
@Override
public boolean setRumble(float strongMagnitude, float weakMagnitude, RumbleSource source) {
public boolean setRumble(float strongMagnitude, float weakMagnitude) {
if (!supportsRumble()) return false;
var strengthMod = config().getRumbleStrength(source);
if (source != RumbleSource.MASTER)
strengthMod *= config().getRumbleStrength(RumbleSource.MASTER);
strongMagnitude *= strengthMod;
weakMagnitude *= strengthMod;
// the duration doesn't matter because we are not updating the joystick state,
// so there is never any SDL check to stop the rumble after the desired time.
if (!SDL.SDL_JoystickRumbleTriggers(ptrJoystick, (int)(strongMagnitude * 65535.0F), (int)(weakMagnitude * 65535.0F), 1)) {