From 9cd2e9ec8fc0127393dfce9c0359d500c8c238be Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Tue, 09 Apr 2019 02:22:50 +0000
Subject: [PATCH] updae source to 2.0.9 source

---
 source/src/haptic/android/SDL_syshaptic.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/source/src/haptic/android/SDL_syshaptic.c b/source/src/haptic/android/SDL_syshaptic.c
index 1fb2352..7cb289b 100644
--- a/source/src/haptic/android/SDL_syshaptic.c
+++ b/source/src/haptic/android/SDL_syshaptic.c
@@ -195,6 +195,10 @@
 void
 SDL_SYS_HapticQuit(void)
 {
+/* We don't have any way to scan for joysticks (and their vibrators) at init, so don't wipe the list
+ * of joysticks here in case this is a reinit.
+ */
+#if 0
     SDL_hapticlist_item *item = NULL;
     SDL_hapticlist_item *next = NULL;
 
@@ -206,6 +210,7 @@
     SDL_hapticlist = SDL_hapticlist_tail = NULL;
     numhaptics = 0;
     return;
+#endif
 }
 
 
@@ -230,7 +235,12 @@
 SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
                         Uint32 iterations)
 {
-    Android_JNI_HapticRun (((SDL_hapticlist_item *)haptic->hwdata)->device_id, effect->effect.leftright.length);
+    float large = effect->effect.leftright.large_magnitude / 32767.0f;
+    float small = effect->effect.leftright.small_magnitude / 32767.0f;
+
+    float total = (large * 0.6f) + (small * 0.4f);
+
+    Android_JNI_HapticRun (((SDL_hapticlist_item *)haptic->hwdata)->device_id, total, effect->effect.leftright.length);
     return 0;
 }
 
@@ -238,6 +248,7 @@
 int
 SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
 {
+    Android_JNI_HapticStop (((SDL_hapticlist_item *)haptic->hwdata)->device_id);
     return 0;
 }
 

--
Gitblit v1.9.3