Merge branch 'jay' into vigem-udpserver

This commit is contained in:
Travis Nickles 2018-08-18 02:21:18 -05:00
commit 098bfef33c
5 changed files with 68 additions and 80 deletions

View File

@ -231,9 +231,7 @@ namespace DS4Windows
public static string appdatapath;
public static bool firstRun = false;
public static bool multisavespots = false;
public static bool oldappdatafail = false;
public static string appDataPpath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Windows";
public static string oldappdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool";
public static bool runHotPlug = false;
public const int XINPUT_UNPLUG_SETTLE_TIME = 250; // Inhibit races that occur with the asynchronous teardown of ScpVBus -> X360 driver instance.
public static string[] tempprofilename = new string[5] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
@ -342,20 +340,6 @@ namespace DS4Windows
SaveWhere(exepath);
else if (File.Exists(appDataPpath + "\\Auto Profiles.xml"))
SaveWhere(appDataPpath);
else if (File.Exists(oldappdatapath + "\\Auto Profiles.xml"))
{
try
{
if (Directory.Exists(appDataPpath))
Directory.Move(appDataPpath, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Windows Old");
Directory.Move(oldappdatapath, appDataPpath);
SaveWhere(appDataPpath);
}
catch
{
Global.oldappdatafail = true;
}
}
else if (!File.Exists(exepath + "\\Auto Profiles.xml")
&& !File.Exists(appDataPpath + "\\Auto Profiles.xml"))
{
@ -374,7 +358,43 @@ namespace DS4Windows
catch { /* Skip setting culture that we cannot set */ }
}
public static void CreateStdActions()
{
XmlDocument xDoc = new XmlDocument();
try
{
string[] profiles = Directory.GetFiles(appdatapath + @"\Profiles\");
string s = string.Empty;
//foreach (string s in profiles)
for (int i = 0, proflen = profiles.Length; i < proflen; i++)
{
s = profiles[i];
if (Path.GetExtension(s) == ".xml")
{
xDoc.Load(s);
XmlNode el = xDoc.SelectSingleNode("DS4Windows/ProfileActions");
if (el != null)
{
if (string.IsNullOrEmpty(el.InnerText))
el.InnerText = "Disconnect Controller";
else
el.InnerText += "/Disconnect Controller";
}
else
{
XmlNode Node = xDoc.SelectSingleNode("DS4Windows");
el = xDoc.CreateElement("ProfileActions");
el.InnerText = "Disconnect Controller";
Node.AppendChild(el);
}
xDoc.Save(s);
LoadActions();
}
}
}
catch { }
}
public static event EventHandler<EventArgs> ControllerStatusChange; // called when a controller is added/removed/battery or touchpad mode changes/etc.
public static void ControllerStatusChanged(object sender)

View File

@ -88,13 +88,6 @@ namespace DS4Windows
{
new SaveWhere(Global.multisavespots).ShowDialog();
}
else if (Global.oldappdatafail)
{
MessageBox.Show(Properties.Resources.CannotMoveFiles, "DS4Windows");
Process.Start("explorer.exe", @"/select, " + appDataPpath);
Close();
return;
}
Global.Load();
Global.SetCulture(UseLang);
@ -178,18 +171,16 @@ namespace DS4Windows
}
catch { }
MessageBox.Show("Copy complete, please relaunch DS4Windows and remove settings from Program Directory", "DS4Windows");
appdatapath = null;
Close();
return;
}
else
{
MessageBox.Show("DS4Windows cannot edit settings here, This will now close", "DS4Windows");
}
appdatapath = null;
Close();
return;
}
}
cBUseWhiteIcon.Checked = UseWhiteIcon;
Icon = Properties.Resources.DS4W;
@ -223,40 +214,7 @@ namespace DS4Windows
if (!LoadActions()) //if first no actions have been made yet, create PS+Option to D/C and save it to every profile
{
XmlDocument xDoc = new XmlDocument();
try
{
string[] profiles = Directory.GetFiles(appdatapath + @"\Profiles\");
string s = string.Empty;
//foreach (string s in profiles)
for (int i = 0, proflen = profiles.Length; i < proflen; i++)
{
s = profiles[i];
if (Path.GetExtension(s) == ".xml")
{
xDoc.Load(s);
XmlNode el = xDoc.SelectSingleNode("DS4Windows/ProfileActions");
if (el != null)
{
if (string.IsNullOrEmpty(el.InnerText))
el.InnerText = "Disconnect Controller";
else
el.InnerText += "/Disconnect Controller";
}
else
{
XmlNode Node = xDoc.SelectSingleNode("DS4Windows");
el = xDoc.CreateElement("ProfileActions");
el.InnerText = "Disconnect Controller";
Node.AppendChild(el);
}
xDoc.Save(s);
LoadActions();
}
}
}
catch { }
Global.CreateStdActions();
}
bool start = true;
@ -317,9 +275,6 @@ namespace DS4Windows
hotkeysTimer.Start();
}
if (btnStartStop.Enabled && start)
BtnStartStop_Clicked();
startToolStripMenuItem.Text = btnStartStop.Text;
cBoxNotifications.SelectedIndex = Notifications;
cBSwipeProfiles.Checked = SwipeProfiles;
@ -440,6 +395,9 @@ namespace DS4Windows
control.MouseHover += ClearLastMessage;
}
}
if (btnStartStop.Enabled && start)
TaskRunner.Delay(10).ContinueWith((t) => this.BeginInvoke((System.Action)(() => BtnStartStop_Clicked())));
}
private void populateHoverTextDict()
@ -576,23 +534,33 @@ namespace DS4Windows
{
string slide = Program.rootHub.TouchpadSlide(i);
if (slide == "left")
{
this.BeginInvoke((System.Action)(() =>
{
if (cbs[i].SelectedIndex <= 0)
cbs[i].SelectedIndex = cbs[i].Items.Count - 2;
else
cbs[i].SelectedIndex--;
}));
}
else if (slide == "right")
{
this.BeginInvoke((System.Action)(() =>
{
if (cbs[i].SelectedIndex == cbs[i].Items.Count - 2)
cbs[i].SelectedIndex = 0;
else
cbs[i].SelectedIndex++;
}));
}
if (slide.Contains("t"))
{
this.BeginInvoke((System.Action)(() =>
{
ShowNotification(this, Properties.Resources.UsingProfile.Replace("*number*", (i + 1).ToString()).Replace("*Profile name*", cbs[i].Text));
}));
}
}
}

View File

@ -33,7 +33,7 @@ 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.5.5")]
[assembly: AssemblyFileVersion("1.5.5")]
[assembly: AssemblyVersion("1.5.6")]
[assembly: AssemblyFileVersion("1.5.6")]
[assembly: NeutralResourcesLanguage("en")]

View File

@ -13,7 +13,7 @@ website at [ds4windows.com](http://ds4windows.com).
- **[Main builds of DS4Windows](https://github.com/Ryochan7/DS4Windows/releases)**
- Alternative builds:
- [UdpServer ViGEm build](http://ryochan7.xyz/ds4windows/test/DS4Windows_1.5.4_ViGEm_UdpServer_x64.zip)
- [UdpServer ViGEm build](http://ryochan7.xyz/ds4windows/test/DS4Windows_1.5.5_ViGEm_UdpServer_x64.zip)
## Requirements

View File

@ -1,6 +1,6 @@
# TODO
* Perform some final cleanup and release version 1.5
* ~~Perform some final cleanup and release version 1.5~~
* Attempt to remove reliance on the main thread when disconnecting a device.
Currently used to delay hotplug routine
* Look into distributing profile properties around various objects