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:
@ -11,6 +11,7 @@ import dev.isxander.controlify.controller.joystick.mapping.RPJoystickMapping;
|
||||
import dev.isxander.controlify.rumble.RumbleCapable;
|
||||
import dev.isxander.controlify.rumble.RumbleManager;
|
||||
import dev.isxander.controlify.rumble.RumbleSource;
|
||||
import dev.isxander.controlify.rumble.RumbleState;
|
||||
import dev.isxander.controlify.utils.Log;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@ -143,7 +144,7 @@ public class CompoundJoystickController implements JoystickController<JoystickCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setRumble(float strongMagnitude, float weakMagnitude, RumbleSource source) {
|
||||
public boolean setRumble(float strongMagnitude, float weakMagnitude) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -152,6 +153,11 @@ public class CompoundJoystickController implements JoystickController<JoystickCo
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RumbleState applyRumbleSourceStrength(RumbleState state, RumbleSource source) {
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RumbleManager rumbleManager() {
|
||||
return this.rumbleManager;
|
||||
|
@ -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)) {
|
||||
|
Reference in New Issue
Block a user