Version 1.4.158

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
This commit is contained in:
jays2kings 2014-11-21 14:56:31 -05:00
parent d0886879fb
commit 56d21aa3c0
4 changed files with 28 additions and 39 deletions

View File

@ -759,7 +759,7 @@ namespace DS4Control
if (getBoolMapping(dc, cState, eState, tp)) if (getBoolMapping(dc, cState, eState, tp))
MappedState.L1 = true; MappedState.L1 = true;
foreach (DS4Controls dc in L2) 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); MappedState.L2 = getByteMapping(device, dc, cState, eState, tp);
foreach (DS4Controls dc in L3) foreach (DS4Controls dc in L3)
if (getBoolMapping(dc, cState, eState, tp)) if (getBoolMapping(dc, cState, eState, tp))
@ -768,7 +768,7 @@ namespace DS4Control
if (getBoolMapping(dc, cState, eState, tp)) if (getBoolMapping(dc, cState, eState, tp))
MappedState.R1 = true; MappedState.R1 = true;
foreach (DS4Controls dc in R2) 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); MappedState.R2 = getByteMapping(device, dc, cState, eState, tp);
foreach (DS4Controls dc in R3) foreach (DS4Controls dc in R3)
if (getBoolMapping(dc, cState, eState, tp)) if (getBoolMapping(dc, cState, eState, tp))
@ -1138,7 +1138,7 @@ namespace DS4Control
case X360Controls.LYPos: LYP.Add(customButton.Key); break; case X360Controls.LYPos: LYP.Add(customButton.Key); break;
case X360Controls.RXPos: RXP.Add(customButton.Key); break; case X360Controls.RXPos: RXP.Add(customButton.Key); break;
case X360Controls.RYPos: RYP.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.RT: R2.Add(customButton.Key); break;
case X360Controls.LeftMouse: case X360Controls.LeftMouse:
if (getBoolMapping(customButton.Key, cState, eState, tp)) if (getBoolMapping(customButton.Key, cState, eState, tp))
@ -1354,41 +1354,39 @@ namespace DS4Control
double root = 1.002; double root = 1.002;
double divide = 10000d; double divide = 10000d;
DateTime now = mousenow[mnum]; 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) switch (control)
{ {
case DS4Controls.LXNeg: case DS4Controls.LXNeg:
if (leftsitcklive) if (cState.LX - 127.5f < -deadzoneL)
value = -(cState.LX - 127) / 2550d * speed; value = -(cState.LX - 127.5f) / 2550d * speed;
break; break;
case DS4Controls.LXPos: case DS4Controls.LXPos:
if (leftsitcklive) if (cState.LX - 127.5f > deadzoneL)
value = (cState.LX - 127) / 2550d * speed; value = (cState.LX - 127.5f) / 2550d * speed;
break; break;
case DS4Controls.RXNeg: case DS4Controls.RXNeg:
if (rightsitcklive) if (cState.RX - 127.5f < -deadzoneR)
value = -(cState.RX - 127) / 2550d * speed; value = -(cState.RX - 127.5f) / 2550d * speed;
break; break;
case DS4Controls.RXPos: case DS4Controls.RXPos:
if (rightsitcklive) if (cState.RX - 127.5f > deadzoneR)
value = (cState.RX - 127) / 2550d * speed; value = (cState.RX - 127.5f) / 2550d * speed;
break; break;
case DS4Controls.LYNeg: case DS4Controls.LYNeg:
if (leftsitcklive) if (cState.LY - 127.5f < -deadzoneL)
value = -(cState.LY - 127) / 2550d * speed; value = -(cState.LY - 127.5f) / 2550d * speed;
break; break;
case DS4Controls.LYPos: case DS4Controls.LYPos:
if (leftsitcklive) if (cState.LY - 127.5f > deadzoneL)
value = (cState.LY - 127) / 2550d * speed; value = (cState.LY - 127.5f) / 2550d * speed;
break; break;
case DS4Controls.RYNeg: case DS4Controls.RYNeg:
if (rightsitcklive) if (cState.RY - 127.5f < -deadzoneR)
value = -(cState.RY - 127) / 2550d * speed; value = -(cState.RY - 127.5f) / 2550d * speed;
break; break;
case DS4Controls.RYPos: case DS4Controls.RYPos:
if (rightsitcklive) if (cState.RY - 127.5f > deadzoneR)
value = (cState.RY - 127) / 2550d * speed; value = (cState.RY - 127.5f) / 2550d * speed;
break; break;
case DS4Controls.Share: value = (cState.Share ? Math.Pow(root + speed / divide, 100) - 1 : 0); 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; case DS4Controls.Options: value = (cState.Options ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
@ -1424,6 +1422,10 @@ namespace DS4Control
bool LYChanged = (Math.Abs(127 - cState.LY) < deadzoneL); bool LYChanged = (Math.Abs(127 - cState.LY) < deadzoneL);
bool RXChanged = (Math.Abs(127 - cState.RX) < deadzoneR); bool RXChanged = (Math.Abs(127 - cState.RX) < deadzoneR);
bool RYChanged = (Math.Abs(127 - cState.RY) < 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) if (LXChanged || LYChanged || RXChanged || RYChanged)
now = DateTime.UtcNow; now = DateTime.UtcNow;
if (Global.getMouseAccel(device)) if (Global.getMouseAccel(device))
@ -1436,7 +1438,8 @@ namespace DS4Control
if (mouseaccel[controlnum] > 1000) if (mouseaccel[controlnum] > 1000)
value *= (double)Math.Min(2000, (mouseaccel[controlnum])) / 1000d; 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)) if (now >= mousenow[mnum] + TimeSpan.FromMilliseconds((1 - value) * 500))
{ {
@ -1448,6 +1451,7 @@ namespace DS4Control
} }
else else
return (int)value; return (int)value;
return 0;
} }
public static bool compare(byte b1, byte b2) public static bool compare(byte b1, byte b2)

