1- package dev .isxander .controlify .driver . sdl .dualsense ;
1+ package dev .isxander .controlify .controller .dualsense ;
22
33import org .apache .commons .lang3 .Validate ;
44import org .jetbrains .annotations .NotNull ;
55import org .jetbrains .annotations .Range ;
66
7- public interface DualsenseTriggerEffect {
7+ public interface DS5TriggerEffect {
88 DS5EffectsState .TriggerEffect createState ();
99
1010 /**
1111 * Turn the trigger effect off and return the trigger stop to the neutral position.
12+ * <p>
1213 * This is an official effect and is expected to be present in future DualSense firmware versions.
1314 */
14- record Off () implements DualsenseTriggerEffect {
15+ record Off () implements DS5TriggerEffect {
1516 @ Override
1617 public DS5EffectsState .TriggerEffect createState () {
1718 return DS5EffectsState .TriggerEffect .OFF ;
@@ -21,6 +22,7 @@ public DS5EffectsState.TriggerEffect createState() {
2122 /**
2223 * Trigger will resist movement beyond the start position.
2324 * The trigger status nybble will report 0 before the effect and 1 when in the effect.
25+ * <p>
2426 * This is an official effect and is expected to be present in future DualSense firmware versions.
2527 *
2628 * @param position The starting zone of the trigger effect. Must be between 0 and 9 inclusive.
@@ -29,7 +31,7 @@ public DS5EffectsState.TriggerEffect createState() {
2931 record Feedback (
3032 @ Range (from = 0 , to = 9 ) byte position ,
3133 @ Range (from = 0 , to = 8 ) byte strength
32- ) implements DualsenseTriggerEffect {
34+ ) implements DS5TriggerEffect {
3335 public Feedback {
3436 Validate .inclusiveBetween (0 , 9 , position , "Position must be between 0 and 9 inclusive" );
3537 Validate .inclusiveBetween (0 , 8 , strength , "Strength must be between 0 and 8 inclusive" );
@@ -46,7 +48,7 @@ public DS5EffectsState.TriggerEffect createState() {
4648 activeZones |= (char ) (1 << i );
4749 }
4850
49- return new DS5EffectsState .TriggerEffect (DualsenseTriggerEffectTypes .FEEDBACK , new byte []{
51+ return new DS5EffectsState .TriggerEffect (DS5TriggerEffectTypes .FEEDBACK , new byte []{
5052 (byte ) (activeZones & 0xff ),
5153 (byte ) ((activeZones >> 8 ) & 0xff ),
5254 (byte ) (forceZones & 0xff ),
@@ -64,6 +66,7 @@ public DS5EffectsState.TriggerEffect createState() {
6466 * Trigger will resist movement beyond the start position until the end position.
6567 * The trigger status nybble will report 0 before the effect and 1 when in the effect,
6668 * and 2 after until again before the start position.
69+ * <p>
6770 * This is an official effect and is expected to be present in future DualSense firmware versions.
6871 *
6972 * @param startPosition The starting zone of the trigger effect. Must be between 2 and 7 inclusive.
@@ -74,7 +77,7 @@ record Weapon(
7477 @ Range (from = 2 , to = 7 ) byte startPosition ,
7578 @ Range (from = 2 +1 , to = 8 ) byte endPosition ,
7679 @ Range (from = 0 , to = 8 ) byte strength
77- ) implements DualsenseTriggerEffect {
80+ ) implements DS5TriggerEffect {
7881 public Weapon {
7982 Validate .inclusiveBetween (2 , 7 , startPosition , "Start position must be between 2 and 7 inclusive" );
8083 Validate .inclusiveBetween (startPosition +1 , 8 , endPosition , "End position must be between start+1 and 8 inclusive" );
@@ -87,7 +90,7 @@ public DS5EffectsState.TriggerEffect createState() {
8790 if (strength > 0 ) {
8891 char startAndStopZones = (char ) ((1 << startPosition ) | (1 << endPosition ));
8992
90- return new DS5EffectsState .TriggerEffect (DualsenseTriggerEffectTypes .WEAPON , new byte []{
93+ return new DS5EffectsState .TriggerEffect (DS5TriggerEffectTypes .WEAPON , new byte []{
9194 (byte ) (startAndStopZones & 0xff ),
9295 (byte ) ((startAndStopZones >> 8 ) & 0xff ),
9396 (byte ) (strength - 1 ), // this is actually packed into 3 bits, but since it's only one why bother with the fancy code?
@@ -101,6 +104,7 @@ public DS5EffectsState.TriggerEffect createState() {
101104 /**
102105 * Trigger will vibrate with the input amplitude and frequency beyond the start position.
103106 * The trigger status nybble will report 0 before the effect and 1 when in the effect.
107+ * <p>
104108 * This is an official effect and is expected to be present in future DualSense firmware versions.
105109 *
106110 * @see VibrationMultiplePosition
@@ -113,7 +117,7 @@ record Vibration(
113117 @ Range (from = 0 , to = 9 ) byte position ,
114118 @ Range (from = 0 , to = 8 ) byte amplitude ,
115119 byte frequency
116- ) implements DualsenseTriggerEffect {
120+ ) implements DS5TriggerEffect {
117121 public Vibration {
118122 Validate .inclusiveBetween (0 , 9 , position , "Position must be between 0 and 9 inclusive" );
119123 Validate .inclusiveBetween (0 , 8 , amplitude , "Amplitude must be between 0 and 8 inclusive" );
@@ -131,7 +135,7 @@ public DS5EffectsState.TriggerEffect createState() {
131135 activeZones |= (char ) (1 << i );
132136 }
133137
134- return new DS5EffectsState .TriggerEffect (DualsenseTriggerEffectTypes .VIBRATION , new byte []{
138+ return new DS5EffectsState .TriggerEffect (DS5TriggerEffectTypes .VIBRATION , new byte []{
135139 (byte ) (activeZones & 0xff ),
136140 (byte ) ((activeZones >> 8 ) & 0xff ),
137141 (byte ) (amplitudeZones & 0xff ),
@@ -149,6 +153,7 @@ public DS5EffectsState.TriggerEffect createState() {
149153
150154 /**
151155 * Trigger will resist movement at varying strengths in 10 regions.
156+ * <p>
152157 * This is an official effect and is expected to be present in future DualSense firmware versions.
153158 *
154159 * @see Feedback
@@ -158,7 +163,7 @@ public DS5EffectsState.TriggerEffect createState() {
158163 */
159164 record FeedbackMultiplePosition (
160165 @ Range (from = 0 , to = 9 ) byte @ NotNull [] strength
161- ) implements DualsenseTriggerEffect {
166+ ) implements DS5TriggerEffect {
162167 public FeedbackMultiplePosition {
163168 Validate .notNull (strength , "Strength array must not be null" );
164169 Validate .isTrue (strength .length == 10 , "Strength array must have 10 elements" );
@@ -185,7 +190,7 @@ public DS5EffectsState.TriggerEffect createState() {
185190 }
186191 }
187192
188- return new DS5EffectsState .TriggerEffect (DualsenseTriggerEffectTypes .FEEDBACK , new byte []{
193+ return new DS5EffectsState .TriggerEffect (DS5TriggerEffectTypes .FEEDBACK , new byte []{
189194 (byte ) (activeZones & 0xff ),
190195 (byte ) ((activeZones >> 8 ) & 0xff ),
191196 (byte ) (forceZones & 0xff ),
@@ -201,6 +206,7 @@ public DS5EffectsState.TriggerEffect createState() {
201206
202207 /**
203208 * Trigger will resist movement at a linear range of strengths.
209+ * <p>
204210 * This is an official effect and is expected to be present in future DualSense firmware versions.
205211 *
206212 * @see Feedback
@@ -216,7 +222,7 @@ record FeedbackSlope(
216222 @ Range (from = 1 , to = 9 ) byte endPosition ,
217223 @ Range (from = 1 , to = 8 ) byte startStrength ,
218224 @ Range (from = 1 , to = 8 ) byte endStrength
219- ) implements DualsenseTriggerEffect {
225+ ) implements DS5TriggerEffect {
220226 public FeedbackSlope {
221227 Validate .inclusiveBetween (0 , 8 , startPosition , "Start position must be between 0 and 8 inclusive" );
222228 Validate .inclusiveBetween (startPosition +1 , 9 , endPosition , "End position must be between start+1 and 9 inclusive" );
@@ -241,6 +247,7 @@ public DS5EffectsState.TriggerEffect createState() {
241247
242248 /**
243249 * Trigger will vibrate movement at varying amplitudes and one frequency in 10 regions.
250+ * <p>
244251 * This is an official effect and is expected to be present in future DualSense firmware versions.
245252 *
246253 * @see Vibration
@@ -251,7 +258,7 @@ public DS5EffectsState.TriggerEffect createState() {
251258 record VibrationMultiplePosition (
252259 byte frequency ,
253260 @ Range (from = 0 , to = 8 ) byte @ NotNull [] amplitude
254- ) implements DualsenseTriggerEffect {
261+ ) implements DS5TriggerEffect {
255262 public VibrationMultiplePosition {
256263 Validate .notNull (amplitude , "Amplitude array must not be null" );
257264 Validate .isTrue (amplitude .length == 10 , "Amplitude array must have 10 elements" );
@@ -280,7 +287,7 @@ public DS5EffectsState.TriggerEffect createState() {
280287 }
281288 }
282289
283- return new DS5EffectsState .TriggerEffect (DualsenseTriggerEffectTypes .VIBRATION , new byte []{
290+ return new DS5EffectsState .TriggerEffect (DS5TriggerEffectTypes .VIBRATION , new byte []{
284291 (byte ) (activeZones & 0xff ),
285292 (byte ) ((activeZones >> 8 ) & 0xff ),
286293 (byte ) (strengthZones & 0xff ),
0 commit comments