diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.kt index 06d63a19fe..148f5d5e69 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.kt @@ -745,7 +745,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider { value = FloatSetting.MAIN_OVERLAY_HAPTICS_SCALE.float.also { setValueText(it) } addOnChangeListener { _: Slider, value: Float, _: Boolean -> setValueText(value) - hapticsProvider.provideFeedback(HapticEffect.LOW_TICK, value) + hapticsProvider.provideFeedback(HapticEffect.JOYSTICK, value) } } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.kt index 9dcf2b2739..9b4fbc5265 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.kt @@ -165,7 +165,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex button.setPressedState(false) if (hapticsOnRelease) { hapticsProvider.provideFeedback( - HapticEffect.QUICK_RISE, + HapticEffect.RELEASE, hapticsScale ) } @@ -173,7 +173,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex button.setPressedState(true) if (hapticsOnPress) { hapticsProvider.provideFeedback( - HapticEffect.QUICK_FALL, + HapticEffect.PRESS, hapticsScale ) } @@ -200,7 +200,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex button.setPressedState(false) if (hapticsOnRelease) { hapticsProvider.provideFeedback( - HapticEffect.QUICK_RISE, + HapticEffect.RELEASE, hapticsScale ) } @@ -259,7 +259,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex if (!dpadPressed[i]) { if (hapticsOnRelease && dpad.isPressed(i)) { hapticsProvider.provideFeedback( - HapticEffect.QUICK_RISE, + HapticEffect.RELEASE, hapticsScale ) } @@ -271,7 +271,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex } else { if (hapticsOnPress && !dpad.isPressed(i)) { hapticsProvider.provideFeedback( - HapticEffect.QUICK_FALL, + HapticEffect.PRESS, hapticsScale ) } @@ -298,7 +298,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex for (i in 0 until 4) { if (hapticsOnRelease && dpad.isPressed(i)) { hapticsProvider.provideFeedback( - HapticEffect.QUICK_RISE, + HapticEffect.RELEASE, hapticsScale ) } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlayDrawableJoystick.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlayDrawableJoystick.kt index 4814783c4d..49977fa27f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlayDrawableJoystick.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlayDrawableJoystick.kt @@ -123,7 +123,7 @@ class InputOverlayDrawableJoystick( pressed = true pressedState = true if (BooleanSetting.MAIN_OVERLAY_HAPTICS_ON_PRESS.boolean) { - hapticsProvider.provideFeedback(HapticEffect.QUICK_FALL, hapticsScale) + hapticsProvider.provideFeedback(HapticEffect.PRESS, hapticsScale) } outerBitmap.alpha = 0 boundsBoxBitmap.alpha = opacity @@ -144,7 +144,7 @@ class InputOverlayDrawableJoystick( pressed = true pressedState = false if (BooleanSetting.MAIN_OVERLAY_HAPTICS_ON_RELEASE.boolean) { - hapticsProvider.provideFeedback(HapticEffect.QUICK_RISE, hapticsScale) + hapticsProvider.provideFeedback(HapticEffect.RELEASE, hapticsScale) } y = 0f x = y @@ -184,7 +184,7 @@ class InputOverlayDrawableJoystick( val deltaX = x - hapticsPreviousX val deltaY = y - hapticsPreviousY if (deltaX.pow(2) + deltaY.pow(2) > radiusThreshold.pow(2)) { - hapticsProvider.provideFeedback(HapticEffect.LOW_TICK, hapticsScale) + hapticsProvider.provideFeedback(HapticEffect.JOYSTICK, hapticsScale) hapticsPreviousX = x hapticsPreviousY = y } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/HapticsProvider.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/HapticsProvider.kt index c840e8d315..be8bee9246 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/HapticsProvider.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/HapticsProvider.kt @@ -68,9 +68,9 @@ class HapticsProvider( // so the difference in the duration of the vibration can be easily perceived. // Lower-end vibrators can't vibrate at all if the duration is too short. return when (effect) { - HapticEffect.QUICK_FALL -> longArrayOf(0L, (100f * scale).toLong()) - HapticEffect.QUICK_RISE -> longArrayOf(0L, (70f * scale).toLong()) - HapticEffect.LOW_TICK -> longArrayOf(0L, (50f * scale).toLong()) + HapticEffect.PRESS -> longArrayOf(0L, (100f * scale).toLong()) + HapticEffect.RELEASE -> longArrayOf(0L, (70f * scale).toLong()) + HapticEffect.JOYSTICK -> longArrayOf(0L, (50f * scale).toLong()) } } @@ -89,18 +89,18 @@ class HapticsProvider( // so the difference in the amplitude of the vibration can be easily perceived. // Value range is between 0 and 255 (VibrationEffect.MAX_AMPLITUDE). return when (effect) { - HapticEffect.QUICK_FALL -> intArrayOf(0, (255f * scale).toInt()) - HapticEffect.QUICK_RISE -> intArrayOf(0, (180f * scale).toInt()) - HapticEffect.LOW_TICK -> intArrayOf(0, (128f * scale).toInt()) + HapticEffect.PRESS -> intArrayOf(0, (255f * scale).toInt()) + HapticEffect.RELEASE -> intArrayOf(0, (180f * scale).toInt()) + HapticEffect.JOYSTICK -> intArrayOf(0, (128f * scale).toInt()) } } @RequiresApi(Build.VERSION_CODES.S) private fun getPrimitive(effect: HapticEffect): Int { return when (effect) { - HapticEffect.QUICK_FALL -> VibrationEffect.Composition.PRIMITIVE_QUICK_FALL - HapticEffect.QUICK_RISE -> VibrationEffect.Composition.PRIMITIVE_QUICK_RISE - HapticEffect.LOW_TICK -> VibrationEffect.Composition.PRIMITIVE_LOW_TICK + HapticEffect.PRESS -> VibrationEffect.Composition.PRIMITIVE_QUICK_FALL + HapticEffect.RELEASE -> VibrationEffect.Composition.PRIMITIVE_QUICK_RISE + HapticEffect.JOYSTICK -> VibrationEffect.Composition.PRIMITIVE_LOW_TICK } } @@ -113,7 +113,7 @@ class HapticsProvider( } enum class HapticEffect { - QUICK_FALL, - QUICK_RISE, - LOW_TICK + PRESS, + RELEASE, + JOYSTICK }