Skip to content

Commit

Permalink
Configurable min damage % to get rumble
Browse files Browse the repository at this point in the history
  • Loading branch information
Lesueur Benjamin committed Dec 13, 2019
1 parent 56bbe83 commit d04e78a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion App.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@

<!-- rumble settings -->
<add key="rumble" value="true" />
<!-- average rumble delay -->
<add key="rumble_delay" value="150" />
<!-- min received dmg in % to trigger rumble-->
<add key="rumble_min_dmg" value="3" />

<!-- refresh rate in ms -->
<!-- gamepad refresh rate in ms -->
<add key="refresh_rate" value="10" />

<!--VKC-->
Expand Down
3 changes: 3 additions & 0 deletions ControllerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public enum DeviceCap
public int vb_stick_value { get; }
public bool rumble { get; }
public int rumble_delay { get; }
public int rumble_min_dmg { get; }
public bool dpi_check { get; }
public bool moveattack { get; set; }
public float ScreenScalingFactor { get; set; }
Expand Down Expand Up @@ -155,6 +156,8 @@ public ControllerSettings()
rumble = Convert.ToBoolean(ConfigurationManager.AppSettings["rumble"]);
if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["rumble_delay"]))
rumble_delay = Convert.ToInt16(ConfigurationManager.AppSettings["rumble_delay"]);
if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["rumble_min_dmg"]))
rumble_min_dmg = Convert.ToInt16(ConfigurationManager.AppSettings["rumble_min_dmg"]);
if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["vb_stick"]))
vb_stick_value = Convert.ToInt16(ConfigurationManager.AppSettings["vb_stick"]);
if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["dpi_check"]))
Expand Down
2 changes: 1 addition & 1 deletion MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public static void ThreadHealth()
int damage = health_known - health_current;
int vibra = Math.Min(Math.Abs(damage) * 5000, 60000);

if (damage >= 3 && health_current != 0) // min percentage damage for rumble
if (damage >= _settings.rumble_min_dmg && health_current != 0)
_gameController.SendVibration(vibra, vibra);

health_known = health_current;
Expand Down

0 comments on commit d04e78a

Please sign in to comment.