From 7d75f396d7b795f4e0a157719442cf63583264b4 Mon Sep 17 00:00:00 2001 From: David Khachaturov Date: Wed, 6 May 2020 13:26:34 +0100 Subject: [PATCH] - Changed the way rumble is handled - thanks to spite-triangle in issue #314 - Changed some rumble defaults - caught some more ViGEm exceptions --- BetterJoyForCemu/App.config | 8 ++++---- BetterJoyForCemu/Joycon.cs | 4 +--- BetterJoyForCemu/Program.cs | 18 ++++++++++++++---- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/BetterJoyForCemu/App.config b/BetterJoyForCemu/App.config index 8345fdd..ddd7844 100644 --- a/BetterJoyForCemu/App.config +++ b/BetterJoyForCemu/App.config @@ -17,9 +17,9 @@ - + - + @@ -75,9 +75,9 @@ - + - + \ No newline at end of file diff --git a/BetterJoyForCemu/Joycon.cs b/BetterJoyForCemu/Joycon.cs index e1917dc..52e7b6b 100644 --- a/BetterJoyForCemu/Joycon.cs +++ b/BetterJoyForCemu/Joycon.cs @@ -1144,9 +1144,7 @@ namespace BetterJoyForCemu { public void SetRumble(float low_freq, float high_freq, float amp, int time = 0) { if (state <= Joycon.state_.ATTACHED) return; - //if (rumble_obj.timed_rumble == false || rumble_obj.t < 0) { - rumble_obj = new Rumble(low_freq, high_freq, amp, time); - //} + rumble_obj.set_vals(low_freq, high_freq, amp, time); } private void SendRumble(byte[] buf) { diff --git a/BetterJoyForCemu/Program.cs b/BetterJoyForCemu/Program.cs index ffc2ca0..86b09d1 100644 --- a/BetterJoyForCemu/Program.cs +++ b/BetterJoyForCemu/Program.cs @@ -239,10 +239,20 @@ namespace BetterJoyForCemu { temp.SetPlayerLED(led); v.SetPlayerLED(led); - if (temp.xin != null) - temp.xin.Disconnect(); - if (temp.ds4 != null) - temp.ds4.Disconnect(); + if (temp.xin != null) { + try { + temp.xin.Disconnect(); + } catch (Exception e) { + // it wasn't connected in the first place, go figure + } + } + if (temp.ds4 != null) { + try { + temp.ds4.Disconnect(); + } catch (Exception e) { + // it wasn't connected in the first place, go figure + } + } temp.xin = null; temp.ds4 = null;