Skip to content

Commit

Permalink
- Changed the way rumble is handled
Browse files Browse the repository at this point in the history
   - thanks to spite-triangle in issue #314
 - Changed some rumble defaults
 - caught some more ViGEm exceptions
  • Loading branch information
Davidobot committed May 6, 2020
1 parent 2f9faa8 commit 7d75f39
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
8 changes: 4 additions & 4 deletions BetterJoyForCemu/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down Expand Up @@ -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>
4 changes: 1 addition & 3 deletions BetterJoyForCemu/Joycon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1144,9 +1144,7 @@ private byte CastStickValueByte(float stick_value) {

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) {
Expand Down
18 changes: 14 additions & 4 deletions BetterJoyForCemu/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,20 @@ public void CheckForNewControllers() {
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;

Expand Down

0 comments on commit 7d75f39

Please sign in to comment.