mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-22 17:29:18 +01:00
Minor changes
This commit is contained in:
parent
81b54a7dd9
commit
f3c9e08398
@ -24,7 +24,7 @@ namespace DS4Windows
|
|||||||
List<DS4Controls> dcs = new List<DS4Controls>();
|
List<DS4Controls> dcs = new List<DS4Controls>();
|
||||||
bool[] held = new bool[DS4_CONTROLLER_COUNT];
|
bool[] held = new bool[DS4_CONTROLLER_COUNT];
|
||||||
int[] oldmouse = new int[DS4_CONTROLLER_COUNT] { -1, -1, -1, -1 };
|
int[] oldmouse = new int[DS4_CONTROLLER_COUNT] { -1, -1, -1, -1 };
|
||||||
SoundPlayer sp = new SoundPlayer();
|
//SoundPlayer sp = new SoundPlayer();
|
||||||
|
|
||||||
private class X360Data
|
private class X360Data
|
||||||
{
|
{
|
||||||
@ -36,7 +36,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
public ControlService()
|
public ControlService()
|
||||||
{
|
{
|
||||||
sp.Stream = Properties.Resources.EE;
|
//sp.Stream = Properties.Resources.EE;
|
||||||
x360Bus = new X360Device();
|
x360Bus = new X360Device();
|
||||||
AddtoDS4List();
|
AddtoDS4List();
|
||||||
|
|
||||||
@ -389,48 +389,13 @@ namespace DS4Windows
|
|||||||
//ControllerStatusChanged(this);
|
//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
|
|
||||||
{
|
|
||||||
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
|
|
||||||
sw.Start();
|
|
||||||
while (!d.IsAlive())
|
|
||||||
{
|
|
||||||
if (sw.ElapsedMilliseconds < 1000)
|
|
||||||
System.Threading.Thread.SpinWait(500);
|
|
||||||
//If weve been waiting less than 1 second let the thread keep its processing chunk
|
|
||||||
else
|
|
||||||
System.Threading.Thread.Sleep(500);
|
|
||||||
//If weve been waiting more than 1 second give up some resources
|
|
||||||
|
|
||||||
if (sw.ElapsedMilliseconds > 5000) throw new TimeoutException(); //Weve waited long enough
|
|
||||||
}
|
|
||||||
sw.Reset();
|
|
||||||
}
|
|
||||||
catch (TimeoutException)
|
|
||||||
{
|
|
||||||
Stop(false);
|
|
||||||
Start(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public string getDS4ControllerInfo(int index)
|
public string getDS4ControllerInfo(int index)
|
||||||
{
|
{
|
||||||
DS4Device d = DS4Controllers[index];
|
DS4Device d = DS4Controllers[index];
|
||||||
if (d != null)
|
if (d != null)
|
||||||
{
|
{
|
||||||
if (!d.IsAlive())
|
if (!d.IsAlive())
|
||||||
//return "Connecting..."; // awaiting the first battery charge indication
|
|
||||||
{
|
{
|
||||||
/*var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
|
|
||||||
TimeoutThread.IsBackground = true;
|
|
||||||
TimeoutThread.Name = "TimeoutFor" + d.getMacAddress().ToString();
|
|
||||||
TimeoutThread.Start();
|
|
||||||
*/
|
|
||||||
return Properties.Resources.Connecting;
|
return Properties.Resources.Connecting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,15 +425,10 @@ namespace DS4Windows
|
|||||||
if (d != null)
|
if (d != null)
|
||||||
{
|
{
|
||||||
if (!d.IsAlive())
|
if (!d.IsAlive())
|
||||||
//return "Connecting..."; // awaiting the first battery charge indication
|
|
||||||
{
|
{
|
||||||
/*var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
|
|
||||||
TimeoutThread.IsBackground = true;
|
|
||||||
TimeoutThread.Name = "TimeoutFor" + d.getMacAddress().ToString();
|
|
||||||
TimeoutThread.Start();
|
|
||||||
*/
|
|
||||||
return Properties.Resources.Connecting;
|
return Properties.Resources.Connecting;
|
||||||
}
|
}
|
||||||
|
|
||||||
return d.getMacAddress();
|
return d.getMacAddress();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -987,16 +947,20 @@ namespace DS4Windows
|
|||||||
oldscrollvalue[deviceID] = getScrollSensitivity(deviceID);
|
oldscrollvalue[deviceID] = getScrollSensitivity(deviceID);
|
||||||
getTouchSensitivity()[deviceID] = 0;
|
getTouchSensitivity()[deviceID] = 0;
|
||||||
getScrollSensitivity()[deviceID] = 0;
|
getScrollSensitivity()[deviceID] = 0;
|
||||||
LogDebug(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
LogDebug(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn :
|
||||||
Log.LogToTray(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
Properties.Resources.TouchpadMovementOff);
|
||||||
|
Log.LogToTray(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn :
|
||||||
|
Properties.Resources.TouchpadMovementOff);
|
||||||
touchreleased[deviceID] = false;
|
touchreleased[deviceID] = false;
|
||||||
}
|
}
|
||||||
else if (touchreleased[deviceID])
|
else if (touchreleased[deviceID])
|
||||||
{
|
{
|
||||||
getTouchSensitivity()[deviceID] = oldtouchvalue[deviceID];
|
getTouchSensitivity()[deviceID] = oldtouchvalue[deviceID];
|
||||||
getScrollSensitivity()[deviceID] = oldscrollvalue[deviceID];
|
getScrollSensitivity()[deviceID] = oldscrollvalue[deviceID];
|
||||||
LogDebug(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
LogDebug(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn :
|
||||||
Log.LogToTray(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
Properties.Resources.TouchpadMovementOff);
|
||||||
|
Log.LogToTray(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn :
|
||||||
|
Properties.Resources.TouchpadMovementOff);
|
||||||
touchreleased[deviceID] = false;
|
touchreleased[deviceID] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1071,8 +1035,9 @@ namespace DS4Windows
|
|||||||
|
|
||||||
if (deviceNum < 4)
|
if (deviceNum < 4)
|
||||||
{
|
{
|
||||||
if (DS4Controllers[deviceNum] != null)
|
DS4Device device = DS4Controllers[deviceNum];
|
||||||
DS4Controllers[deviceNum].setRumble((byte)lightBoosted, (byte)heavyBoosted);
|
if (device != null)
|
||||||
|
device.setRumble((byte)lightBoosted, (byte)heavyBoosted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1149,8 +1149,6 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
Enable_Controls(Index, true);
|
Enable_Controls(Index, true);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
opt.inputtimer.Stop();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1251,13 +1249,7 @@ namespace DS4Windows
|
|||||||
if (Pads[Index].Text != Properties.Resources.Connecting)
|
if (Pads[Index].Text != Properties.Resources.Connecting)
|
||||||
{
|
{
|
||||||
Enable_Controls(Index, true);
|
Enable_Controls(Index, true);
|
||||||
//if (opt != null)
|
|
||||||
// if (opt.Visible && tabMain.SelectedIndex == 1)
|
|
||||||
//opt.inputtimer.Start();
|
|
||||||
//MinimumSize = new Size(MinimumSize.Width, 137 + 29 * Index);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
opt.inputtimer.Stop();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1439,8 +1431,6 @@ namespace DS4Windows
|
|||||||
|
|
||||||
private void ShowOptions(int devID, string profile)
|
private void ShowOptions(int devID, string profile)
|
||||||
{
|
{
|
||||||
//if (opt != null)
|
|
||||||
//opt.Close();
|
|
||||||
Show();
|
Show();
|
||||||
WindowState = FormWindowState.Normal;
|
WindowState = FormWindowState.Normal;
|
||||||
toolStrip1.Enabled = false;
|
toolStrip1.Enabled = false;
|
||||||
@ -1450,7 +1440,7 @@ namespace DS4Windows
|
|||||||
tSTBProfile.Text = profile;
|
tSTBProfile.Text = profile;
|
||||||
else
|
else
|
||||||
tSTBProfile.Text = "<" + Properties.Resources.TypeProfileName + ">";
|
tSTBProfile.Text = "<" + Properties.Resources.TypeProfileName + ">";
|
||||||
//opt = new Options(devID, profile, this);
|
|
||||||
lBProfiles.SendToBack();
|
lBProfiles.SendToBack();
|
||||||
toolStrip1.SendToBack();
|
toolStrip1.SendToBack();
|
||||||
tSOptions.SendToBack();
|
tSOptions.SendToBack();
|
||||||
@ -1462,8 +1452,10 @@ namespace DS4Windows
|
|||||||
if (Size.Width < (int)(20 * dpix) + Options.mSize.Width)
|
if (Size.Width < (int)(20 * dpix) + Options.mSize.Width)
|
||||||
Size = new System.Drawing.Size((int)(20 * dpix) + Options.mSize.Width, Size.Height);
|
Size = new System.Drawing.Size((int)(20 * dpix) + Options.mSize.Width, Size.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
tabMain.SelectedIndex = 1;
|
tabMain.SelectedIndex = 1;
|
||||||
opt.Reload(devID, profile);
|
opt.Reload(devID, profile);
|
||||||
|
opt.inputtimer.Start();
|
||||||
opt.Visible = true;
|
opt.Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1487,6 +1479,9 @@ namespace DS4Windows
|
|||||||
|
|
||||||
if (!lbNoControllers.Visible)
|
if (!lbNoControllers.Visible)
|
||||||
tabMain.SelectedIndex = 0;
|
tabMain.SelectedIndex = 0;
|
||||||
|
|
||||||
|
opt.inputtimer.Stop();
|
||||||
|
opt.sixaxisTimer.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editButtons_Click(object sender, EventArgs e)
|
private void editButtons_Click(object sender, EventArgs e)
|
||||||
@ -1734,10 +1729,11 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
lbLastMessage.Text = "";
|
lbLastMessage.Text = "";
|
||||||
|
|
||||||
if (tabMain.SelectedIndex != 1 || !opt.Visible)
|
/*if (tabMain.SelectedIndex != 1 || !opt.Visible)
|
||||||
opt.inputtimer.Stop();
|
opt.inputtimer.Stop();
|
||||||
else if (opt.Visible && tabMain.SelectedIndex == 1)
|
else if (opt.Visible && tabMain.SelectedIndex == 1)
|
||||||
opt.inputtimer.Start();
|
opt.inputtimer.Start();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Items_MouseHover(object sender, EventArgs e)
|
private void Items_MouseHover(object sender, EventArgs e)
|
||||||
@ -2157,12 +2153,12 @@ namespace DS4Windows
|
|||||||
toolTip1.Show(Properties.Resources.InputDelay.Replace("*number*", latency.ToString()), lb, lb.Size.Width, 0);
|
toolTip1.Show(Properties.Resources.InputDelay.Replace("*number*", latency.ToString()), lb, lb.Size.Width, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Pads_MouseLeave(object sender, EventArgs e)
|
private void Pads_MouseLeave(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
toolTip1.Hide((Label)sender);
|
toolTip1.Hide((Label)sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
Process bat;
|
Process bat;
|
||||||
private void btnConnectDS4Win10_Click(object sender, EventArgs e)
|
private void btnConnectDS4Win10_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -2179,6 +2175,7 @@ namespace DS4Windows
|
|||||||
bat = Process.Start(exepath + "\\ConnectDS4.bat");
|
bat = Process.Start(exepath + "\\ConnectDS4.bat");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int currentCustomLed;
|
int currentCustomLed;
|
||||||
private void EditCustomLed(object sender, EventArgs e)
|
private void EditCustomLed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -2205,6 +2202,7 @@ namespace DS4Windows
|
|||||||
UseCustomLed[currentCustomLed] = true;
|
UseCustomLed[currentCustomLed] = true;
|
||||||
Global.Save();
|
Global.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
DS4LightBar.forcedFlash[currentCustomLed] = 0;
|
DS4LightBar.forcedFlash[currentCustomLed] = 0;
|
||||||
DS4LightBar.forcelight[currentCustomLed] = false;
|
DS4LightBar.forcelight[currentCustomLed] = false;
|
||||||
}
|
}
|
||||||
|
@ -658,7 +658,6 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateLists();
|
UpdateLists();
|
||||||
inputtimer.Start();
|
|
||||||
LoadActions(string.IsNullOrEmpty(filename));
|
LoadActions(string.IsNullOrEmpty(filename));
|
||||||
loading = false;
|
loading = false;
|
||||||
saving = false;
|
saving = false;
|
||||||
|
@ -149,8 +149,8 @@ namespace DS4Windows
|
|||||||
private byte ledFlashOn, ledFlashOff;
|
private byte ledFlashOn, ledFlashOff;
|
||||||
private Thread ds4Input, ds4Output;
|
private Thread ds4Input, ds4Output;
|
||||||
private int battery;
|
private int battery;
|
||||||
private DS4Audio audio = new DS4Audio();
|
private DS4Audio audio = null;
|
||||||
private DS4Audio micAudio = new DS4Audio(DS4Library.CoreAudio.DataFlow.Render);
|
private DS4Audio micAudio = null;
|
||||||
public DateTime lastActive = DateTime.UtcNow;
|
public DateTime lastActive = DateTime.UtcNow;
|
||||||
public DateTime firstActive = DateTime.UtcNow;
|
public DateTime firstActive = DateTime.UtcNow;
|
||||||
private bool charging;
|
private bool charging;
|
||||||
@ -173,6 +173,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
return HidDevice.IsExclusive;
|
return HidDevice.IsExclusive;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool isDisconnecting = false;
|
private bool isDisconnecting = false;
|
||||||
public bool IsDisconnecting
|
public bool IsDisconnecting
|
||||||
{
|
{
|
||||||
@ -182,6 +183,7 @@ namespace DS4Windows
|
|||||||
this.isDisconnecting = value;
|
this.isDisconnecting = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool isDisconnectingStatus()
|
public bool isDisconnectingStatus()
|
||||||
{
|
{
|
||||||
return this.isDisconnecting;
|
return this.isDisconnecting;
|
||||||
@ -375,6 +377,8 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
warnInterval = WARN_INTERVAL_BT;
|
warnInterval = WARN_INTERVAL_BT;
|
||||||
|
audio = new DS4Audio();
|
||||||
|
micAudio = new DS4Audio(DS4Library.CoreAudio.DataFlow.Render);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -300,6 +300,7 @@ namespace DS4Windows
|
|||||||
safeReadHandle = OpenHandle(_devicePath, true);
|
safeReadHandle = OpenHandle(_devicePath, true);
|
||||||
if (fileStream == null && !safeReadHandle.IsInvalid)
|
if (fileStream == null && !safeReadHandle.IsInvalid)
|
||||||
fileStream = new FileStream(safeReadHandle, FileAccess.ReadWrite, inputBuffer.Length, true);
|
fileStream = new FileStream(safeReadHandle, FileAccess.ReadWrite, inputBuffer.Length, true);
|
||||||
|
|
||||||
if (!safeReadHandle.IsInvalid && fileStream.CanRead)
|
if (!safeReadHandle.IsInvalid && fileStream.CanRead)
|
||||||
{
|
{
|
||||||
Task<int> readTask = fileStream.ReadAsync(inputBuffer, 0, inputBuffer.Length);
|
Task<int> readTask = fileStream.ReadAsync(inputBuffer, 0, inputBuffer.Length);
|
||||||
|
Loading…
Reference in New Issue
Block a user