Version 1.4.65

This commit is contained in:
Travis Nickles 2017-04-28 11:57:33 -07:00
parent 44501c24de
commit ca2074d76f
4 changed files with 50 additions and 24 deletions

View File

@ -337,6 +337,8 @@ namespace DS4Windows
//ControllerStatusChanged(this);
}
/* TODO: Check if this method is really necessary. If not, delete it. For now, it is not being used because
* input reports are read async with a timeout now. */
public void TimeoutConnection(DS4Device d)
{
try
@ -371,10 +373,11 @@ namespace DS4Windows
if (!d.IsAlive())
//return "Connecting..."; // awaiting the first battery charge indication
{
var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
/*var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
TimeoutThread.IsBackground = true;
TimeoutThread.Name = "TimeoutFor" + d.getMacAddress().ToString();
TimeoutThread.Start();
*/
return Properties.Resources.Connecting;
}
@ -406,10 +409,11 @@ namespace DS4Windows
if (!d.IsAlive())
//return "Connecting..."; // awaiting the first battery charge indication
{
var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
/*var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
TimeoutThread.IsBackground = true;
TimeoutThread.Name = "TimeoutFor" + d.getMacAddress().ToString();
TimeoutThread.Start();
*/
return Properties.Resources.Connecting;
}
return d.getMacAddress();

View File

@ -1200,12 +1200,14 @@ namespace DS4Windows
Stream stream;
Stream profile = new StreamReader(appdatapath + "\\Profiles\\" + lBProfiles.SelectedItem.ToString() + ".xml").BaseStream;
if (saveProfiles.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if ((stream = saveProfiles.OpenFile()) != null)
{
profile.CopyTo(stream);
profile.Close();
stream.Close();
}
}
}
}
@ -1278,9 +1280,13 @@ namespace DS4Windows
if (em.Text == Properties.Resources.ContextNew.Replace("*number*", (i + 1).ToString()))
ShowOptions(i, "");
else
{
for (int t = 0; t < em.DropDownItems.Count - 2; t++)
{
if (((ToolStripMenuItem)em.DropDownItems[t]).Checked)
ShowOptions(i, ((ToolStripMenuItem)em.DropDownItems[t]).Text);
}
}
}
private void lnkControllers_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@ -1293,13 +1299,19 @@ namespace DS4Windows
// Prevent the Game Controllers window from throwing an error when controllers are un/hidden
System.Diagnostics.Process[] rundll64 = System.Diagnostics.Process.GetProcessesByName("rundll64");
foreach (System.Diagnostics.Process rundll64Instance in rundll64)
{
foreach (System.Diagnostics.ProcessModule module in rundll64Instance.Modules)
{
if (module.FileName.Contains("joy.cpl"))
module.Dispose();
}
}
UseExclusiveMode = hideDS4CheckBox.Checked;
bool exclusiveMode = hideDS4CheckBox.Checked;
UseExclusiveMode = exclusiveMode;
if (Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build < 10586)
btnConnectDS4Win10.Visible = hideDS4CheckBox.Checked;
btnConnectDS4Win10.Visible = exclusiveMode;
btnStartStop_Clicked(false);
btnStartStop_Clicked(false);
Save();
@ -1345,6 +1357,7 @@ namespace DS4Windows
else
ebns[tdevice].Text = Properties.Resources.EditProfile;
}
ControllerStatusChanged(); //to update profile name in notify icon
}
@ -1353,10 +1366,12 @@ namespace DS4Windows
ToolStripMenuItem tS = (ToolStripMenuItem)sender;
int tdevice = Int32.Parse(tS.Tag.ToString());
if (!(e.ClickedItem is ToolStripSeparator))
{
if (e.ClickedItem != tS.DropDownItems[tS.DropDownItems.Count - 1]) //if +New Profile not selected
cbs[tdevice].SelectedIndex = tS.DropDownItems.IndexOf(e.ClickedItem);
else //if +New Profile selected
ShowOptions(tdevice, "");
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
@ -1377,6 +1392,7 @@ namespace DS4Windows
{
btnStartStop_Clicked();
}
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Middle)
@ -1385,6 +1401,7 @@ namespace DS4Windows
this.Close();
}
}
private void notifyIcon1_BalloonTipClicked(object sender, EventArgs e)
{
this.Show();
@ -1510,6 +1527,7 @@ namespace DS4Windows
case "cBCloseMini": lbLastMessage.Text = Properties.Resources.CloseMinimize; break;
default: lbLastMessage.Text = Properties.Resources.HoverOverItems; break;
}
if (lbLastMessage.Text != Properties.Resources.HoverOverItems)
lbLastMessage.ForeColor = Color.Black;
else

View File

