Some minor changes

This commit is contained in:
Travis Nickles 2017-04-25 20:07:02 -07:00
parent 05c94b677b
commit 2a20350b6b
6 changed files with 76 additions and 44 deletions

View File

@ -169,8 +169,15 @@ namespace DS4Windows
running = true;
}
else
{
string logMessage = "Could not connect to Scp Virtual Bus Driver. Please check the status of the System device in Device Manager";
LogDebug(logMessage);
Log.LogToTray(logMessage);
}
ControllerStatusChanged(this);
runHotPlug = true;
return true;
}
@ -180,6 +187,8 @@ namespace DS4Windows
if (running)
{
running = false;
runHotPlug = false;
if (showlog)
LogDebug(Properties.Resources.StoppingX360);
@ -231,6 +240,7 @@ namespace DS4Windows
ControllerStatusChanged(this);
}
runHotPlug = false;
return true;
}

View File

@ -1228,6 +1228,8 @@ namespace DS4Windows
{
case DS4Controls.LXNeg:
case DS4Controls.LXPos:
{
if (MappedState.LX == 127)
{
if (dc == DS4Controls.LXNeg)
{
@ -1239,11 +1241,14 @@ namespace DS4Windows
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true);
MappedState.LX = axisMapping;
}
}
break;
}
case DS4Controls.LYNeg:
case DS4Controls.LYPos:
{
if (MappedState.LY == 127)
{
if (dc == DS4Controls.LYNeg)
{
@ -1255,11 +1260,14 @@ namespace DS4Windows
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true);
MappedState.LY = axisMapping;
}
}
break;
}
case DS4Controls.RXNeg:
case DS4Controls.RXPos:
{
if (MappedState.RX == 127)
{
if (dc == DS4Controls.RXNeg)
{
@ -1271,11 +1279,14 @@ namespace DS4Windows
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true);
MappedState.RX = axisMapping;
}
}
break;
}
case DS4Controls.RYNeg:
case DS4Controls.RYPos:
{
if (MappedState.RY == 127)
{
if (dc == DS4Controls.RYNeg)
{
@ -1287,6 +1298,7 @@ namespace DS4Windows
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true);
MappedState.RY = axisMapping;
}
}
break;
}

View File

@ -185,6 +185,7 @@ namespace DS4Windows
protected static Int32 m_IdleTimeout = 600000;
static string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
public static string appdatapath;
public static bool runHotPlug = false;
public static string[] tempprofilename = new string[5] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
public static bool[] tempprofileDistance = new bool[5] { false, false, false, false, false };

View File

@ -893,12 +893,15 @@ namespace DS4Windows
}
protected override void WndProc(ref Message m)
{
if (runHotPlug)
{
try
{
if (m.Msg == ScpDevice.WM_DEVICECHANGE)
{
Int32 Type = m.WParam.ToInt32();
lock (this)
{
Program.rootHub.HotPlug();
@ -908,6 +911,7 @@ namespace DS4Windows
catch { }
if (m.Msg == WM_QUERYENDSESSION)
systemShutdown = true;
}
// If this is WM_QUERYENDSESSION, the closing event should be
// raised in the base WndProc.

View File

@ -36,7 +36,11 @@ namespace DS4Windows
// Sort Bluetooth first in case USB is also connected on the same controller.
hDevices = hDevices.OrderBy<HidDevice, ConnectionType>((HidDevice d) => { return DS4Device.HidConnectionType(d); });
for (int i = 0, devCount = hDevices.Count(); i < devCount; i++)
int devCount = hDevices.Count();
string devicePlural = "device" + (devCount == 0 || devCount > 1 ? "s" : "");
//Log.LogToGui("Found " + devCount + " possible " + devicePlural + ". Examining " + devicePlural + ".", false);
for (int i = 0; i < devCount; i++)
//foreach (HidDevice hDevice in hDevices)
{
HidDevice hDevice = hDevices.ElementAt<HidDevice>(i);

View File

@ -19,6 +19,7 @@ namespace DS4Windows
public byte Battery; // 0 for charging, 10/20/30/40/50/60/70/80/90/100 for percentage of full
public double LSAngle; // Calculated bearing of the LS X,Y coordinates
public double RSAngle; // Calculated bearing of the RS X,Y coordinates
public static readonly int DEFAULT_AXISDIR_VALUE = 127;
public DS4State()
{