diff options
| author | JosJuice <josjuice@gmail.com> | 2026-06-27 08:43:25 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2026-07-09 21:05:10 +0200 |
| commit | b67188cc442d4b2d38cfb95b83cbeb0525ca257e (patch) | |
| tree | 38b03679d4dc86a44617b298a88124bad10b770d /Source/Core/InputCommon/ControllerInterface | |
| parent | aaeb6e5dc1e0e7377b1f9cc48203051f09282217 (diff) | |
Android: Make vibration length variable
Previously we would vibrate for 100 ms on every vibration, which was
especially annoying if a game was doing a bunch of vibrations that were
supposed to be much shorter than that. Now we tell Android to vibrate
for 10 s, then cancel the vibration as soon as the game turns the
vibration off.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/Android/Android.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp index 40f1e2b096..1aa5275f30 100644 --- a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp @@ -69,6 +69,7 @@ jmethodID s_controller_interface_unregister_input_device_listener; jmethodID s_controller_interface_get_vibrator_manager; jmethodID s_controller_interface_get_system_vibrator_manager; jmethodID s_controller_interface_vibrate; +jmethodID s_controller_interface_cancel_vibration; jclass s_sensor_event_listener_class; jmethodID s_sensor_event_listener_constructor; @@ -602,6 +603,11 @@ public: IDCache::GetEnvForThread()->CallStaticVoidMethod(s_controller_interface_class, s_controller_interface_vibrate, m_vibrator); } + else if (old_state >= 0.5 && state < 0.5) + { + IDCache::GetEnvForThread()->CallStaticVoidMethod( + s_controller_interface_class, s_controller_interface_cancel_vibration, m_vibrator); + } } private: @@ -892,6 +898,8 @@ InputBackend::InputBackend(ControllerInterface* controller_interface) "()Lorg/dolphinemu/dolphinemu/features/input/model/DolphinVibratorManager;"); s_controller_interface_vibrate = env->GetStaticMethodID(s_controller_interface_class, "vibrate", "(Landroid/os/Vibrator;)V"); + s_controller_interface_cancel_vibration = env->GetStaticMethodID( + s_controller_interface_class, "cancelVibration", "(Landroid/os/Vibrator;)V"); env->DeleteLocalRef(controller_interface_class); const jclass sensor_event_listener_class = |
