2014-03-28 02:50:40 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using DS4Control;
|
2014-05-30 22:39:39 +02:00
|
|
|
|
using DS4Library;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Collections.Generic;
|
2014-05-14 09:12:15 +02:00
|
|
|
|
using System.Net;
|
2014-05-21 07:36:05 +02:00
|
|
|
|
using System.Management;
|
2014-05-30 22:39:39 +02:00
|
|
|
|
using System.Drawing;
|
2014-05-21 19:39:56 +02:00
|
|
|
|
using Microsoft.Win32;
|
2014-05-28 21:47:25 +02:00
|
|
|
|
using System.Diagnostics;
|
2014-06-06 22:38:52 +02:00
|
|
|
|
using System.Xml;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
using System.Text;
|
2014-06-26 20:02:01 +02:00
|
|
|
|
using System.Globalization;
|
2014-11-20 20:03:18 +01:00
|
|
|
|
using System.Threading.Tasks;
|
2014-12-17 19:29:22 +01:00
|
|
|
|
using System.ServiceProcess;
|
2014-11-18 22:23:41 +01:00
|
|
|
|
namespace DS4Windows
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-11-14 20:44:50 +01:00
|
|
|
|
public partial class DS4Form : Form
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-10-13 23:56:04 +02:00
|
|
|
|
public string[] arguements;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
delegate void LogDebugDelegate(DateTime Time, String Data);
|
|
|
|
|
|
2014-05-30 22:39:39 +02:00
|
|
|
|
protected Label[] Pads, Batteries;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
protected ComboBox[] cbs;
|
|
|
|
|
protected Button[] ebns;
|
2014-05-30 22:39:39 +02:00
|
|
|
|
protected PictureBox[] statPB;
|
2014-04-29 03:14:01 +02:00
|
|
|
|
protected ToolStripMenuItem[] shortcuts;
|
2014-05-14 09:12:15 +02:00
|
|
|
|
WebClient wc = new WebClient();
|
2014-11-18 22:23:41 +01:00
|
|
|
|
Timer test = new Timer(), hotkeysTimer = new Timer();
|
2014-06-06 22:38:52 +02:00
|
|
|
|
string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
|
2014-12-02 01:07:29 +01:00
|
|
|
|
string appdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Windows";
|
|
|
|
|
string oldappdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool";
|
2014-06-06 22:38:52 +02:00
|
|
|
|
float dpix, dpiy;
|
|
|
|
|
DateTime oldnow = DateTime.UtcNow;
|
|
|
|
|
string tempprofile = "null";
|
2014-06-09 01:41:36 +02:00
|
|
|
|
List<string> profilenames= new List<string>();
|
2014-06-06 22:38:52 +02:00
|
|
|
|
List<string> programpaths = new List<string>();
|
|
|
|
|
List<string>[] proprofiles;
|
|
|
|
|
private static int WM_QUERYENDSESSION = 0x11;
|
|
|
|
|
private static bool systemShutdown = false;
|
2014-08-23 22:52:20 +02:00
|
|
|
|
private bool wasrunning = false;
|
2014-06-06 22:38:52 +02:00
|
|
|
|
delegate void ControllerStatusChangedDelegate(object sender, EventArgs e);
|
|
|
|
|
delegate void HotKeysDelegate(object sender, EventArgs e);
|
|
|
|
|
Options opt;
|
|
|
|
|
private System.Drawing.Size oldsize;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
WinProgs WP;
|
2014-09-02 01:23:02 +02:00
|
|
|
|
ToolTip tt = new ToolTip();
|
2014-09-15 04:37:14 +02:00
|
|
|
|
public String m_Profile = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + "\\Profiles.xml";
|
|
|
|
|
protected XmlDocument m_Xdoc = new XmlDocument();
|
2014-12-13 21:12:03 +01:00
|
|
|
|
public bool mAllowVisible;
|
|
|
|
|
bool contextclose;
|
2014-12-17 19:29:22 +01:00
|
|
|
|
string logFile = Global.appdatapath + @"\DS4Service.log";
|
|
|
|
|
StreamWriter logWriter;
|
|
|
|
|
//bool outputlog = false;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
[DllImport("user32.dll")]
|
|
|
|
|
private static extern IntPtr GetForegroundWindow();
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll")]
|
|
|
|
|
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
|
|
|
|
|
|
|
|
|
[DllImport("kernel32.dll")]
|
|
|
|
|
private static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle, uint dwProcessId);
|
|
|
|
|
|
|
|
|
|
[DllImport("kernel32.dll")]
|
|
|
|
|
private static extern bool CloseHandle(IntPtr handle);
|
|
|
|
|
|
|
|
|
|
[DllImport("psapi.dll")]
|
|
|
|
|
private static extern uint GetModuleBaseName(IntPtr hWnd, IntPtr hModule, StringBuilder lpFileName, int nSize);
|
|
|
|
|
|
|
|
|
|
[DllImport("psapi.dll")]
|
|
|
|
|
private static extern uint GetModuleFileNameEx(IntPtr hWnd, IntPtr hModule, StringBuilder lpFileName, int nSize);
|
|
|
|
|
|
2014-11-14 20:44:50 +01:00
|
|
|
|
public DS4Form(string[] args)
|
2014-05-30 22:39:39 +02:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2014-10-13 23:56:04 +02:00
|
|
|
|
arguements = args;
|
2014-05-30 22:39:39 +02:00
|
|
|
|
ThemeUtil.SetTheme(lvDebug);
|
2014-11-20 20:03:18 +01:00
|
|
|
|
Pads = new Label[4] { lbPad1, lbPad2, lbPad3, lbPad4 };
|
|
|
|
|
Batteries = new Label[4] { lBBatt1, lBBatt2, lBBatt3, lBBatt4 };
|
|
|
|
|
cbs = new ComboBox[4] { cBController1, cBController2, cBController3, cBController4 };
|
|
|
|
|
ebns = new Button[4] { bnEditC1, bnEditC2, bnEditC3, bnEditC4 };
|
|
|
|
|
statPB = new PictureBox[4] { pBStatus1, pBStatus2, pBStatus3, pBStatus4 };
|
|
|
|
|
shortcuts = new ToolStripMenuItem[4] { (ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[0],
|
|
|
|
|
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[1],
|
|
|
|
|
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[2],
|
|
|
|
|
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[3] };
|
2014-06-06 22:38:52 +02:00
|
|
|
|
SystemEvents.PowerModeChanged += OnPowerChange;
|
2014-06-02 19:29:38 +02:00
|
|
|
|
tSOptions.Visible = false;
|
2014-11-04 05:43:38 +01:00
|
|
|
|
bool firstrun = false;
|
|
|
|
|
if (File.Exists(exepath + "\\Auto Profiles.xml")
|
2014-12-03 23:36:54 +01:00
|
|
|
|
&& File.Exists(appdatapath + "\\Auto Profiles.xml"))
|
2014-11-04 05:43:38 +01:00
|
|
|
|
{
|
|
|
|
|
firstrun = true;
|
|
|
|
|
new SaveWhere(true).ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
else if (File.Exists(exepath + "\\Auto Profiles.xml"))
|
|
|
|
|
Global.SaveWhere(exepath);
|
|
|
|
|
else if (File.Exists(appdatapath + "\\Auto Profiles.xml"))
|
|
|
|
|
Global.SaveWhere(appdatapath);
|
2014-12-02 01:07:29 +01:00
|
|
|
|
else if (File.Exists(oldappdatapath + "\\Auto Profiles.xml"))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2014-12-03 23:36:54 +01:00
|
|
|
|
if (Directory.Exists(appdatapath))
|
|
|
|
|
Directory.Move(appdatapath, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Windows Old");
|
2014-12-02 01:07:29 +01:00
|
|
|
|
Directory.Move(oldappdatapath, appdatapath);
|
|
|
|
|
Global.SaveWhere(appdatapath);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
2014-12-03 23:36:54 +01:00
|
|
|
|
MessageBox.Show(Properties.Resources.CannotMoveFiles, "DS4Windows");
|
|
|
|
|
Process.Start("explorer.exe", @"/select, " + appdatapath);
|
2014-12-02 01:07:29 +01:00
|
|
|
|
Close();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-04 05:43:38 +01:00
|
|
|
|
else if (!File.Exists(exepath + "\\Auto Profiles.xml")
|
|
|
|
|
&& !File.Exists(appdatapath + "\\Auto Profiles.xml"))
|
|
|
|
|
{
|
|
|
|
|
firstrun = true;
|
|
|
|
|
new SaveWhere(false).ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
if (firstrun)
|
|
|
|
|
CheckDrivers();
|
|
|
|
|
else
|
2014-10-14 20:54:42 +02:00
|
|
|
|
{
|
2014-11-04 04:44:55 +01:00
|
|
|
|
var AppCollectionThread = new System.Threading.Thread(() => CheckDrivers());
|
|
|
|
|
AppCollectionThread.IsBackground = true;
|
|
|
|
|
AppCollectionThread.Start();
|
2014-11-04 05:43:38 +01:00
|
|
|
|
}
|
2014-10-14 20:54:42 +02:00
|
|
|
|
|
2014-11-04 05:43:38 +01:00
|
|
|
|
if (String.IsNullOrEmpty(Global.appdatapath))
|
|
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Graphics g = this.CreateGraphics();
|
|
|
|
|
try
|
|
|
|
|
{
|
2014-11-14 20:44:50 +01:00
|
|
|
|
dpix = g.DpiX / 100f * 1.041666666667f;
|
|
|
|
|
dpiy = g.DpiY / 100f * 1.041666666667f;
|
2014-11-04 05:43:38 +01:00
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
g.Dispose();
|
|
|
|
|
}
|
2014-11-14 20:44:50 +01:00
|
|
|
|
Icon = Properties.Resources.DS4W;
|
|
|
|
|
notifyIcon1.Icon = Properties.Resources.DS4W;
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Program.rootHub.Debug += On_Debug;
|
2014-12-17 19:29:22 +01:00
|
|
|
|
|
2014-11-04 05:43:38 +01:00
|
|
|
|
Log.GuiLog += On_Debug;
|
2014-12-17 19:29:22 +01:00
|
|
|
|
logFile = Global.appdatapath + "\\DS4Windows.log";
|
|
|
|
|
//logWriter = File.AppendText(logFile);
|
2014-11-04 05:43:38 +01:00
|
|
|
|
Log.TrayIconLog += ShowNotification;
|
|
|
|
|
// tmrUpdate.Enabled = true; TODO remove tmrUpdate and leave tick()
|
2014-10-14 20:54:42 +02:00
|
|
|
|
|
2014-11-04 05:43:38 +01:00
|
|
|
|
Directory.CreateDirectory(Global.appdatapath);
|
|
|
|
|
Global.Load();
|
|
|
|
|
if (!Global.Save()) //if can't write to file
|
|
|
|
|
if (MessageBox.Show("Cannot write at current locataion\nCopy Settings to appdata?", "DS4Windows",
|
|
|
|
|
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
try
|
2014-10-14 20:54:42 +02:00
|
|
|
|
{
|
2014-11-04 05:43:38 +01:00
|
|
|
|
Directory.CreateDirectory(appdatapath);
|
|
|
|
|
File.Copy(exepath + "\\Profiles.xml", appdatapath + "\\Profiles.xml");
|
|
|
|
|
File.Copy(exepath + "\\Auto Profiles.xml", appdatapath + "\\Auto Profiles.xml");
|
|
|
|
|
Directory.CreateDirectory(appdatapath + "\\Profiles");
|
|
|
|
|
foreach (string s in Directory.GetFiles(exepath + "\\Profiles"))
|
2014-10-14 20:54:42 +02:00
|
|
|
|
{
|
2014-11-04 05:43:38 +01:00
|
|
|
|
File.Copy(s, appdatapath + "\\Profiles\\" + Path.GetFileName(s));
|
2014-10-14 20:54:42 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-04 05:43:38 +01:00
|
|
|
|
catch { }
|
|
|
|
|
MessageBox.Show("Copy complete, please relaunch DS4Windows and remove settings from Program Directory", "DS4Windows");
|
|
|
|
|
Global.appdatapath = null;
|
|
|
|
|
Close();
|
|
|
|
|
return;
|
2014-10-14 20:54:42 +02:00
|
|
|
|
}
|
2014-11-04 05:43:38 +01:00
|
|
|
|
else
|
2014-10-14 20:54:42 +02:00
|
|
|
|
{
|
2014-11-04 05:43:38 +01:00
|
|
|
|
MessageBox.Show("DS4Windows cannot edit settings here, This will now close", "DS4Windows");
|
|
|
|
|
Global.appdatapath = null;
|
|
|
|
|
Close();
|
|
|
|
|
return;
|
2014-10-14 20:54:42 +02:00
|
|
|
|
}
|
2014-11-04 05:43:38 +01:00
|
|
|
|
foreach (ToolStripMenuItem t in shortcuts)
|
|
|
|
|
t.DropDownItemClicked += Profile_Changed_Menu;
|
|
|
|
|
hideDS4CheckBox.CheckedChanged -= hideDS4CheckBox_CheckedChanged;
|
|
|
|
|
hideDS4CheckBox.Checked = Global.getUseExclusiveMode();
|
|
|
|
|
hideDS4CheckBox.CheckedChanged += hideDS4CheckBox_CheckedChanged;
|
|
|
|
|
cBDisconnectBT.Checked = Global.getDCBTatStop();
|
2014-11-20 20:03:18 +01:00
|
|
|
|
cBQuickCharge.Checked = Global.getQuickCharge();
|
2014-12-03 23:36:54 +01:00
|
|
|
|
nUDXIPorts.Value = Global.getFirstXinputPort();
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Program.rootHub.x360Bus.FirstController = Global.getFirstXinputPort();
|
2014-11-04 05:43:38 +01:00
|
|
|
|
// New settings
|
|
|
|
|
this.Width = Global.getFormWidth();
|
|
|
|
|
this.Height = Global.getFormHeight();
|
|
|
|
|
startMinimizedCheckBox.CheckedChanged -= startMinimizedCheckBox_CheckedChanged;
|
|
|
|
|
startMinimizedCheckBox.Checked = Global.getStartMinimized();
|
|
|
|
|
startMinimizedCheckBox.CheckedChanged += startMinimizedCheckBox_CheckedChanged;
|
2014-12-13 21:12:03 +01:00
|
|
|
|
cBCloseMini.Checked = Global.getCloseMini();
|
|
|
|
|
Global.LoadActions();
|
|
|
|
|
bool start = true;
|
|
|
|
|
bool mini = false;
|
|
|
|
|
for (int i = 0; i < arguements.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (arguements[i] == "-stop")
|
|
|
|
|
start = false;
|
|
|
|
|
if (arguements[i] == "-m")
|
|
|
|
|
mini = true;
|
|
|
|
|
if (mini && start)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!(startMinimizedCheckBox.Checked || mini))
|
2014-11-20 20:03:18 +01:00
|
|
|
|
{
|
|
|
|
|
mAllowVisible = true;
|
|
|
|
|
Show();
|
|
|
|
|
}
|
2014-11-04 05:43:38 +01:00
|
|
|
|
Form_Resize(null, null);
|
|
|
|
|
RefreshProfiles();
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
{
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Global.LoadProfile(i, true, Program.rootHub);
|
2014-11-04 05:43:38 +01:00
|
|
|
|
}
|
|
|
|
|
LoadP();
|
|
|
|
|
Global.ControllerStatusChange += ControllerStatusChange;
|
2014-12-03 23:36:54 +01:00
|
|
|
|
Enable_Controls(0, false);
|
|
|
|
|
Enable_Controls(1, false);
|
|
|
|
|
Enable_Controls(2, false);
|
|
|
|
|
Enable_Controls(3, false);
|
2014-11-04 05:43:38 +01:00
|
|
|
|
if (btnStartStop.Enabled && start)
|
|
|
|
|
btnStartStop_Clicked();
|
|
|
|
|
startToolStripMenuItem.Text = btnStartStop.Text;
|
|
|
|
|
cBNotifications.Checked = Global.getNotifications();
|
|
|
|
|
cBSwipeProfiles.Checked = Global.getSwipeProfiles();
|
|
|
|
|
int checkwhen = Global.getCheckWhen();
|
|
|
|
|
cBUpdate.Checked = checkwhen > 0;
|
|
|
|
|
if (checkwhen > 23)
|
|
|
|
|
{
|
|
|
|
|
cBUpdateTime.SelectedIndex = 1;
|
|
|
|
|
nUDUpdateTime.Value = checkwhen / 24;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cBUpdateTime.SelectedIndex = 0;
|
|
|
|
|
nUDUpdateTime.Value = checkwhen;
|
|
|
|
|
}
|
|
|
|
|
Uri url = new Uri("http://ds4windows.com/Files/Builds/newest.txt"); //Sorry other devs, gonna have to find your own server
|
2014-10-14 20:54:42 +02:00
|
|
|
|
|
|
|
|
|
|
2014-11-04 05:43:38 +01:00
|
|
|
|
if (checkwhen > 0 && DateTime.Now >= Global.getLastChecked() + TimeSpan.FromHours(checkwhen))
|
|
|
|
|
{
|
|
|
|
|
wc.DownloadFileAsync(url, Global.appdatapath + "\\version.txt");
|
|
|
|
|
wc.DownloadFileCompleted += Check_Version;
|
|
|
|
|
Global.setLastChecked(DateTime.Now);
|
|
|
|
|
}
|
2014-10-14 20:54:42 +02:00
|
|
|
|
|
2014-11-04 05:43:38 +01:00
|
|
|
|
if (File.Exists(exepath + "\\Updater.exe"))
|
|
|
|
|
{
|
|
|
|
|
System.Threading.Thread.Sleep(2000);
|
|
|
|
|
File.Delete(exepath + "\\Updater.exe");
|
2014-10-14 20:54:42 +02:00
|
|
|
|
}
|
2014-11-04 05:43:38 +01:00
|
|
|
|
//test.Start();
|
2014-11-18 22:23:41 +01:00
|
|
|
|
hotkeysTimer.Start();
|
|
|
|
|
hotkeysTimer.Tick += Hotkeys;
|
2014-11-04 05:43:38 +01:00
|
|
|
|
test.Tick += test_Tick;
|
|
|
|
|
if (!System.IO.Directory.Exists(Global.appdatapath + "\\Virtual Bus Driver"))
|
|
|
|
|
linkUninstall.Visible = false;
|
2014-12-13 21:12:03 +01:00
|
|
|
|
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk"))
|
|
|
|
|
{
|
|
|
|
|
StartWindowsCheckBox.Checked = true;
|
|
|
|
|
string lnkpath = WinProgs.ResolveShortcutAndArgument(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
|
2014-12-20 02:31:00 +01:00
|
|
|
|
if (!lnkpath.EndsWith("-m"))
|
2014-12-13 21:12:03 +01:00
|
|
|
|
{
|
|
|
|
|
File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
|
|
|
|
|
appShortcutToStartup();
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-06-09 01:41:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-20 20:03:18 +01:00
|
|
|
|
protected override void SetVisibleCore(bool value)
|
|
|
|
|
{
|
|
|
|
|
if (!mAllowVisible)
|
|
|
|
|
{
|
|
|
|
|
value = false;
|
|
|
|
|
if (!this.IsHandleCreated) CreateHandle();
|
|
|
|
|
}
|
|
|
|
|
base.SetVisibleCore(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void showToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
mAllowVisible = true;
|
|
|
|
|
Show();
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-09 01:41:36 +02:00
|
|
|
|
public static string GetTopWindowName()
|
|
|
|
|
{
|
|
|
|
|
IntPtr hWnd = GetForegroundWindow();
|
|
|
|
|
uint lpdwProcessId;
|
|
|
|
|
GetWindowThreadProcessId(hWnd, out lpdwProcessId);
|
|
|
|
|
|
|
|
|
|
IntPtr hProcess = OpenProcess(0x0410, false, lpdwProcessId);
|
|
|
|
|
|
|
|
|
|
StringBuilder text = new StringBuilder(1000);
|
|
|
|
|
GetModuleFileNameEx(hProcess, IntPtr.Zero, text, text.Capacity);
|
|
|
|
|
|
|
|
|
|
CloseHandle(hProcess);
|
|
|
|
|
|
|
|
|
|
return text.ToString();
|
2014-05-31 06:37:02 +02:00
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
|
|
|
|
private void OnPowerChange(object s, PowerModeChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
switch (e.Mode)
|
|
|
|
|
{
|
|
|
|
|
case PowerModes.Resume:
|
2014-08-23 22:52:20 +02:00
|
|
|
|
if (btnStartStop.Text == Properties.Resources.StartText && wasrunning)
|
|
|
|
|
{
|
|
|
|
|
DS4LightBar.shuttingdown = false;
|
|
|
|
|
wasrunning = false;
|
2014-06-06 22:38:52 +02:00
|
|
|
|
btnStartStop_Clicked();
|
2014-08-23 22:52:20 +02:00
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
break;
|
|
|
|
|
case PowerModes.Suspend:
|
2014-08-17 00:09:15 +02:00
|
|
|
|
if (btnStartStop.Text == Properties.Resources.StopText)
|
2014-08-23 22:52:20 +02:00
|
|
|
|
{
|
|
|
|
|
DS4LightBar.shuttingdown = true;
|
2014-06-06 22:38:52 +02:00
|
|
|
|
btnStartStop_Clicked();
|
2014-08-23 22:52:20 +02:00
|
|
|
|
wasrunning = true;
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-02 19:29:38 +02:00
|
|
|
|
private void test_Tick(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
lBTest.Visible = true;
|
2014-12-13 21:12:03 +01:00
|
|
|
|
lBTest.Text = Program.rootHub.oldtouchvalue[0].ToString();
|
2014-06-02 19:29:38 +02:00
|
|
|
|
}
|
2014-06-02 05:19:04 +02:00
|
|
|
|
void Hotkeys(object sender, EventArgs e)
|
2014-05-28 21:47:25 +02:00
|
|
|
|
{
|
2014-06-21 20:00:28 +02:00
|
|
|
|
if (Global.getSwipeProfiles())
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
{
|
2014-12-13 21:12:03 +01:00
|
|
|
|
string slide = Program.rootHub.TouchpadSlide(i);
|
2014-06-21 20:00:28 +02:00
|
|
|
|
if (slide == "left")
|
|
|
|
|
if (cbs[i].SelectedIndex <= 0)
|
|
|
|
|
cbs[i].SelectedIndex = cbs[i].Items.Count - 2;
|
|
|
|
|
else
|
|
|
|
|
cbs[i].SelectedIndex--;
|
|
|
|
|
else if (slide == "right")
|
|
|
|
|
if (cbs[i].SelectedIndex == cbs[i].Items.Count - 2)
|
|
|
|
|
cbs[i].SelectedIndex = 0;
|
|
|
|
|
else
|
|
|
|
|
cbs[i].SelectedIndex++;
|
|
|
|
|
if (slide.Contains("t"))
|
2014-08-17 00:09:15 +02:00
|
|
|
|
ShowNotification(this, Properties.Resources.UsingProfile.Replace("*number*", (i + 1).ToString()).Replace("*Profile name*", cbs[i].Text));
|
2014-06-21 20:00:28 +02:00
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
|
|
|
|
//Check for process for auto profiles
|
2014-06-09 01:41:36 +02:00
|
|
|
|
if (tempprofile == "null")
|
|
|
|
|
for (int i = 0; i < programpaths.Count; i++)
|
|
|
|
|
{
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
string name = programpaths[i].ToLower().Replace('/', '\\');
|
|
|
|
|
if (name == GetTopWindowName().ToLower().Replace('/', '\\'))
|
2014-06-09 01:41:36 +02:00
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < 4; j++)
|
2014-08-17 00:09:15 +02:00
|
|
|
|
if (proprofiles[j][i] != "(none)" && proprofiles[j][i] != Properties.Resources.noneProfile)
|
2014-07-26 01:17:45 +02:00
|
|
|
|
{
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Global.LoadTempProfile(j, proprofiles[j][i], true, Program.rootHub); //j is controller index, i is filename
|
2014-07-26 01:17:45 +02:00
|
|
|
|
if (Global.getLaunchProgram(j) != string.Empty) Process.Start(Global.getLaunchProgram(j));
|
|
|
|
|
}
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
tempprofile = name;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
if (tempprofile != GetTopWindowName().ToLower().Replace('/', '\\'))
|
2014-06-09 01:41:36 +02:00
|
|
|
|
{
|
|
|
|
|
tempprofile = "null";
|
|
|
|
|
for (int j = 0; j < 4; j++)
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Global.LoadProfile(j, false, Program.rootHub);
|
2014-06-09 01:41:36 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
GC.Collect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void LoadP()
|
|
|
|
|
{
|
|
|
|
|
XmlDocument doc = new XmlDocument();
|
|
|
|
|
proprofiles = new List<string>[4] { new List<string>(), new List<string>(),
|
|
|
|
|
new List<string>(), new List<string>() };
|
|
|
|
|
programpaths.Clear();
|
|
|
|
|
if (!File.Exists(Global.appdatapath + "\\Auto Profiles.xml"))
|
|
|
|
|
return;
|
|
|
|
|
doc.Load(Global.appdatapath + "\\Auto Profiles.xml");
|
|
|
|
|
XmlNodeList programslist = doc.SelectNodes("Programs/Program");
|
|
|
|
|
foreach (XmlNode x in programslist)
|
|
|
|
|
programpaths.Add(x.Attributes["path"].Value);
|
|
|
|
|
foreach (string s in programpaths)
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
proprofiles[i].Add(doc.SelectSingleNode("/Programs/Program[@path=\"" + s + "\"]"
|
|
|
|
|
+ "/Controller" + (i + 1)).InnerText);
|
|
|
|
|
}
|
2014-05-28 04:49:58 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-21 07:36:05 +02:00
|
|
|
|
private void CheckDrivers()
|
|
|
|
|
{
|
|
|
|
|
bool deriverinstalled = false;
|
2014-07-08 20:21:09 +02:00
|
|
|
|
try
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
2014-07-08 20:21:09 +02:00
|
|
|
|
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PnPSignedDriver");
|
|
|
|
|
|
|
|
|
|
foreach (ManagementObject obj in searcher.Get())
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
2014-07-08 20:21:09 +02:00
|
|
|
|
try
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
2014-07-08 20:21:09 +02:00
|
|
|
|
if (obj.GetPropertyValue("DeviceName").ToString() == "Scp Virtual Bus Driver")
|
|
|
|
|
{
|
|
|
|
|
deriverinstalled = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
2014-07-08 20:21:09 +02:00
|
|
|
|
catch { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!deriverinstalled)
|
|
|
|
|
{
|
2014-12-02 01:07:29 +01:00
|
|
|
|
Process p = new Process();
|
|
|
|
|
p.StartInfo.FileName = Assembly.GetExecutingAssembly().Location;
|
|
|
|
|
p.StartInfo.Arguments = "driverinstall";
|
|
|
|
|
p.StartInfo.Verb = "runas";
|
|
|
|
|
try { p.Start(); }
|
|
|
|
|
catch { }
|
|
|
|
|
//WelcomeDialog wd = new WelcomeDialog();
|
|
|
|
|
//wd.ShowDialog();
|
|
|
|
|
//wd.FormClosed += delegate { btnStartStop_Clicked(false); btnStartStop_Clicked(false); };
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-07-08 20:21:09 +02:00
|
|
|
|
catch
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
2014-07-08 20:21:09 +02:00
|
|
|
|
if (!File.Exists(exepath + "\\Auto Profiles.xml") && !File.Exists(appdatapath + "\\Auto Profiles.xml"))
|
|
|
|
|
{
|
|
|
|
|
linkSetup.LinkColor = Color.Green;
|
2014-09-15 04:37:14 +02:00
|
|
|
|
tabSettings.Text += " (" + Properties.Resources.InstallDriver + ")";
|
2014-07-08 20:21:09 +02:00
|
|
|
|
}
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
2014-05-14 09:12:15 +02:00
|
|
|
|
}
|
2014-05-30 22:39:39 +02:00
|
|
|
|
|
2014-05-14 09:12:15 +02:00
|
|
|
|
private void Check_Version(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
|
|
|
|
|
{
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
|
|
|
|
|
string version = fvi.FileVersion;
|
|
|
|
|
string newversion = File.ReadAllText(Global.appdatapath + "\\version.txt");
|
2014-11-14 20:44:50 +01:00
|
|
|
|
if (version.Replace(',', '.').CompareTo(newversion) == -1)//CompareVersions();
|
2014-08-17 00:09:15 +02:00
|
|
|
|
if (MessageBox.Show(Properties.Resources.DownloadVersion.Replace("*number*", newversion), Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
{
|
2014-08-18 07:18:46 +02:00
|
|
|
|
if (!File.Exists(exepath + "\\DS4Updater.exe") || (File.Exists(exepath + "\\DS4Updater.exe")
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
&& (FileVersionInfo.GetVersionInfo(exepath + "\\DS4Updater.exe").FileVersion.CompareTo("1.1.0.0") == -1)))
|
|
|
|
|
{
|
2014-10-13 23:56:04 +02:00
|
|
|
|
Uri url2 = new Uri("http://ds4windows.com/Files/DS4Updater.exe");
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
WebClient wc2 = new WebClient();
|
|
|
|
|
if (Global.appdatapath == exepath)
|
|
|
|
|
wc2.DownloadFile(url2, exepath + "\\DS4Updater.exe");
|
|
|
|
|
else
|
2014-05-16 00:10:17 +02:00
|
|
|
|
{
|
2014-08-17 00:09:15 +02:00
|
|
|
|
MessageBox.Show(Properties.Resources.PleaseDownloadUpdater);
|
2014-10-13 23:56:04 +02:00
|
|
|
|
Process.Start("http://ds4windows.com/Files/DS4Updater.exe");
|
2014-05-16 00:10:17 +02:00
|
|
|
|
}
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
}
|
2014-08-18 07:18:46 +02:00
|
|
|
|
Process p = new Process();
|
|
|
|
|
p.StartInfo.FileName = exepath + "\\DS4Updater.exe";
|
|
|
|
|
if (Global.AdminNeeded())
|
|
|
|
|
p.StartInfo.Verb = "runas";
|
2014-12-02 01:07:29 +01:00
|
|
|
|
try { p.Start(); Close(); }
|
|
|
|
|
catch { }
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
}
|
2014-05-14 09:12:15 +02:00
|
|
|
|
else
|
2014-05-16 00:10:17 +02:00
|
|
|
|
File.Delete(Global.appdatapath + "\\version.txt");
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
else
|
|
|
|
|
File.Delete(Global.appdatapath + "\\version.txt");
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-06-09 01:41:36 +02:00
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public void RefreshProfiles()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2014-05-28 21:47:25 +02:00
|
|
|
|
profilenames.Clear();
|
2014-06-09 01:41:36 +02:00
|
|
|
|
string[] profiles = Directory.GetFiles(Global.appdatapath + @"\Profiles\");
|
2014-04-29 03:14:01 +02:00
|
|
|
|
foreach (String s in profiles)
|
|
|
|
|
if (s.EndsWith(".xml"))
|
2014-05-21 07:36:05 +02:00
|
|
|
|
profilenames.Add(Path.GetFileNameWithoutExtension(s));
|
2014-05-30 22:39:39 +02:00
|
|
|
|
lBProfiles.Items.Clear();
|
|
|
|
|
lBProfiles.Items.AddRange(profilenames.ToArray());
|
2014-09-15 04:37:14 +02:00
|
|
|
|
if (lBProfiles.Items.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
Global.SaveProfile(0, "Default", null, null);
|
|
|
|
|
Global.setAProfile(0, "Default");
|
|
|
|
|
RefreshProfiles();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
cbs[i].Items.Clear();
|
2014-04-29 03:14:01 +02:00
|
|
|
|
shortcuts[i].DropDownItems.Clear();
|
|
|
|
|
cbs[i].Items.AddRange(profilenames.ToArray());
|
|
|
|
|
foreach (string s in profilenames)
|
2014-09-15 04:37:14 +02:00
|
|
|
|
shortcuts[i].DropDownItems.Add(s);
|
2014-04-29 03:14:01 +02:00
|
|
|
|
for (int j = 0; j < cbs[i].Items.Count; j++)
|
2014-05-21 07:36:05 +02:00
|
|
|
|
if (cbs[i].Items[j].ToString() == Path.GetFileNameWithoutExtension(Global.getAProfile(i)))
|
2014-04-27 21:32:09 +02:00
|
|
|
|
{
|
|
|
|
|
cbs[i].SelectedIndex = j;
|
2014-04-29 03:14:01 +02:00
|
|
|
|
((ToolStripMenuItem)shortcuts[i].DropDownItems[j]).Checked = true;
|
|
|
|
|
Global.setAProfile(i, cbs[i].Text);
|
2014-08-17 00:09:15 +02:00
|
|
|
|
shortcuts[i].Text = Properties.Resources.ContextEdit.Replace("*number*", (i + 1).ToString());
|
|
|
|
|
ebns[i].Text = Properties.Resources.EditProfile;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
break;
|
2014-04-29 03:14:01 +02:00
|
|
|
|
}
|
2014-05-06 20:49:18 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
2014-08-17 00:09:15 +02:00
|
|
|
|
cbs[i].Text = "(" + Properties.Resources.NoProfileLoaded + ")";
|
|
|
|
|
shortcuts[i].Text = Properties.Resources.ContextNew.Replace("*number*", (i + 1).ToString());
|
|
|
|
|
ebns[i].Text = Properties.Resources.New;
|
2014-05-06 20:49:18 +02:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (DirectoryNotFoundException)
|
|
|
|
|
{
|
2014-09-15 04:37:14 +02:00
|
|
|
|
Directory.CreateDirectory(Global.appdatapath + @"\Profiles\");
|
|
|
|
|
Global.SaveProfile(0, "Default", null, null);
|
|
|
|
|
Global.setAProfile(0, "Default");
|
|
|
|
|
RefreshProfiles();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (!(cbs[0].Items.Count > 0 && cbs[0].Items[cbs[0].Items.Count - 1].ToString() == "+New Profile"))
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
{
|
2014-09-15 04:37:14 +02:00
|
|
|
|
cbs[i].Items.Add("+New Profile");
|
|
|
|
|
shortcuts[i].DropDownItems.Add("-");
|
|
|
|
|
shortcuts[i].DropDownItems.Add("+New Profile");
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
}
|
2014-09-15 04:37:14 +02:00
|
|
|
|
RefreshAutoProfilesPage();
|
2014-06-02 05:19:04 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
2014-05-19 07:55:12 +02:00
|
|
|
|
|
2014-06-09 01:41:36 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
public void RefreshAutoProfilesPage()
|
|
|
|
|
{
|
|
|
|
|
tabAutoProfiles.Controls.Clear();
|
2014-06-09 01:41:36 +02:00
|
|
|
|
WP = new WinProgs(profilenames.ToArray(), this);
|
2014-06-06 22:38:52 +02:00
|
|
|
|
WP.TopLevel = false;
|
|
|
|
|
WP.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
|
|
|
|
WP.Visible = true;
|
|
|
|
|
WP.Dock = DockStyle.Fill;
|
|
|
|
|
tabAutoProfiles.Controls.Add(WP);
|
|
|
|
|
}
|
2014-10-21 04:31:13 +02:00
|
|
|
|
protected async void LogDebug(DateTime Time, String Data)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-05-19 07:55:12 +02:00
|
|
|
|
if (lvDebug.InvokeRequired)
|
|
|
|
|
{
|
|
|
|
|
LogDebugDelegate d = new LogDebugDelegate(LogDebug);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
this.Invoke(d, new Object[] { Time, Data });
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-10-21 04:31:13 +02:00
|
|
|
|
if (Data.StartsWith("Warning"))
|
|
|
|
|
{
|
|
|
|
|
await System.Threading.Tasks.Task.Delay(5);
|
|
|
|
|
Time = DateTime.Now;
|
|
|
|
|
}
|
2014-05-21 07:36:05 +02:00
|
|
|
|
String Posted = Time.ToString("G");
|
2014-05-19 07:55:12 +02:00
|
|
|
|
|
|
|
|
|
lvDebug.Items.Add(new ListViewItem(new String[] { Posted, Data })).EnsureVisible();
|
|
|
|
|
|
|
|
|
|
//Added alternative
|
|
|
|
|
lbLastMessage.Text = Data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void ShowNotification(object sender, DebugEventArgs args)
|
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
if (Form.ActiveForm != this && cBNotifications.Checked)
|
2014-05-28 04:49:58 +02:00
|
|
|
|
{
|
|
|
|
|
this.notifyIcon1.BalloonTipText = args.Data;
|
|
|
|
|
notifyIcon1.BalloonTipTitle = "DS4Windows";
|
|
|
|
|
notifyIcon1.ShowBalloonTip(1);
|
|
|
|
|
}
|
2014-05-19 07:55:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-30 22:39:39 +02:00
|
|
|
|
protected void ShowNotification(object sender, string text)
|
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
if (Form.ActiveForm != this && cBNotifications.Checked)
|
2014-05-30 22:39:39 +02:00
|
|
|
|
{
|
|
|
|
|
this.notifyIcon1.BalloonTipText = text;
|
|
|
|
|
notifyIcon1.BalloonTipTitle = "DS4Windows";
|
|
|
|
|
notifyIcon1.ShowBalloonTip(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-19 07:55:12 +02:00
|
|
|
|
protected void Form_Resize(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (FormWindowState.Minimized == this.WindowState)
|
|
|
|
|
{
|
|
|
|
|
this.Hide();
|
|
|
|
|
this.ShowInTaskbar = false;
|
2014-10-21 20:31:36 +02:00
|
|
|
|
this.FormBorderStyle = FormBorderStyle.None;
|
2014-05-19 07:55:12 +02:00
|
|
|
|
}
|
2014-05-21 07:36:05 +02:00
|
|
|
|
|
2014-05-19 07:55:12 +02:00
|
|
|
|
else if (FormWindowState.Normal == this.WindowState)
|
|
|
|
|
{
|
2014-11-20 20:03:18 +01:00
|
|
|
|
//mAllowVisible = true;
|
2014-05-19 07:55:12 +02:00
|
|
|
|
this.Show();
|
|
|
|
|
this.ShowInTaskbar = true;
|
2014-10-21 20:31:36 +02:00
|
|
|
|
this.FormBorderStyle = FormBorderStyle.Sizable;
|
2014-05-19 07:55:12 +02:00
|
|
|
|
}
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
chData.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnStartStop_Click(object sender, EventArgs e)
|
2014-03-29 06:29:08 +01:00
|
|
|
|
{
|
|
|
|
|
btnStartStop_Clicked();
|
|
|
|
|
}
|
2014-08-23 22:52:20 +02:00
|
|
|
|
public void btnStartStop_Clicked(bool log = true)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-06-21 20:00:28 +02:00
|
|
|
|
if (btnStartStop.Text == Properties.Resources.StartText)
|
2014-05-24 01:44:30 +02:00
|
|
|
|
{
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Program.rootHub.Start(log);
|
2014-11-18 22:23:41 +01:00
|
|
|
|
hotkeysTimer.Start();
|
2014-06-21 20:00:28 +02:00
|
|
|
|
btnStartStop.Text = Properties.Resources.StopText;
|
2014-05-24 01:44:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
else if (btnStartStop.Text == Properties.Resources.StopText)
|
2014-06-02 05:19:04 +02:00
|
|
|
|
{
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Program.rootHub.Stop(log);
|
2014-11-18 22:23:41 +01:00
|
|
|
|
hotkeysTimer.Stop();
|
2014-06-21 20:00:28 +02:00
|
|
|
|
btnStartStop.Text = Properties.Resources.StartText;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-09-02 01:23:02 +02:00
|
|
|
|
startToolStripMenuItem.Text = btnStartStop.Text;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
protected void btnClear_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
lvDebug.Items.Clear();
|
|
|
|
|
//Added alternative
|
|
|
|
|
lbLastMessage.Text = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
protected override void WndProc(ref Message m)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (m.Msg == ScpDevice.WM_DEVICECHANGE)
|
|
|
|
|
{
|
|
|
|
|
Int32 Type = m.WParam.ToInt32();
|
|
|
|
|
lock (this)
|
|
|
|
|
{
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Program.rootHub.HotPlug();
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
2014-06-02 19:29:38 +02:00
|
|
|
|
if (m.Msg == WM_QUERYENDSESSION)
|
|
|
|
|
systemShutdown = true;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-06-02 19:29:38 +02:00
|
|
|
|
// If this is WM_QUERYENDSESSION, the closing event should be
|
|
|
|
|
// raised in the base WndProc.
|
2014-03-28 02:50:40 +01:00
|
|
|
|
base.WndProc(ref m);
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
2014-03-29 06:29:08 +01:00
|
|
|
|
protected void ControllerStatusChange(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (InvokeRequired)
|
|
|
|
|
Invoke(new ControllerStatusChangedDelegate(ControllerStatusChange), new object[] { sender, e });
|
|
|
|
|
else
|
|
|
|
|
ControllerStatusChanged();
|
|
|
|
|
}
|
2014-09-15 04:37:14 +02:00
|
|
|
|
protected void ControllerStatusChanged()
|
2014-03-29 06:29:08 +01:00
|
|
|
|
{
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
String tooltip = "DS4Windows v" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
for (Int32 Index = 0; Index < Pads.Length; Index++)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Pads[Index].Text = Program.rootHub.getDS4MacAddress(Index);
|
|
|
|
|
DS4Device d = Program.rootHub.DS4Controllers[Index];
|
2014-11-20 20:03:18 +01:00
|
|
|
|
if (d != null && Global.getQuickCharge() && d.ConnectionType == ConnectionType.BT && d.Charging)
|
|
|
|
|
{
|
|
|
|
|
d.DisconnectBT();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-12-13 21:12:03 +01:00
|
|
|
|
switch (Program.rootHub.getDS4Status(Index))
|
2014-05-30 22:39:39 +02:00
|
|
|
|
{
|
2014-09-02 01:23:02 +02:00
|
|
|
|
case "USB": statPB[Index].Image = Properties.Resources.USB; tt.SetToolTip(statPB[Index], ""); break;
|
|
|
|
|
case "BT": statPB[Index].Image = Properties.Resources.BT; tt.SetToolTip(statPB[Index], "Right click to disconnect"); break;
|
|
|
|
|
default: statPB[Index].Image = Properties.Resources.none; tt.SetToolTip(statPB[Index], ""); break;
|
2014-05-30 22:39:39 +02:00
|
|
|
|
}
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Batteries[Index].Text = Program.rootHub.getDS4Battery(Index);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
if (Pads[Index].Text != String.Empty)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Pads[Index].Enabled = true;
|
2014-08-17 00:09:15 +02:00
|
|
|
|
if (Pads[Index].Text != Properties.Resources.Connecting)
|
2014-05-28 04:49:58 +02:00
|
|
|
|
{
|
2014-05-31 06:37:02 +02:00
|
|
|
|
Enable_Controls(Index, true);
|
2014-07-09 19:18:11 +02:00
|
|
|
|
if (opt != null)
|
|
|
|
|
opt.inputtimer.Start();
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
//MinimumSize = new Size(MinimumSize.Width, 137 + 29 * Index);
|
2014-05-28 04:49:58 +02:00
|
|
|
|
}
|
2014-07-09 19:18:11 +02:00
|
|
|
|
else if (opt != null)
|
|
|
|
|
opt.inputtimer.Stop();
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-06-21 20:00:28 +02:00
|
|
|
|
Pads[Index].Text = Properties.Resources.Disconnected;
|
2014-05-31 06:37:02 +02:00
|
|
|
|
Enable_Controls(Index, false);
|
2014-04-29 03:14:01 +02:00
|
|
|
|
shortcuts[Index].Enabled = false;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-12-13 21:12:03 +01:00
|
|
|
|
//if (((Index + 1) + ": " + Program.rootHub.getShortDS4ControllerInfo(Index)).Length > 50)
|
|
|
|
|
//MessageBox.Show(((Index + 1) + ": " + Program.rootHub.getShortDS4ControllerInfo(Index)).Length.ToString());
|
|
|
|
|
if (Program.rootHub.getShortDS4ControllerInfo(Index) != Properties.Resources.NoneText)
|
|
|
|
|
tooltip += "\n" + (Index + 1) + ": " + Program.rootHub.getShortDS4ControllerInfo(Index); // Carefully stay under the 63 character limit.
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
btnClear.Enabled = lvDebug.Items.Count > 0;
|
2014-08-18 07:18:46 +02:00
|
|
|
|
if (tooltip.Length > 63)
|
|
|
|
|
notifyIcon1.Text = tooltip.Substring(0,63);
|
|
|
|
|
else
|
|
|
|
|
notifyIcon1.Text = tooltip;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-09-02 01:23:02 +02:00
|
|
|
|
|
|
|
|
|
private void pBStatus_MouseClick(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int i = Int32.Parse(((PictureBox)sender).Tag.ToString());
|
2014-12-13 21:12:03 +01:00
|
|
|
|
if (e.Button == System.Windows.Forms.MouseButtons.Right && Program.rootHub.getDS4Status(i) == "BT" && !Program.rootHub.DS4Controllers[i].Charging)
|
|
|
|
|
Program.rootHub.DS4Controllers[i].DisconnectBT();
|
2014-09-02 01:23:02 +02:00
|
|
|
|
}
|
2014-05-31 06:37:02 +02:00
|
|
|
|
|
|
|
|
|
private void Enable_Controls(int device, bool on)
|
|
|
|
|
{
|
2014-05-31 19:27:43 +02:00
|
|
|
|
Pads[device].Enabled = on;
|
2014-05-31 06:37:02 +02:00
|
|
|
|
ebns[device].Enabled = on;
|
|
|
|
|
cbs[device].Enabled = on;
|
|
|
|
|
shortcuts[device].Enabled = on;
|
|
|
|
|
Batteries[device].Enabled = on;
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
2014-05-30 22:39:39 +02:00
|
|
|
|
void ScpForm_Report(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (InvokeRequired)
|
|
|
|
|
Invoke(new HotKeysDelegate(Hotkeys), new object[] { sender, e });
|
|
|
|
|
else
|
|
|
|
|
Hotkeys(sender, e);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
protected void On_Debug(object sender, DS4Control.DebugEventArgs e)
|
|
|
|
|
{
|
2014-12-17 19:29:22 +01:00
|
|
|
|
//logWriter.WriteLine(e.Time + ":\t" + e.Data);
|
|
|
|
|
//logWriter.Flush();
|
2014-03-28 02:50:40 +01:00
|
|
|
|
LogDebug(e.Time, e.Data);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-30 22:39:39 +02:00
|
|
|
|
|
|
|
|
|
private void lBProfiles_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lBProfiles.SelectedIndex >= 0)
|
|
|
|
|
ShowOptions(4, lBProfiles.SelectedItem.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-05-31 06:37:02 +02:00
|
|
|
|
private void lBProfiles_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lBProfiles.SelectedIndex >= 0 && opt == null)
|
|
|
|
|
{
|
|
|
|
|
if (e.KeyValue == 13)
|
|
|
|
|
ShowOptions(4, lBProfiles.SelectedItem.ToString());
|
|
|
|
|
if (e.KeyValue == 46)
|
|
|
|
|
tsBDeleteProfle_Click(this, e);
|
|
|
|
|
if (e.KeyValue == 67 && e.Modifiers == Keys.Control)
|
|
|
|
|
tSBDupProfile_Click(this, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-31 19:27:43 +02:00
|
|
|
|
private void assignToController1ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
cbs[0].SelectedIndex = lBProfiles.SelectedIndex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void assignToController2ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
cbs[1].SelectedIndex = lBProfiles.SelectedIndex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void assignToController3ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
cbs[2].SelectedIndex = lBProfiles.SelectedIndex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void assignToController4ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
cbs[3].SelectedIndex = lBProfiles.SelectedIndex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tsBNewProfile_Click(object sender, EventArgs e) //Also used for context menu
|
2014-05-30 22:39:39 +02:00
|
|
|
|
{
|
|
|
|
|
ShowOptions(4, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void tsBNEditProfile_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lBProfiles.SelectedIndex >= 0)
|
|
|
|
|
ShowOptions(4, lBProfiles.SelectedItem.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tsBDeleteProfle_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lBProfiles.SelectedIndex >= 0)
|
|
|
|
|
{
|
|
|
|
|
string filename = lBProfiles.SelectedItem.ToString();
|
2014-08-17 00:09:15 +02:00
|
|
|
|
if (MessageBox.Show(Properties.Resources.ProfileCannotRestore.Replace("*Profile name*", "\"" + filename + "\""), Properties.Resources.DeleteProfile, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
2014-05-30 22:39:39 +02:00
|
|
|
|
{
|
2014-06-13 21:52:25 +02:00
|
|
|
|
System.IO.File.Delete(Global.appdatapath + @"\Profiles\" + filename + ".xml");
|
2014-05-30 22:39:39 +02:00
|
|
|
|
RefreshProfiles();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tSBDupProfile_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string filename = "";
|
|
|
|
|
if (lBProfiles.SelectedIndex >= 0)
|
|
|
|
|
{
|
|
|
|
|
filename = lBProfiles.SelectedItem.ToString();
|
2014-12-20 02:31:00 +01:00
|
|
|
|
DuplicateForm MTB = new DuplicateForm(filename, this);
|
2014-05-30 22:39:39 +02:00
|
|
|
|
MTB.TopLevel = false;
|
|
|
|
|
MTB.Dock = DockStyle.Top;
|
|
|
|
|
MTB.Visible = true;
|
|
|
|
|
MTB.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
|
|
|
|
tabProfiles.Controls.Add(MTB);
|
|
|
|
|
lBProfiles.SendToBack();
|
|
|
|
|
toolStrip1.SendToBack();
|
|
|
|
|
toolStrip1.Enabled = false;
|
|
|
|
|
lBProfiles.Enabled = false;
|
|
|
|
|
MTB.FormClosed += delegate { toolStrip1.Enabled = true; lBProfiles.Enabled = true; };
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-05-31 06:37:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void tSBImportProfile_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
if (Global.appdatapath == Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName)
|
|
|
|
|
openProfiles.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool" + @"\Profiles\";
|
|
|
|
|
else
|
|
|
|
|
openProfiles.InitialDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\";
|
2014-05-31 06:37:02 +02:00
|
|
|
|
if (openProfiles.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
string[] files = openProfiles.FileNames;
|
|
|
|
|
for (int i = 0; i < files.Length; i++)
|
|
|
|
|
File.Copy(openProfiles.FileNames[i], Global.appdatapath + "\\Profiles\\" + Path.GetFileName(files[i]), true);
|
|
|
|
|
RefreshProfiles();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tSBExportProfile_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lBProfiles.SelectedIndex >= 0)
|
|
|
|
|
{
|
|
|
|
|
Stream stream;
|
|
|
|
|
Stream profile = new StreamReader(Global.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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-06-21 20:00:28 +02:00
|
|
|
|
|
2014-05-12 07:48:50 +02:00
|
|
|
|
private void ShowOptions(int devID, string profile)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-06-21 20:00:28 +02:00
|
|
|
|
if (opt != null)
|
|
|
|
|
opt.Close();
|
|
|
|
|
Show();
|
|
|
|
|
WindowState = FormWindowState.Normal;
|
|
|
|
|
toolStrip1.Enabled = false;
|
|
|
|
|
tSOptions.Visible = true;
|
|
|
|
|
toolStrip1.Visible = false;
|
|
|
|
|
if (profile != "")
|
|
|
|
|
tSTBProfile.Text = profile;
|
|
|
|
|
else
|
2014-08-17 00:09:15 +02:00
|
|
|
|
tSTBProfile.Text = "<" + Properties.Resources.TypeProfileName + ">";
|
2014-12-13 21:12:03 +01:00
|
|
|
|
opt = new Options(devID, profile, this);
|
2014-06-21 20:00:28 +02:00
|
|
|
|
opt.Text = "Options for Controller " + (devID + 1);
|
|
|
|
|
opt.Icon = this.Icon;
|
|
|
|
|
opt.TopLevel = false;
|
|
|
|
|
opt.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
|
|
|
|
opt.Visible = true;
|
|
|
|
|
opt.Dock = DockStyle.Fill;
|
|
|
|
|
tabProfiles.Controls.Add(opt);
|
|
|
|
|
lBProfiles.SendToBack();
|
|
|
|
|
toolStrip1.SendToBack();
|
|
|
|
|
tSOptions.SendToBack();
|
|
|
|
|
opt.FormClosed += delegate
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-06-21 20:00:28 +02:00
|
|
|
|
opt = null;
|
|
|
|
|
RefreshProfiles();
|
|
|
|
|
this.Size = oldsize;
|
|
|
|
|
oldsize = new System.Drawing.Size(0, 0);
|
2014-08-17 00:09:15 +02:00
|
|
|
|
tSBKeepSize.Text = Properties.Resources.KeepThisSize;
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
tSBKeepSize.Image = Properties.Resources.size;
|
|
|
|
|
tSBKeepSize.Enabled = true;
|
2014-06-21 20:00:28 +02:00
|
|
|
|
tSOptions.Visible = false;
|
|
|
|
|
toolStrip1.Visible = true;
|
|
|
|
|
toolStrip1.Enabled = true;
|
2014-09-15 04:37:14 +02:00
|
|
|
|
lbLastMessage.ForeColor = SystemColors.GrayText;
|
|
|
|
|
lbLastMessage.Text = lvDebug.Items[lvDebug.Items.Count - 1].SubItems[1].Text;
|
2014-06-21 20:00:28 +02:00
|
|
|
|
};
|
|
|
|
|
oldsize = this.Size;
|
2014-11-14 20:44:50 +01:00
|
|
|
|
/*if (dpix == 120)
|
2014-06-21 20:00:28 +02:00
|
|
|
|
{
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
if (this.Size.Height < 90 + opt.MaximumSize.Height * 1.25)
|
|
|
|
|
this.Size = new System.Drawing.Size(this.Size.Width, (int)(90 + opt.MaximumSize.Height * 1.25));
|
|
|
|
|
if (this.Size.Width < 20 + opt.MaximumSize.Width * 1.25)
|
|
|
|
|
this.Size = new System.Drawing.Size((int)(20 + opt.Size.Width * 1.25), this.Size.Height);
|
2014-05-05 09:31:24 +02:00
|
|
|
|
}
|
2014-11-14 20:44:50 +01:00
|
|
|
|
else*/
|
2014-06-21 20:00:28 +02:00
|
|
|
|
{
|
2014-11-14 20:44:50 +01:00
|
|
|
|
if (this.Size.Height < (int)(90 * dpiy) + opt.MaximumSize.Height)
|
|
|
|
|
this.Size = new System.Drawing.Size(this.Size.Width, (int)(90 * dpiy) + opt.MaximumSize.Height);
|
|
|
|
|
if (this.Size.Width < (int)(20 * dpix) + opt.MaximumSize.Width)
|
|
|
|
|
this.Size = new System.Drawing.Size((int)(20 * dpix) + opt.MaximumSize.Width, this.Size.Height);
|
2014-06-21 20:00:28 +02:00
|
|
|
|
}
|
|
|
|
|
tabMain.SelectedIndex = 1;
|
2014-04-29 03:14:01 +02:00
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
2014-05-12 07:48:50 +02:00
|
|
|
|
private void editButtons_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Button bn = (Button)sender;
|
|
|
|
|
int i = Int32.Parse(bn.Tag.ToString());
|
2014-08-17 00:09:15 +02:00
|
|
|
|
if (cbs[i].Text == "(" + Properties.Resources.NoProfileLoaded + ")")
|
2014-05-12 07:48:50 +02:00
|
|
|
|
ShowOptions(i, "");
|
|
|
|
|
else
|
|
|
|
|
ShowOptions(i, cbs[i].Text);
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
2014-04-29 03:14:01 +02:00
|
|
|
|
private void editMenu_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-12-13 21:12:03 +01:00
|
|
|
|
mAllowVisible = true;
|
|
|
|
|
this.Show();
|
|
|
|
|
WindowState = FormWindowState.Normal;
|
2014-04-29 03:14:01 +02:00
|
|
|
|
ToolStripMenuItem em = (ToolStripMenuItem)sender;
|
|
|
|
|
int i = Int32.Parse(em.Tag.ToString());
|
2014-09-15 04:37:14 +02:00
|
|
|
|
if (em.Text == Properties.Resources.ContextNew.Replace("*number*", (i + 1).ToString()))
|
2014-05-12 07:48:50 +02:00
|
|
|
|
ShowOptions(i, "");
|
2014-05-06 20:49:18 +02:00
|
|
|
|
else
|
2014-05-12 07:48:50 +02:00
|
|
|
|
for (int t=0; t < em.DropDownItems.Count-2; t++)
|
|
|
|
|
if (((ToolStripMenuItem)em.DropDownItems[t]).Checked)
|
|
|
|
|
ShowOptions(i, ((ToolStripMenuItem)em.DropDownItems[t]).Text);
|
2014-04-29 03:14:01 +02:00
|
|
|
|
}
|
2014-05-30 22:39:39 +02:00
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
private void lnkControllers_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
System.Diagnostics.Process.Start("control", "joy.cpl");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void hideDS4CheckBox_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Prevent the Game Controllers window from throwing an error when controllers are un/hidden
|
|
|
|
|
System.Diagnostics.Process[] rundll32 = System.Diagnostics.Process.GetProcessesByName("rundll32");
|
|
|
|
|
foreach (System.Diagnostics.Process rundll32Instance in rundll32)
|
|
|
|
|
foreach (System.Diagnostics.ProcessModule module in rundll32Instance.Modules)
|
|
|
|
|
if (module.FileName.Contains("joy.cpl"))
|
|
|
|
|
module.Dispose();
|
|
|
|
|
|
|
|
|
|
Global.setUseExclusiveMode(hideDS4CheckBox.Checked);
|
2014-07-26 01:17:45 +02:00
|
|
|
|
btnStartStop_Clicked(false);
|
|
|
|
|
btnStartStop_Clicked(false);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
Global.Save();
|
2014-09-02 01:23:02 +02:00
|
|
|
|
//if (MessageBox.Show("Restart DS4Windows?", "") == System.Windows.Forms.DialogResult.OK);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
private void startMinimizedCheckBox_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setStartMinimized(startMinimizedCheckBox.Checked);
|
|
|
|
|
Global.Save();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void lvDebug_ItemActivate(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-04-30 02:58:18 +02:00
|
|
|
|
MessageBox.Show(((ListView)sender).FocusedItem.SubItems[1].Text, "Log");
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
2014-06-02 05:19:04 +02:00
|
|
|
|
private void Profile_Changed(object sender, EventArgs e) //cbs[i] changed
|
2014-04-27 21:32:09 +02:00
|
|
|
|
{
|
2014-04-29 03:14:01 +02:00
|
|
|
|
ComboBox cb = (ComboBox)sender;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
int tdevice = Int32.Parse(cb.Tag.ToString());
|
|
|
|
|
if (cb.Items[cb.Items.Count - 1].ToString() == "+New Profile")
|
|
|
|
|
{
|
|
|
|
|
if (cb.SelectedIndex < cb.Items.Count - 1)
|
|
|
|
|
{
|
2014-04-29 03:14:01 +02:00
|
|
|
|
for (int i = 0; i < shortcuts[tdevice].DropDownItems.Count; i++)
|
2014-04-29 10:01:13 +02:00
|
|
|
|
if (!(shortcuts[tdevice].DropDownItems[i] is ToolStripSeparator))
|
2014-04-30 02:58:18 +02:00
|
|
|
|
((ToolStripMenuItem)shortcuts[tdevice].DropDownItems[i]).Checked = false;
|
2014-04-29 03:14:01 +02:00
|
|
|
|
((ToolStripMenuItem)shortcuts[tdevice].DropDownItems[cb.SelectedIndex]).Checked = true;
|
2014-08-17 00:09:15 +02:00
|
|
|
|
LogDebug(DateTime.Now, Properties.Resources.UsingProfile.Replace("*number*", (tdevice + 1).ToString()).Replace("*Profile name*", cb.Text));
|
|
|
|
|
shortcuts[tdevice].Text = Properties.Resources.ContextEdit.Replace("*number*", (tdevice + 1).ToString());
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Global.setAProfile(tdevice, cb.Items[cb.SelectedIndex].ToString());
|
|
|
|
|
Global.Save();
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Global.LoadProfile(tdevice, true, Program.rootHub);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
|
|
|
|
else if (cb.SelectedIndex == cb.Items.Count - 1 && cb.Items.Count > 1) //if +New Profile selected
|
2014-05-12 07:48:50 +02:00
|
|
|
|
ShowOptions(tdevice, "");
|
2014-08-17 00:09:15 +02:00
|
|
|
|
if (cb.Text == "(" + Properties.Resources.NoProfileLoaded + ")")
|
|
|
|
|
ebns[tdevice].Text = Properties.Resources.New;
|
2014-04-29 03:14:01 +02:00
|
|
|
|
else
|
2014-08-17 00:09:15 +02:00
|
|
|
|
ebns[tdevice].Text = Properties.Resources.EditProfile;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
2014-09-15 04:37:14 +02:00
|
|
|
|
ControllerStatusChanged(); //to update profile name in notify icon
|
2014-04-29 03:14:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Profile_Changed_Menu(object sender, ToolStripItemClickedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ToolStripMenuItem tS = (ToolStripMenuItem)sender;
|
|
|
|
|
int tdevice = Int32.Parse(tS.Tag.ToString());
|
2014-04-29 10:01:13 +02:00
|
|
|
|
if (!(e.ClickedItem is ToolStripSeparator))
|
2014-05-12 07:48:50 +02:00
|
|
|
|
if (e.ClickedItem != tS.DropDownItems[tS.DropDownItems.Count - 1]) //if +New Profile not selected
|
2014-06-02 05:19:04 +02:00
|
|
|
|
cbs[tdevice].SelectedIndex = tS.DropDownItems.IndexOf(e.ClickedItem);
|
2014-05-12 07:48:50 +02:00
|
|
|
|
else //if +New Profile selected
|
|
|
|
|
ShowOptions(tdevice, "");
|
2014-04-29 03:14:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-12-13 21:12:03 +01:00
|
|
|
|
contextclose = true;
|
2014-04-29 03:14:01 +02:00
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void openToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-11-20 20:03:18 +01:00
|
|
|
|
mAllowVisible = true;
|
2014-04-29 03:14:01 +02:00
|
|
|
|
this.Show();
|
|
|
|
|
WindowState = FormWindowState.Normal;
|
2014-09-02 01:23:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void startToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
btnStartStop_Clicked();
|
|
|
|
|
}
|
2014-05-30 22:39:39 +02:00
|
|
|
|
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
|
2014-05-16 00:10:17 +02:00
|
|
|
|
{
|
2014-05-30 22:39:39 +02:00
|
|
|
|
if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
2014-05-16 00:10:17 +02:00
|
|
|
|
{
|
2014-11-20 20:03:18 +01:00
|
|
|
|
mAllowVisible = true;
|
2014-05-30 22:39:39 +02:00
|
|
|
|
this.Show();
|
|
|
|
|
WindowState = FormWindowState.Normal;
|
2014-05-16 00:10:17 +02:00
|
|
|
|
}
|
2014-05-30 22:39:39 +02:00
|
|
|
|
else if (e.Button == System.Windows.Forms.MouseButtons.Middle)
|
2014-12-13 21:12:03 +01:00
|
|
|
|
{
|
|
|
|
|
contextclose = true;
|
2014-05-30 22:39:39 +02:00
|
|
|
|
this.Close();
|
2014-12-13 21:12:03 +01:00
|
|
|
|
}
|
2014-05-30 22:39:39 +02:00
|
|
|
|
}
|
|
|
|
|
private void notifyIcon1_BalloonTipClicked(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Show();
|
|
|
|
|
WindowState = FormWindowState.Normal;
|
2014-05-16 00:10:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void llbHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
{
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
Hotkeys hotkeysForm = new Hotkeys();
|
2014-05-16 00:10:17 +02:00
|
|
|
|
hotkeysForm.Icon = this.Icon;
|
|
|
|
|
hotkeysForm.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-21 19:39:56 +02:00
|
|
|
|
private void StartWindowsCheckBox_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RegistryKey KeyLoc = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
|
2014-06-14 21:14:27 +02:00
|
|
|
|
if (StartWindowsCheckBox.Checked && !File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk"))
|
2014-06-13 21:52:25 +02:00
|
|
|
|
appShortcutToStartup();
|
2014-06-14 21:14:27 +02:00
|
|
|
|
else if (!StartWindowsCheckBox.Checked)
|
2014-06-13 21:52:25 +02:00
|
|
|
|
File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
|
|
|
|
|
KeyLoc.DeleteValue("DS4Tool", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void appShortcutToStartup()
|
|
|
|
|
{
|
|
|
|
|
Type t = Type.GetTypeFromCLSID(new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8")); //Windows Script Host Shell Object
|
|
|
|
|
dynamic shell = Activator.CreateInstance(t);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var lnk = shell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string app = Assembly.GetExecutingAssembly().Location;
|
|
|
|
|
lnk.TargetPath = Assembly.GetExecutingAssembly().Location;
|
2014-12-13 21:12:03 +01:00
|
|
|
|
lnk.Arguments = "-m";
|
2014-06-13 21:52:25 +02:00
|
|
|
|
lnk.IconLocation = app.Replace('\\', '/');
|
|
|
|
|
lnk.Save();
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
Marshal.FinalReleaseComObject(lnk);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
Marshal.FinalReleaseComObject(shell);
|
|
|
|
|
}
|
2014-05-21 19:39:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-31 06:37:02 +02:00
|
|
|
|
private void tabMain_SelectedIndexChanged(object sender, EventArgs e)
|
2014-05-30 22:39:39 +02:00
|
|
|
|
{
|
2014-12-03 23:36:54 +01:00
|
|
|
|
lbLastMessage.Visible = tabMain.SelectedTab != tabLog;
|
|
|
|
|
if (tabMain.SelectedTab == tabLog)
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
chData.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
|
2014-12-03 23:36:54 +01:00
|
|
|
|
if (tabMain.SelectedTab == tabSettings)
|
|
|
|
|
{
|
|
|
|
|
lbLastMessage.Text = "Hover over items to see description or more about";
|
|
|
|
|
foreach (System.Windows.Forms.Control control in fLPSettings.Controls)
|
|
|
|
|
{
|
|
|
|
|
if (control.HasChildren)
|
|
|
|
|
foreach (System.Windows.Forms.Control ctrl in control.Controls)
|
|
|
|
|
ctrl.MouseHover += Items_MouseHover;
|
|
|
|
|
control.MouseHover += Items_MouseHover;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
lbLastMessage.Text = lbLastMessage.Text = lvDebug.Items[lvDebug.Items.Count - 1].SubItems[1].Text;
|
2014-06-21 20:00:28 +02:00
|
|
|
|
if (opt != null)
|
|
|
|
|
if (tabMain.SelectedIndex != 1)
|
|
|
|
|
opt.inputtimer.Stop();
|
|
|
|
|
else
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
opt.inputtimer.Start();
|
2014-05-30 22:39:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:36:54 +01:00
|
|
|
|
private void Items_MouseHover(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
switch (((System.Windows.Forms.Control)sender).Name)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//if (File.Exists(appdatapath + "\\Auto Profiles.xml"))
|
|
|
|
|
case "linkUninstall": lbLastMessage.Text = Properties.Resources.IfRemovingDS4Windows; break;
|
|
|
|
|
case "cBSwipeProfiles": lbLastMessage.Text = Properties.Resources.TwoFingerSwipe; break;
|
|
|
|
|
case "cBQuickCharge": lbLastMessage.Text = Properties.Resources.QuickCharge; break;
|
|
|
|
|
case "pnlXIPorts": lbLastMessage.Text = Properties.Resources.XinputPorts; break;
|
2014-12-13 21:12:03 +01:00
|
|
|
|
case "lbUseXIPorts": lbLastMessage.Text = Properties.Resources.XinputPorts; break;
|
|
|
|
|
case "nUDXIPorts": lbLastMessage.Text = Properties.Resources.XinputPorts; break;
|
|
|
|
|
case "lbLastXIPort": lbLastMessage.Text = Properties.Resources.XinputPorts; break;
|
|
|
|
|
case "cBCloseMini": lbLastMessage.Text = Properties.Resources.CloseMinimize; break;
|
2014-12-03 23:36:54 +01:00
|
|
|
|
default: lbLastMessage.Text = "Hover over items to see description or more about"; break;
|
|
|
|
|
}
|
|
|
|
|
if (lbLastMessage.Text != "Hover over items to see description or more about")
|
|
|
|
|
lbLastMessage.ForeColor = Color.Black;
|
|
|
|
|
else
|
|
|
|
|
lbLastMessage.ForeColor = SystemColors.GrayText;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-31 19:27:43 +02:00
|
|
|
|
private void lBProfiles_MouseDown(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
lBProfiles.SelectedIndex = lBProfiles.IndexFromPoint(e.X, e.Y);
|
|
|
|
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
|
|
|
|
{
|
|
|
|
|
if (lBProfiles.SelectedIndex < 0)
|
|
|
|
|
{
|
2014-06-02 05:19:04 +02:00
|
|
|
|
cMProfile.ShowImageMargin = false;
|
2014-05-31 19:27:43 +02:00
|
|
|
|
assignToController1ToolStripMenuItem.Visible = false;
|
|
|
|
|
assignToController2ToolStripMenuItem.Visible = false;
|
|
|
|
|
assignToController3ToolStripMenuItem.Visible = false;
|
|
|
|
|
assignToController4ToolStripMenuItem.Visible = false;
|
|
|
|
|
deleteToolStripMenuItem.Visible = false;
|
|
|
|
|
editToolStripMenuItem.Visible = false;
|
|
|
|
|
duplicateToolStripMenuItem.Visible = false;
|
|
|
|
|
exportToolStripMenuItem.Visible = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-06-02 05:19:04 +02:00
|
|
|
|
cMProfile.ShowImageMargin = true;
|
2014-05-31 19:27:43 +02:00
|
|
|
|
assignToController1ToolStripMenuItem.Visible = true;
|
|
|
|
|
assignToController2ToolStripMenuItem.Visible = true;
|
|
|
|
|
assignToController3ToolStripMenuItem.Visible = true;
|
|
|
|
|
assignToController4ToolStripMenuItem.Visible = true;
|
2014-06-02 05:19:04 +02:00
|
|
|
|
ToolStripMenuItem[] assigns = { assignToController1ToolStripMenuItem,
|
|
|
|
|
assignToController2ToolStripMenuItem,
|
|
|
|
|
assignToController3ToolStripMenuItem,
|
|
|
|
|
assignToController4ToolStripMenuItem };
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
if (lBProfiles.SelectedIndex == cbs[i].SelectedIndex)
|
|
|
|
|
assigns[i].Checked = true;
|
|
|
|
|
else
|
|
|
|
|
assigns[i].Checked = false;
|
|
|
|
|
}
|
2014-05-31 19:27:43 +02:00
|
|
|
|
deleteToolStripMenuItem.Visible = true;
|
|
|
|
|
editToolStripMenuItem.Visible = true;
|
|
|
|
|
duplicateToolStripMenuItem.Visible = true;
|
|
|
|
|
exportToolStripMenuItem.Visible = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-06-02 05:19:04 +02:00
|
|
|
|
|
|
|
|
|
private void ScpForm_DragDrop(object sender, DragEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
bool therewasanxml = false;
|
|
|
|
|
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);
|
|
|
|
|
for (int i = 0; i < files.Length; i++)
|
|
|
|
|
if (files[i].EndsWith(".xml"))
|
|
|
|
|
{
|
|
|
|
|
File.Copy(files[i], Global.appdatapath + "\\Profiles\\" + Path.GetFileName(files[i]), true);
|
|
|
|
|
therewasanxml = true;
|
|
|
|
|
}
|
|
|
|
|
if (therewasanxml)
|
|
|
|
|
RefreshProfiles();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ScpForm_DragEnter(object sender, DragEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
|
|
|
|
e.Effect = DragDropEffects.Copy; // Okay
|
|
|
|
|
else
|
|
|
|
|
e.Effect = DragDropEffects.None; // Unknown data, ignore it
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-12 20:46:00 +02:00
|
|
|
|
|
2014-06-02 19:29:38 +02:00
|
|
|
|
|
|
|
|
|
private void tBProfile_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (tSTBProfile.Text != null && tSTBProfile.Text != "" && !tSTBProfile.Text.Contains("\\") && !tSTBProfile.Text.Contains("/") && !tSTBProfile.Text.Contains(":") && !tSTBProfile.Text.Contains("*") && !tSTBProfile.Text.Contains("?") && !tSTBProfile.Text.Contains("\"") && !tSTBProfile.Text.Contains("<") && !tSTBProfile.Text.Contains(">") && !tSTBProfile.Text.Contains("|"))
|
|
|
|
|
tSTBProfile.ForeColor = System.Drawing.SystemColors.WindowText;
|
|
|
|
|
else
|
|
|
|
|
tSTBProfile.ForeColor = System.Drawing.SystemColors.GrayText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tBProfile_Enter(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-08-17 00:09:15 +02:00
|
|
|
|
if (tSTBProfile.Text == "<" + Properties.Resources.TypeProfileName + ">")
|
2014-06-02 19:29:38 +02:00
|
|
|
|
tSTBProfile.Text = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tBProfile_Leave(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (tSTBProfile.Text == "")
|
2014-08-17 00:09:15 +02:00
|
|
|
|
tSTBProfile.Text = "<" + Properties.Resources.TypeProfileName + ">";
|
2014-06-02 19:29:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tSBCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (opt != null)
|
|
|
|
|
opt.Close();
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 21:52:25 +02:00
|
|
|
|
private void tSBSaveProfile_Click(object sender, EventArgs e)
|
2014-06-02 19:29:38 +02:00
|
|
|
|
{
|
|
|
|
|
if (opt != null)
|
|
|
|
|
{
|
2014-12-13 21:12:03 +01:00
|
|
|
|
opt.saving = true;
|
2014-06-02 19:29:38 +02:00
|
|
|
|
opt.Set();
|
|
|
|
|
|
|
|
|
|
if (tSTBProfile.Text != null && tSTBProfile.Text != "" && !tSTBProfile.Text.Contains("\\") && !tSTBProfile.Text.Contains("/") && !tSTBProfile.Text.Contains(":") && !tSTBProfile.Text.Contains("*") && !tSTBProfile.Text.Contains("?") && !tSTBProfile.Text.Contains("\"") && !tSTBProfile.Text.Contains("<") && !tSTBProfile.Text.Contains(">") && !tSTBProfile.Text.Contains("|"))
|
|
|
|
|
{
|
|
|
|
|
System.IO.File.Delete(Global.appdatapath + @"\Profiles\" + opt.filename + ".xml");
|
|
|
|
|
Global.setAProfile(opt.device, tSTBProfile.Text);
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
Global.SaveProfile(opt.device, tSTBProfile.Text, opt.buttons.ToArray(), opt.subbuttons.ToArray());
|
2014-06-02 19:29:38 +02:00
|
|
|
|
Global.Save();
|
|
|
|
|
opt.Close();
|
|
|
|
|
}
|
|
|
|
|
else
|
2014-08-17 00:09:15 +02:00
|
|
|
|
MessageBox.Show(Properties.Resources.ValidName, Properties.Resources.NotValid, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
2014-06-02 19:29:38 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
private void tSBKeepSize_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
oldsize = Size;
|
2014-08-17 00:09:15 +02:00
|
|
|
|
tSBKeepSize.Text = Properties.Resources.WillKeep;
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
tSBKeepSize.Image = Properties.Resources._checked;
|
|
|
|
|
tSBKeepSize.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
private void cBUpdate_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!cBUpdate.Checked)
|
|
|
|
|
{
|
|
|
|
|
nUDUpdateTime.Value = 0;
|
|
|
|
|
pNUpdate.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nUDUpdateTime.Value = 1;
|
|
|
|
|
cBUpdateTime.SelectedIndex = 0;
|
|
|
|
|
pNUpdate.Enabled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void nUDUpdateTime_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cBUpdateTime.SelectedIndex == 0)
|
|
|
|
|
Global.setCheckWhen((int)nUDUpdateTime.Value);
|
|
|
|
|
else if (cBUpdateTime.SelectedIndex == 1)
|
|
|
|
|
Global.setCheckWhen((int)nUDUpdateTime.Value * 24);
|
|
|
|
|
if (nUDUpdateTime.Value < 1)
|
|
|
|
|
cBUpdate.Checked = false;
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
if (nUDUpdateTime.Value == 1)
|
|
|
|
|
{
|
|
|
|
|
int index = cBUpdateTime.SelectedIndex;
|
|
|
|
|
cBUpdateTime.Items.Clear();
|
2014-08-17 00:09:15 +02:00
|
|
|
|
cBUpdateTime.Items.Add(Properties.Resources.Hour);
|
|
|
|
|
cBUpdateTime.Items.Add(Properties.Resources.Day);
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
cBUpdateTime.SelectedIndex = index;
|
|
|
|
|
}
|
2014-08-17 00:09:15 +02:00
|
|
|
|
else if (cBUpdateTime.Items[0].ToString() == Properties.Resources.Hour)
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
{
|
|
|
|
|
int index = cBUpdateTime.SelectedIndex;
|
|
|
|
|
cBUpdateTime.Items.Clear();
|
2014-08-17 00:09:15 +02:00
|
|
|
|
cBUpdateTime.Items.Add(Properties.Resources.Hours);
|
|
|
|
|
cBUpdateTime.Items.Add(Properties.Resources.Days);
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
cBUpdateTime.SelectedIndex = index;
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cBUpdateTime_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cBUpdateTime.SelectedIndex == 0)
|
|
|
|
|
Global.setCheckWhen((int)nUDUpdateTime.Value);
|
|
|
|
|
else if (cBUpdateTime.SelectedIndex == 1)
|
|
|
|
|
Global.setCheckWhen((int)nUDUpdateTime.Value * 24);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void lLBUpdate_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
{
|
2014-10-13 23:56:04 +02:00
|
|
|
|
Uri url = new Uri("http://ds4windows.com/Files/Builds/newest.txt"); //Sorry other devs, gonna have to find your own server
|
2014-06-06 22:38:52 +02:00
|
|
|
|
WebClient wct = new WebClient();
|
|
|
|
|
wct.DownloadFileAsync(url, Global.appdatapath + "\\version.txt");
|
|
|
|
|
wct.DownloadFileCompleted += wct_DownloadFileCompleted;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
private void cBDisconnectBT_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setDCBTatStop(cBDisconnectBT.Checked);
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
void wct_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setLastChecked(DateTime.Now);
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
|
|
|
|
|
string version2 = fvi.FileVersion;
|
|
|
|
|
string newversion2 = File.ReadAllText(Global.appdatapath + "\\version.txt");
|
|
|
|
|
if (version2.Replace(',', '.').CompareTo(File.ReadAllText(Global.appdatapath + "\\version.txt")) == -1)//CompareVersions();
|
2014-08-17 00:09:15 +02:00
|
|
|
|
if (MessageBox.Show(Properties.Resources.DownloadVersion.Replace("*number*", newversion2), Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
{
|
|
|
|
|
if (!File.Exists(exepath + "\\DS4Updater.exe") || (File.Exists(exepath + "\\DS4Updater.exe")
|
|
|
|
|
&& (FileVersionInfo.GetVersionInfo(exepath + "\\DS4Updater.exe").FileVersion.CompareTo("1.1.0.0") == -1)))
|
|
|
|
|
{
|
2014-10-13 23:56:04 +02:00
|
|
|
|
Uri url2 = new Uri("http://ds4windows.com/Files/DS4Updater.exe");
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
WebClient wc2 = new WebClient();
|
|
|
|
|
if (Global.appdatapath == exepath)
|
|
|
|
|
wc2.DownloadFile(url2, exepath + "\\DS4Updater.exe");
|
|
|
|
|
else
|
2014-06-06 22:38:52 +02:00
|
|
|
|
{
|
2014-08-17 00:09:15 +02:00
|
|
|
|
MessageBox.Show(Properties.Resources.PleaseDownloadUpdater);
|
2014-10-13 23:56:04 +02:00
|
|
|
|
Process.Start("http://ds4windows.com/Files/DS4Updater.exe");
|
2014-06-06 22:38:52 +02:00
|
|
|
|
}
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
}
|
2014-08-18 07:18:46 +02:00
|
|
|
|
Process p = new Process();
|
|
|
|
|
p.StartInfo.FileName = exepath + "\\DS4Updater.exe";
|
|
|
|
|
if (Global.AdminNeeded())
|
|
|
|
|
p.StartInfo.Verb = "runas";
|
2014-12-02 01:07:29 +01:00
|
|
|
|
try { p.Start(); Close(); }
|
|
|
|
|
catch { }
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
else
|
|
|
|
|
File.Delete(Global.appdatapath + "\\version.txt");
|
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
File.Delete(Global.appdatapath + "\\version.txt");
|
2014-08-17 00:09:15 +02:00
|
|
|
|
MessageBox.Show(Properties.Resources.UpToDate, "DS4Windows Updater");
|
2014-06-06 22:38:52 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void linkProfiles_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
System.Diagnostics.Process.Start(Global.appdatapath + "\\Profiles");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void linkUninstall_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
{
|
2014-06-13 21:52:25 +02:00
|
|
|
|
if (File.Exists(Global.appdatapath + "\\Virtual Bus Driver\\ScpDriver.exe"))
|
2014-06-06 22:38:52 +02:00
|
|
|
|
try { System.Diagnostics.Process.Start(Global.appdatapath + "\\Virtual Bus Driver\\ScpDriver.exe"); }
|
|
|
|
|
catch { System.Diagnostics.Process.Start(Global.appdatapath + "\\Virtual Bus Driver"); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cBNotifications_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setNotifications(cBNotifications.Checked);
|
|
|
|
|
}
|
2014-06-09 01:41:36 +02:00
|
|
|
|
|
|
|
|
|
private void lLSetup_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
{
|
2014-12-02 01:07:29 +01:00
|
|
|
|
Process p = new Process();
|
|
|
|
|
p.StartInfo.FileName = Assembly.GetExecutingAssembly().Location;
|
2014-12-13 21:12:03 +01:00
|
|
|
|
p.StartInfo.Arguments = "-driverinstall";
|
2014-12-02 01:07:29 +01:00
|
|
|
|
p.StartInfo.Verb = "runas";
|
|
|
|
|
try { p.Start(); }
|
|
|
|
|
catch { }
|
|
|
|
|
//WelcomeDialog wd = new WelcomeDialog();
|
|
|
|
|
//wd.ShowDialog();
|
2014-07-08 20:21:09 +02:00
|
|
|
|
tabSettings.Text = "Settings";
|
|
|
|
|
linkSetup.LinkColor = Color.Blue;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
}
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
|
2014-06-13 21:52:25 +02:00
|
|
|
|
protected void ScpForm_Closing(object sender, FormClosingEventArgs e)
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
{
|
2014-06-13 21:52:25 +02:00
|
|
|
|
if (opt != null)
|
|
|
|
|
{
|
|
|
|
|
opt.Close();
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
return;
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
}
|
2014-12-13 21:12:03 +01:00
|
|
|
|
if (cBCloseMini.Checked && !contextclose)
|
|
|
|
|
{
|
|
|
|
|
this.WindowState = FormWindowState.Minimized;
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-06-12 20:46:00 +02:00
|
|
|
|
if (systemShutdown)
|
|
|
|
|
// Reset the variable because the user might cancel the
|
|
|
|
|
// shutdown.
|
|
|
|
|
{
|
|
|
|
|
systemShutdown = false;
|
|
|
|
|
DS4LightBar.shuttingdown = true;
|
|
|
|
|
}
|
|
|
|
|
if (oldsize == new System.Drawing.Size(0, 0))
|
|
|
|
|
{
|
|
|
|
|
Global.setFormWidth(this.Width);
|
|
|
|
|
Global.setFormHeight(this.Height);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Global.setFormWidth(oldsize.Width);
|
|
|
|
|
Global.setFormHeight(oldsize.Height);
|
|
|
|
|
}
|
|
|
|
|
if (!String.IsNullOrEmpty(Global.appdatapath))
|
|
|
|
|
{
|
|
|
|
|
Global.Save();
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Program.rootHub.Stop();
|
2014-06-12 20:46:00 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-06-21 20:00:28 +02:00
|
|
|
|
|
|
|
|
|
private void cBSwipeProfiles_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setSwipeProfiles(cBSwipeProfiles.Checked);
|
|
|
|
|
}
|
2014-10-21 04:31:13 +02:00
|
|
|
|
|
2014-11-20 20:03:18 +01:00
|
|
|
|
private void cBQuickCharge_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setQuickCharge(cBQuickCharge.Checked);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 04:31:13 +02:00
|
|
|
|
private void lbLastMessage_MouseHover(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
tt.Show(lbLastMessage.Text, lbLastMessage, -3, -3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void pnlButton_MouseLeave(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
tt.Hide(lbLastMessage);
|
|
|
|
|
}
|
2014-12-03 23:36:54 +01:00
|
|
|
|
|
|
|
|
|
private void pnlXIPorts_MouseEnter(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//oldxiport = (int)Math.Round(nUDXIPorts.Value,0);
|
|
|
|
|
}
|
|
|
|
|
int oldxiport;
|
|
|
|
|
private void pnlXIPorts_MouseLeave(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void nUDXIPorts_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
lbLastXIPort.Text = "- " + ((int)Math.Round(nUDXIPorts.Value, 0) + 3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void nUDXIPorts_Leave(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (oldxiport != (int)Math.Round(nUDXIPorts.Value,0))
|
|
|
|
|
{
|
|
|
|
|
oldxiport = (int)Math.Round(nUDXIPorts.Value, 0);
|
|
|
|
|
Global.setFirstXinputPort(oldxiport);
|
2014-12-13 21:12:03 +01:00
|
|
|
|
Program.rootHub.x360Bus.FirstController = oldxiport;
|
2014-12-03 23:36:54 +01:00
|
|
|
|
btnStartStop_Click(sender, e);
|
|
|
|
|
btnStartStop_Click(sender, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void nUDXIPorts_Enter(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
oldxiport = (int)Math.Round(nUDXIPorts.Value, 0);
|
|
|
|
|
}
|
2014-12-13 21:12:03 +01:00
|
|
|
|
|
|
|
|
|
private void cBCloseMini_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.setCloseMini(cBCloseMini.Checked);
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ThemeUtil
|
|
|
|
|
{
|
|
|
|
|
[DllImport("UxTheme", CharSet = CharSet.Unicode, ExactSpelling = true)]
|
|
|
|
|
private static extern int SetWindowTheme(IntPtr hWnd, String appName, String partList);
|
|
|
|
|
|
|
|
|
|
public static void SetTheme(ListView lv)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SetWindowTheme(lv.Handle, "Explorer", null);
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void SetTheme(TreeView tv)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SetWindowTheme(tv.Handle, "Explorer", null);
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|