@ -266,8 +266,8 @@ namespace DS4Windows
get { return rightLightFastRumble; }
set
{
if (value == rightLightFastRumble) return;
rightLightFastRumble = value;
if (rightLightFastRumble != value)
rightLightFastRumble = value;
}
}
@ -276,8 +276,8 @@ namespace DS4Windows
get { return leftHeavySlowRumble; }
set
{
if (value == leftHeavySlowRumble) return;
leftHeavySlowRumble = value;
if (leftHeavySlowRumble != value)
leftHeavySlowRumble = value;
}
}
@ -608,10 +608,10 @@ namespace DS4Windows
cState.L2 = inputReport[8];
cState.R2 = inputReport[9];
cState.Triangle = ((byte)inputReport[5] & (1 << 7)) != 0;
cState.Circle = ((byte)inputReport[5] & (1 << 6)) != 0;
cState.Cross = ((byte)inputReport[5] & (1 << 5)) != 0;
cState.Square = ((byte)inputReport[5] & (1 << 4)) != 0;
cState.Triangle = (inputReport[5] & (1 << 7)) != 0;
cState.Circle = (inputReport[5] & (1 << 6)) != 0;
cState.Cross = (inputReport[5] & (1 << 5)) != 0;
cState.Square = (inputReport[5] & (1 << 4)) != 0;
// First 4 bits denote dpad state. Clock representation
// with 8 meaning centered and 0 meaning DpadUp.
@ -627,18 +627,18 @@ namespace DS4Windows
case 5: cState.DpadUp = false; cState.DpadDown = true; cState.DpadLeft = true; cState.DpadRight = false; break;
case 6: cState.DpadUp = false; cState.DpadDown = false; cState.DpadLeft = true; cState.DpadRight = false; break;
case 7: cState.DpadUp = true; cState.DpadDown = false; cState.DpadLeft = true; cState.DpadRight = false; break;
case 8: cState.DpadUp = false; cState.DpadDown = false; cState.DpadLeft = false; cState.DpadRight = false; break;
default: break;
case 8:
default: cState.DpadUp = false; cState.DpadDown = false; cState.DpadLeft = false; cState.DpadRight = false; break;
}
cState.R3 = ((byte)inputReport[6] & (1 << 7)) != 0;
cState.L3 = ((byte)inputReport[6] & (1 << 6)) != 0;
cState.Options = ((byte)inputReport[6] & (1 << 5)) != 0;
cState.Share = ((byte)inputReport[6] & (1 << 4)) != 0;
cState.R1 = ((byte)inputReport[6] & (1 << 1)) != 0;
cState.L1 = ((byte)inputReport[6] & (1 << 0)) != 0;
cState.R3 = (inputReport[6] & (1 << 7)) != 0;
cState.L3 = (inputReport[6] & (1 << 6)) != 0;
cState.Options = (inputReport[6] & (1 << 5)) != 0;
cState.Share = (inputReport[6] & (1 << 4)) != 0;
cState.R1 = (inputReport[6] & (1 << 1)) != 0;
cState.L1 = (inputReport[6] & (1 << 0)) != 0;
cState.PS = ((byte)inputReport[7] & (1 << 0)) != 0;
cState.PS = (inputReport[7] & (1 << 0)) != 0;
cState.TouchButton = (inputReport[7] & (1 << 2 - 1)) != 0;
cState.FrameCounter = (byte)(inputReport[7] >> 2);
@ -847,7 +847,7 @@ namespace DS4Windows
string[] sbytes = Mac.Split(':');
for (int i = 0; i < 6; i++)
{
//parse hex byte in reverse order
// parse hex byte in reverse order
btAddr[5 - i] = Convert.ToByte(sbytes[i], 16);
}
@ -998,18 +998,21 @@ namespace DS4Windows
DS4HapticState haptic = hapticState[i];
if (i == hapticStackIndex)
break; // rest haven't been used this time
if (haptic.IsLightBarSet())
{
lightBarColor = haptic.LightBarColor;
lightBarFlashDurationOn = haptic.LightBarFlashDurationOn;
lightBarFlashDurationOff = haptic.LightBarFlashDurationOff;
}
if (haptic.IsRumbleSet())
{
rumbleMotorStrengthLeftHeavySlow = haptic.RumbleMotorStrengthLeftHeavySlow;
rumbleMotorStrengthRightLightFast = haptic.RumbleMotorStrengthRightLightFast;
}
}
LightBarColor = lightBarColor;
LightBarOnDuration = lightBarFlashDurationOn;
LightBarOffDuration = lightBarFlashDurationOff;
@ -1026,6 +1029,7 @@ namespace DS4Windows
Array.Copy(hapticState, newHaptics, hapsLen);
hapticState = newHaptics;
}
hapticState[hapticStackIndex++] = hs;
}

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
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.64")]
[assembly: AssemblyFileVersion("1.4.64")]
[assembly: AssemblyVersion("1.4.65")]
[assembly: AssemblyFileVersion("1.4.65")]