- Changed the way rumble is handled

- thanks to spite-triangle in issue #314
 - Changed some rumble defaults
 - caught some more ViGEm exceptions
This commit is contained in:
David Khachaturov 2020-05-06 13:26:34 +01:00
parent 2f9faa8237
commit 7d75f396d7
3 changed files with 19 additions and 11 deletions

View file

@ -17,9 +17,9 @@
<!--The response of rumble does not only depend on this setting and it's always high. Default: 300 -->
<add key="RumblePeriod" value="300" />
<!--The controller's HD rumble settings for the low/high frequency rumble. Change to change the pitch of the rumble.-->
<!--Don't set above ~1200. Default: 20 and 400 -->
<!--Don't set above ~1200. Default: 20 and 20 -->
<add key="LowFreqRumble" value="20" />
<add key="HighFreqRumble" value="400" />
<add key="HighFreqRumble" value="20" />
<!--Rumble Setting. Turns rumble on or off.-->
<!--On is "true"; off is "false". Default: true -->
<add key="EnableRumble" value="true" />
@ -75,9 +75,9 @@
<!-- Determines whether or not the program will expose detected controllers as Xbox 360 controllers -->
<!-- When "false", BetterJoyForCemu is only usable with CEMU. -->
<!-- Default: true -->
<add key="ShowAsXInput" value="false" />
<add key="ShowAsXInput" value="true" />
<!-- Have ShowAsXInput as false if using this -->
<!-- Default: false -->
<add key="ShowAsDS4" value="true"/>
<add key="ShowAsDS4" value="false"/>
</appSettings>
</configuration>

View file

@ -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) {

View file

@ -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;