View File

@ -363,13 +363,11 @@
// //
resources.ApplyResources(this.lbPad1, "lbPad1"); resources.ApplyResources(this.lbPad1, "lbPad1");
this.lbPad1.Name = "lbPad1"; this.lbPad1.Name = "lbPad1";
this.lbPad1.TextChanged += new System.EventHandler(this.lbPad1_TextChanged);
// //
// lbPad2 // lbPad2
// //
resources.ApplyResources(this.lbPad2, "lbPad2"); resources.ApplyResources(this.lbPad2, "lbPad2");
this.lbPad2.Name = "lbPad2"; this.lbPad2.Name = "lbPad2";
this.lbPad2.TextChanged += new System.EventHandler(this.lbPad1_TextChanged);
// //
// bnEditC3 // bnEditC3
// //
@ -391,13 +389,11 @@
// //
resources.ApplyResources(this.lbPad3, "lbPad3"); resources.ApplyResources(this.lbPad3, "lbPad3");
this.lbPad3.Name = "lbPad3"; this.lbPad3.Name = "lbPad3";
this.lbPad3.TextChanged += new System.EventHandler(this.lbPad1_TextChanged);
// //
// lbPad4 // lbPad4
// //
resources.ApplyResources(this.lbPad4, "lbPad4"); resources.ApplyResources(this.lbPad4, "lbPad4");
this.lbPad4.Name = "lbPad4"; this.lbPad4.Name = "lbPad4";
this.lbPad4.TextChanged += new System.EventHandler(this.lbPad1_TextChanged);
// //
// cBController1 // cBController1
// //

View File

@ -710,17 +710,6 @@ namespace DS4Windows
rootHub.DS4Controllers[i].DisconnectBT(); 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) private void Enable_Controls(int device, bool on)
{ {
Pads[device].Enabled = on; Pads[device].Enabled = on;

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.157")] [assembly: AssemblyVersion("1.4.158")]
[assembly: AssemblyFileVersion("1.4.157")] [assembly: AssemblyFileVersion("1.4.158")]