Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

Commit

Permalink
Version 1.4.158
Browse files Browse the repository at this point in the history
Fixed random mouse dancing in some games
When adding trigger actions to the left or right stick, fixed L2/R2 not
working 100% of the time
Fixed profile for controllers not being changeable if usb was plugged in
at start
  • Loading branch information
Jays2Kings committed Nov 21, 2014
1 parent d088687 commit 56d21aa
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 39 deletions.
48 changes: 26 additions & 22 deletions DS4Control/Mapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ public static async void MapCustom(int device, DS4State cState, DS4State MappedS
if (getBoolMapping(dc, cState, eState, tp))
MappedState.L1 = true;
foreach (DS4Controls dc in L2)
if (getByteMapping(device, dc, cState, eState, tp) != 0)
if (getByteMapping(device, dc, cState, eState, tp) > 5)
MappedState.L2 = getByteMapping(device, dc, cState, eState, tp);
foreach (DS4Controls dc in L3)
if (getBoolMapping(dc, cState, eState, tp))
Expand All @@ -768,7 +768,7 @@ public static async void MapCustom(int device, DS4State cState, DS4State MappedS
if (getBoolMapping(dc, cState, eState, tp))
MappedState.R1 = true;
foreach (DS4Controls dc in R2)
if (getByteMapping(device, dc, cState, eState, tp) != 0)
if (getByteMapping(device, dc, cState, eState, tp) > 5)
MappedState.R2 = getByteMapping(device, dc, cState, eState, tp);
foreach (DS4Controls dc in R3)
if (getBoolMapping(dc, cState, eState, tp))
Expand Down Expand Up @@ -1138,7 +1138,7 @@ public static async void MapShiftCustom(int device, DS4State cState, DS4State Ma
case X360Controls.LYPos: LYP.Add(customButton.Key); break;
case X360Controls.RXPos: RXP.Add(customButton.Key); break;
case X360Controls.RYPos: RYP.Add(customButton.Key); break;
case X360Controls.LT: L2.Add(customButton.Key); break;
case X360Controls.LT: L2.Add(customButton.Key); Console.WriteLine("yes"); break;
case X360Controls.RT: R2.Add(customButton.Key); break;
case X360Controls.LeftMouse:
if (getBoolMapping(customButton.Key, cState, eState, tp))
Expand Down Expand Up @@ -1354,41 +1354,39 @@ private static int getMouseMapping(int device, DS4Controls control, DS4State cSt
double root = 1.002;
double divide = 10000d;
DateTime now = mousenow[mnum];
bool leftsitcklive = ((cState.LX < 127 - deadzoneL || 127 + deadzoneL < cState.LX) || (cState.LY < 127 - deadzoneL || 127 + deadzoneL < cState.LY));
bool rightsitcklive = ((cState.RX < 127 - deadzoneR || 127 + deadzoneR < cState.RX) || (cState.RY < 127 - deadzoneR || 127 + deadzoneR < cState.RY));
switch (control)
{
case DS4Controls.LXNeg:
if (leftsitcklive)
value = -(cState.LX - 127) / 2550d * speed;
if (cState.LX - 127.5f < -deadzoneL)
value = -(cState.LX - 127.5f) / 2550d * speed;
break;
case DS4Controls.LXPos:
if (leftsitcklive)
value = (cState.LX - 127) / 2550d * speed;
if (cState.LX - 127.5f > deadzoneL)
value = (cState.LX - 127.5f) / 2550d * speed;
break;
case DS4Controls.RXNeg:
if (rightsitcklive)
value = -(cState.RX - 127) / 2550d * speed;
if (cState.RX - 127.5f < -deadzoneR)
value = -(cState.RX - 127.5f) / 2550d * speed;
break;
case DS4Controls.RXPos:
if (rightsitcklive)
value = (cState.RX - 127) / 2550d * speed;
if (cState.RX - 127.5f > deadzoneR)
value = (cState.RX - 127.5f) / 2550d * speed;
break;
case DS4Controls.LYNeg:
if (leftsitcklive)
value = -(cState.LY - 127) / 2550d * speed;
if (cState.LY - 127.5f < -deadzoneL)
value = -(cState.LY - 127.5f) / 2550d * speed;
break;
case DS4Controls.LYPos:
if (leftsitcklive)
value = (cState.LY - 127) / 2550d * speed;
if (cState.LY - 127.5f > deadzoneL)
value = (cState.LY - 127.5f) / 2550d * speed;
break;
case DS4Controls.RYNeg:
if (rightsitcklive)
value = -(cState.RY - 127) / 2550d * speed;
if (cState.RY - 127.5f < -deadzoneR)
value = -(cState.RY - 127.5f) / 2550d * speed;
break;
case DS4Controls.RYPos:
if (rightsitcklive)
value = (cState.RY - 127) / 2550d * speed;
if (cState.RY - 127.5f > deadzoneR)
value = (cState.RY - 127.5f) / 2550d * speed;
break;
case DS4Controls.Share: value = (cState.Share ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.Options: value = (cState.Options ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
Expand Down Expand Up @@ -1424,6 +1422,10 @@ private static int getMouseMapping(int device, DS4Controls control, DS4State cSt
bool LYChanged = (Math.Abs(127 - cState.LY) < deadzoneL);
bool RXChanged = (Math.Abs(127 - cState.RX) < deadzoneR);
bool RYChanged = (Math.Abs(127 - cState.RY) < deadzoneR);
bool contains = (control.ToString().Contains("LX") ||
control.ToString().Contains("LY") ||
control.ToString().Contains("RX") ||
control.ToString().Contains("RY"));
if (LXChanged || LYChanged || RXChanged || RYChanged)
now = DateTime.UtcNow;
if (Global.getMouseAccel(device))
Expand All @@ -1436,7 +1438,8 @@ private static int getMouseMapping(int device, DS4Controls control, DS4State cSt
if (mouseaccel[controlnum] > 1000)
value *= (double)Math.Min(2000, (mouseaccel[controlnum])) / 1000d;
}
if (value <= 1)
if (value != 0)
if (contains && value <= 1 && value != 0)
{
if (now >= mousenow[mnum] + TimeSpan.FromMilliseconds((1 - value) * 500))
{
Expand All @@ -1448,6 +1451,7 @@ private static int getMouseMapping(int device, DS4Controls control, DS4State cSt
}
else
return (int)value;
return 0;
}

public static bool compare(byte b1, byte b2)
Expand Down
4 changes: 0 additions & 4 deletions DS4Tool/DS4Form.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions DS4Tool/DS4Form.cs
Original file line number Diff line number Diff line change
Expand Up @@ -710,17 +710,6 @@ private void pBStatus_MouseClick(object sender, MouseEventArgs e)
rootHub.DS4Controllers[i].DisconnectBT();
}

private async void lbPad1_TextChanged(object sender, EventArgs e)
{
Label lb = ((Label)sender);
int i = int.Parse(lb.Name.Substring(lb.Name.Length-1)) - 1;
if (lb.Text == Properties.Resources.Disconnected && Pads[i].Enabled)
{
await Task.Delay(10);
Enable_Controls(i, false);
}
}

private void Enable_Controls(int device, bool on)
{
Pads[device].Enabled = on;
Expand Down
4 changes: 2 additions & 2 deletions DS4Tool/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.157")]
[assembly: AssemblyFileVersion("1.4.157")]
[assembly: AssemblyVersion("1.4.158")]
[assembly: AssemblyFileVersion("1.4.158")]

0 comments on commit 56d21aa

Please sign in to comment.