mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-12 00:09:11 +01:00
Version 8.2
Mouse movement reworked, pushing on the sticks works by a curve like xpadder PS+Options no longer turns off the controller off if it’s charging Version 8.1 Touchpad macros now work without also clicking) Mouse Buttons are now toggleable Start of Autoprofiles
This commit is contained in:
parent
7e4d8b7606
commit
3d7eb99184
@ -437,14 +437,17 @@ namespace DS4Control
|
||||
}
|
||||
if ((!pState.PS || !pState.Options) && cState.PS && cState.Options)
|
||||
{
|
||||
d.DisconnectBT();
|
||||
InputMethods.performKeyRelease(Global.getCustomKey(0, DS4Controls.PS));
|
||||
string[] skeys = Global.getCustomMacro(0, DS4Controls.PS).Split('/');
|
||||
ushort[] keys = new ushort[skeys.Length];
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
if (!d.Charging)
|
||||
{
|
||||
keys[i] = ushort.Parse(skeys[i]);
|
||||
InputMethods.performKeyRelease(keys[i]);
|
||||
d.DisconnectBT();
|
||||
InputMethods.performKeyRelease(Global.getCustomKey(0, DS4Controls.PS));
|
||||
string[] skeys = Global.getCustomMacro(0, DS4Controls.PS).Split('/');
|
||||
ushort[] keys = new ushort[skeys.Length];
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
{
|
||||
keys[i] = ushort.Parse(skeys[i]);
|
||||
InputMethods.performKeyRelease(keys[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cState.Touch1 && pState.PS)
|
||||
|
@ -743,65 +743,88 @@ namespace DS4Control
|
||||
MappedState.RY = cState.RY;
|
||||
InputMethods.MoveCursorBy(MouseDeltaX, MouseDeltaY);
|
||||
}
|
||||
|
||||
public static DateTime mousenow = DateTime.UtcNow;
|
||||
public static double mvalue = 0;
|
||||
private static int getMouseMapping(int device, DS4Controls control, DS4State cState, DS4State pState)
|
||||
{
|
||||
double value = 0;
|
||||
|
||||
int deadzone = 10;
|
||||
double value = 0;
|
||||
int speed = Global.getButtonMouseSensitivity(device);
|
||||
DateTime now = mousenow;
|
||||
switch (control)
|
||||
{
|
||||
case DS4Controls.LXNeg:
|
||||
if (cState.LX < 127 - deadzone)
|
||||
value = ((cState.LX - 127) / 127d) * speed;
|
||||
value = Math.Pow(1.01 + speed / 10000d, -(cState.LX - 127)) - 1;
|
||||
break;
|
||||
case DS4Controls.LXPos:
|
||||
if (cState.LX > 127 + deadzone)
|
||||
value = ((cState.LX - 127) / 127d) * speed;
|
||||
value = Math.Pow(1.01 + speed / 10000d, (cState.LX - 127)) -1;
|
||||
break;
|
||||
case DS4Controls.RXNeg:
|
||||
if (cState.RX < 127 - deadzone)
|
||||
value = -((cState.RX-127) / 127d) * speed;
|
||||
value = Math.Pow(1.01 + speed / 10000d, -(cState.RX - 127)) - 1;
|
||||
break;
|
||||
case DS4Controls.RXPos:
|
||||
if (cState.RX > 127 + deadzone)
|
||||
value = ((cState.RX-127) / 127d) * speed;
|
||||
value = Math.Pow(1.01 + speed / 10000d, (cState.RX - 127)) - 1;
|
||||
break;
|
||||
case DS4Controls.LYNeg:
|
||||
if (cState.LY < 127 - deadzone)
|
||||
value = -((cState.LY - 127)/127d) * speed;
|
||||
value = Math.Pow(1.01 + speed / 10000d, -(cState.LY - 127)) - 1;
|
||||
break;
|
||||
case DS4Controls.LYPos:
|
||||
if (cState.LY > 127 + deadzone)
|
||||
value = ((cState.LY - 127) / 127d) * speed;
|
||||
value = Math.Pow(1.01 + speed / 10000d,(cState.LY - 127)) - 1;
|
||||
break;
|
||||
case DS4Controls.RYNeg:
|
||||
if (cState.RY < 127 - deadzone)
|
||||
value = -((cState.RY - 127) / 127d) * speed;
|
||||
value = Math.Pow(1.01 + speed / 10000d,-(cState.RY - 127)) - 1;
|
||||
break;
|
||||
case DS4Controls.RYPos:
|
||||
if (cState.RY > 127 + deadzone)
|
||||
value = ((cState.RY - 127) / 127d) * speed;
|
||||
value = Math.Pow(1.01 + speed / 10000d, (cState.RY - 127)) - 1;
|
||||
break;
|
||||
case DS4Controls.Share: value = (cState.Share ? speed / 2 : 0); break;
|
||||
case DS4Controls.Options: value = (cState.Options ? speed / 2 : 0); break;
|
||||
case DS4Controls.L1: value = (cState.L1 ? speed / 2 : 0); break;
|
||||
case DS4Controls.R1: value = (cState.R1 ? speed / 2 : 0); break;
|
||||
case DS4Controls.L3: value = (cState.L3 ? speed / 2 : 0); break;
|
||||
case DS4Controls.R3: value = (cState.R3 ? speed / 2 : 0); break;
|
||||
case DS4Controls.DpadUp: value = (cState.DpadUp ? speed / 2 : 0); break;
|
||||
case DS4Controls.DpadDown: value = (cState.DpadDown ? speed / 2 : 0); break;
|
||||
case DS4Controls.DpadLeft: value = (cState.DpadLeft ? speed / 2 : 0); break;
|
||||
case DS4Controls.DpadRight: value = (cState.DpadRight ? speed / 2 : 0); break;
|
||||
case DS4Controls.PS: value = (cState.PS ? speed / 2 : 0); break;
|
||||
case DS4Controls.Cross: value = (cState.Cross ? speed / 2 : 0); break;
|
||||
case DS4Controls.Square: value = (cState.Square ? speed / 2 : 0); break;
|
||||
case DS4Controls.Triangle: value = (cState.Triangle ? speed / 2 : 0); break;
|
||||
case DS4Controls.Circle: value = (cState.Circle ? speed / 2 : 0); break;
|
||||
case DS4Controls.L2: value = ((cState.L2 / 2d) / 127d) * speed; break;
|
||||
case DS4Controls.R2: value = ((cState.R2 / 2d) / 127d) * speed; break;
|
||||
case DS4Controls.Share: value = (cState.Share ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.Options: value = (cState.Options ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.L1: value = (cState.L1 ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.R1: value = (cState.R1 ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.L3: value = (cState.L3 ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.R3: value = (cState.R3 ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.DpadUp: value = (cState.DpadUp ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.DpadDown: value = (cState.DpadDown ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.DpadLeft: value = (cState.DpadLeft ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.DpadRight: value = (cState.DpadRight ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.PS: value = (cState.PS ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.Cross: value = (cState.Cross ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.Square: value = (cState.Square ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.Triangle: value = (cState.Triangle ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.Circle: value = (cState.Circle ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
|
||||
case DS4Controls.L2: value = ((cState.L2 / 2d) / 127d) * Math.Pow(1.01 + speed / 10000d, 100) - 1; break;
|
||||
case DS4Controls.R2: value = ((cState.R2 / 2d) / 127d) * Math.Pow(1.01 + speed / 10000d, 100) - 1; break;
|
||||
}
|
||||
return (int)Math.Round(value,0);
|
||||
if (value != 0)
|
||||
mvalue = value;
|
||||
|
||||
bool LXChanged = (Math.Abs(127 - cState.LX) < deadzone);
|
||||
bool LYChanged = (Math.Abs(127 - cState.LY) < deadzone);
|
||||
bool RXChanged = (Math.Abs(127 - cState.RX) < deadzone);
|
||||
bool RYChanged = (Math.Abs(127 - cState.RY) < deadzone);
|
||||
if (LXChanged || LYChanged || RXChanged || RYChanged)
|
||||
now = DateTime.UtcNow;
|
||||
if (value <= 1)
|
||||
{
|
||||
if (now >= mousenow + TimeSpan.FromMilliseconds((1 - value)*250))
|
||||
{
|
||||
mousenow = now;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return (int)Math.Round(value, 0);
|
||||
}
|
||||
|
||||
public static bool compare(byte b1, byte b2)
|
||||
|
@ -404,11 +404,65 @@ namespace DS4Control
|
||||
}
|
||||
public static DS4Color getTransitionedColor(DS4Color c1, DS4Color c2, uint ratio)
|
||||
{;
|
||||
Color cs = Color.FromArgb(c1.red, c1.green, c1.blue);
|
||||
c1.red = applyRatio(c1.red, c2.red, ratio);
|
||||
c1.green = applyRatio(c1.green, c2.green, ratio);
|
||||
c1.blue = applyRatio(c1.blue, c2.blue, ratio);
|
||||
return c1;
|
||||
}
|
||||
|
||||
/*public static DS4Color getTransitionedColor(DS4Color lowcolor, DS4Color maxcolor, uint ratio)
|
||||
{
|
||||
Color cs = Color.FromArgb(lowcolor.red, lowcolor.green, lowcolor.blue);
|
||||
Color cs2 = Color.FromArgb(maxcolor.red, maxcolor.green, maxcolor.blue);
|
||||
Color csR = applyRatio(cs, cs2, ratio);
|
||||
DS4Color dr = new DS4Color { red = csR.R, green = csR.G, blue = csR.B };
|
||||
return dr;
|
||||
}*/
|
||||
private static Color applyRatio(Color c1, Color c2, uint r)
|
||||
{
|
||||
float ratio = r / 100f;
|
||||
float hue1 = c1.GetHue();
|
||||
float hue2 = c2.GetHue();
|
||||
float bri1 = c1.GetBrightness();
|
||||
float bri2 = c2.GetBrightness();
|
||||
float sat1 = c1.GetSaturation();
|
||||
float sat2 = c2.GetSaturation();
|
||||
float hr = hue2 - hue1;
|
||||
float br = bri2 - bri1;
|
||||
float sr = sat2 - sat1;
|
||||
Color csR;
|
||||
if (bri1 == 0)
|
||||
csR = HuetoRGB(hue2,sat2,bri2 - br*ratio);
|
||||
else
|
||||
csR = HuetoRGB(hue2 - hr * ratio, sat2 - sr * ratio, bri2 - br * ratio);
|
||||
return csR;
|
||||
}
|
||||
|
||||
public static Color HuetoRGB(float hue, float sat, float bri)
|
||||
{
|
||||
float C = (1-Math.Abs(2*bri)-1)* sat;
|
||||
float X = C * (1 - Math.Abs((hue / 60) % 2 - 1));
|
||||
float m = bri - C / 2;
|
||||
float R, G, B;
|
||||
if (0 <= hue && hue < 60)
|
||||
{ R = C; G = X; B = 0;}
|
||||
else if (60 <= hue && hue < 120)
|
||||
{R = X; G = C; B = 0; }
|
||||
else if (120 <= hue && hue < 180)
|
||||
{ R = 0; G = C; B = X; }
|
||||
else if (180 <= hue && hue < 240)
|
||||
{ R = 0; G = X; B = C; }
|
||||
else if (240 <= hue && hue < 300)
|
||||
{ R = X; G = 0; B = C; }
|
||||
else if (300 <= hue && hue < 360)
|
||||
{ R = C; G = 0; B = X; }
|
||||
else
|
||||
{ R = 255; G = 0; B = 0; }
|
||||
R += m; G += m; B += m;
|
||||
R *= 255; G *= 255; B *= 255;
|
||||
return Color.FromArgb((int)R, (int)G, (int)B);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,6 +128,12 @@
|
||||
<Compile Include="WelcomeDialog.Designer.cs">
|
||||
<DependentUpon>WelcomeDialog.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WinProgs.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WinProgs.Designer.cs">
|
||||
<DependentUpon>WinProgs.cs</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Hotkeys.resx">
|
||||
<DependentUpon>Hotkeys.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@ -149,6 +155,9 @@
|
||||
<EmbeddedResource Include="WelcomeDialog.resx">
|
||||
<DependentUpon>WelcomeDialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="WinProgs.resx">
|
||||
<DependentUpon>WinProgs.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.config" />
|
||||
<None Include="DS4Tool_TemporaryKey.pfx" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
|
5
DS4Tool/Options.Designer.cs
generated
5
DS4Tool/Options.Designer.cs
generated
@ -1714,6 +1714,11 @@
|
||||
// numUDMouseSens
|
||||
//
|
||||
this.numUDMouseSens.Location = new System.Drawing.Point(109, 14);
|
||||
this.numUDMouseSens.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numUDMouseSens.Name = "numUDMouseSens";
|
||||
this.numUDMouseSens.Size = new System.Drawing.Size(50, 20);
|
||||
this.numUDMouseSens.TabIndex = 241;
|
||||
|
14
DS4Tool/ScpForm.Designer.cs
generated
14
DS4Tool/ScpForm.Designer.cs
generated
@ -35,6 +35,7 @@
|
||||
this.chData = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.tmrUpdate = new System.Windows.Forms.Timer(this.components);
|
||||
this.pnlButton = new System.Windows.Forms.Panel();
|
||||
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
|
||||
this.btnImportProfiles = new System.Windows.Forms.Button();
|
||||
this.llbHelp = new System.Windows.Forms.LinkLabel();
|
||||
this.btnStartStop = new System.Windows.Forms.Button();
|
||||
@ -121,6 +122,7 @@
|
||||
//
|
||||
// pnlButton
|
||||
//
|
||||
this.pnlButton.Controls.Add(this.linkLabel1);
|
||||
this.pnlButton.Controls.Add(this.btnImportProfiles);
|
||||
this.pnlButton.Controls.Add(this.llbHelp);
|
||||
this.pnlButton.Controls.Add(this.btnStartStop);
|
||||
@ -132,6 +134,17 @@
|
||||
this.pnlButton.Size = new System.Drawing.Size(794, 35);
|
||||
this.pnlButton.TabIndex = 10;
|
||||
//
|
||||
// linkLabel1
|
||||
//
|
||||
this.linkLabel1.AutoSize = true;
|
||||
this.linkLabel1.Location = new System.Drawing.Point(232, 11);
|
||||
this.linkLabel1.Name = "linkLabel1";
|
||||
this.linkLabel1.Size = new System.Drawing.Size(51, 13);
|
||||
this.linkLabel1.TabIndex = 15;
|
||||
this.linkLabel1.TabStop = true;
|
||||
this.linkLabel1.Text = "Programs";
|
||||
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
|
||||
//
|
||||
// btnImportProfiles
|
||||
//
|
||||
this.btnImportProfiles.Location = new System.Drawing.Point(9, 6);
|
||||
@ -681,6 +694,7 @@
|
||||
private System.Windows.Forms.Button btnImportProfiles;
|
||||
private System.Windows.Forms.CheckBox StartWindowsCheckBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.LinkLabel linkLabel1;
|
||||
//private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,12 @@ using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Management;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
namespace ScpServer
|
||||
{
|
||||
public partial class ScpForm : Form
|
||||
{
|
||||
double version = 8.01;
|
||||
double version = 8.2;
|
||||
private DS4Control.Control rootHub;
|
||||
delegate void LogDebugDelegate(DateTime Time, String Data);
|
||||
|
||||
@ -42,16 +43,23 @@ namespace ScpServer
|
||||
foreach (ToolStripMenuItem t in shortcuts)
|
||||
t.DropDownItemClicked += Profile_Changed_Menu;
|
||||
CheckDrivers();
|
||||
Timer te = new Timer();
|
||||
//te.Start();
|
||||
te.Tick += test_Tick;
|
||||
Timer test = new Timer(), processcheck = new Timer();
|
||||
//test.Start();
|
||||
processcheck.Start();
|
||||
processcheck.Tick += processcheck_Tick;
|
||||
test.Tick += test_Tick;
|
||||
}
|
||||
|
||||
void processcheck_Tick(object sender, EventArgs e)
|
||||
{
|
||||
Process pc = new Process();
|
||||
}
|
||||
|
||||
private void test_Tick(object sender, EventArgs e)
|
||||
{
|
||||
label1.Visible = true;
|
||||
int speed = Global.getButtonMouseSensitivity(0);
|
||||
label1.Text = (((rootHub.getDS4State(0).RX - 127) / 127d) * speed).ToString();
|
||||
label1.Text = (((rootHub.getDS4State(0).RX - 127) / 127d) * speed).ToString() + "and " + Mapping.mvalue;
|
||||
/*label1.Text = Mapping.globalState.currentClicks.toggle.ToString() + " Left is " +
|
||||
Mapping.getBoolMapping(DS4Controls.DpadLeft, rootHub.getDS4State(0)) +
|
||||
" Toggle is " + Mapping.pressedonce[256] +
|
||||
@ -166,12 +174,13 @@ namespace ScpServer
|
||||
Global.setLastChecked(DateTime.Now);
|
||||
}
|
||||
}
|
||||
List<string> profilenames = new List<string>();
|
||||
public void RefreshProfiles()
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] profiles = Directory.GetFiles(Global.appdatapath + @"\Profiles\");
|
||||
List<string> profilenames = new List<string>();
|
||||
profilenames.Clear();
|
||||
string[] profiles = Directory.GetFiles(Global.appdatapath + @"\Profiles\");
|
||||
foreach (String s in profiles)
|
||||
if (s.EndsWith(".xml"))
|
||||
profilenames.Add(Path.GetFileNameWithoutExtension(s));
|
||||
@ -589,6 +598,12 @@ namespace ScpServer
|
||||
KeyLoc.DeleteValue("DS4Tool", false);
|
||||
}
|
||||
|
||||
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
WinProgs WP = new WinProgs(profilenames.ToArray());
|
||||
WP.ShowDialog();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ThemeUtil
|
||||
|
219
DS4Tool/WinProgs.Designer.cs
generated
Normal file
219
DS4Tool/WinProgs.Designer.cs
generated
Normal file
@ -0,0 +1,219 @@
|
||||
namespace ScpServer
|
||||
{
|
||||
partial class WinProgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.listBox2 = new System.Windows.Forms.ListBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.lBProfiles = new System.Windows.Forms.ListBox();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.comboBox2 = new System.Windows.Forms.ComboBox();
|
||||
this.comboBox3 = new System.Windows.Forms.ComboBox();
|
||||
this.comboBox4 = new System.Windows.Forms.ComboBox();
|
||||
this.bnSave = new System.Windows.Forms.Button();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// listBox1
|
||||
//
|
||||
this.listBox1.FormattingEnabled = true;
|
||||
this.listBox1.Location = new System.Drawing.Point(5, 4);
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(279, 199);
|
||||
this.listBox1.TabIndex = 0;
|
||||
this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
|
||||
this.listBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listBox1_KeyDown);
|
||||
this.listBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDoubleClick);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(516, 180);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(114, 23);
|
||||
this.button2.TabIndex = 2;
|
||||
this.button2.Text = "Browse More";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// listBox2
|
||||
//
|
||||
this.listBox2.FormattingEnabled = true;
|
||||
this.listBox2.Location = new System.Drawing.Point(290, 4);
|
||||
this.listBox2.Name = "listBox2";
|
||||
this.listBox2.Size = new System.Drawing.Size(220, 199);
|
||||
this.listBox2.TabIndex = 0;
|
||||
this.listBox2.SelectedIndexChanged += new System.EventHandler(this.listBox2_SelectedIndexChanged);
|
||||
this.listBox2.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listBox2_KeyDown);
|
||||
this.listBox2.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBox2_MouseDoubleClick);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(5, 206);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(717, 19);
|
||||
this.label1.TabIndex = 3;
|
||||
//
|
||||
// lBProfiles
|
||||
//
|
||||
this.lBProfiles.FormattingEnabled = true;
|
||||
this.lBProfiles.Location = new System.Drawing.Point(516, 136);
|
||||
this.lBProfiles.Name = "lBProfiles";
|
||||
this.lBProfiles.Size = new System.Drawing.Size(196, 30);
|
||||
this.lBProfiles.TabIndex = 4;
|
||||
this.lBProfiles.Visible = false;
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new System.Drawing.Point(601, 6);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(121, 21);
|
||||
this.comboBox1.TabIndex = 6;
|
||||
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.CBProfile_IndexChanged);
|
||||
//
|
||||
// comboBox2
|
||||
//
|
||||
this.comboBox2.FormattingEnabled = true;
|
||||
this.comboBox2.Location = new System.Drawing.Point(601, 33);
|
||||
this.comboBox2.Name = "comboBox2";
|
||||
this.comboBox2.Size = new System.Drawing.Size(121, 21);
|
||||
this.comboBox2.TabIndex = 6;
|
||||
this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.CBProfile_IndexChanged);
|
||||
//
|
||||
// comboBox3
|
||||
//
|
||||
this.comboBox3.FormattingEnabled = true;
|
||||
this.comboBox3.Location = new System.Drawing.Point(601, 60);
|
||||
this.comboBox3.Name = "comboBox3";
|
||||
this.comboBox3.Size = new System.Drawing.Size(121, 21);
|
||||
this.comboBox3.TabIndex = 6;
|
||||
this.comboBox3.SelectedIndexChanged += new System.EventHandler(this.CBProfile_IndexChanged);
|
||||
//
|
||||
// comboBox4
|
||||
//
|
||||
this.comboBox4.FormattingEnabled = true;
|
||||
this.comboBox4.Location = new System.Drawing.Point(601, 87);
|
||||
this.comboBox4.Name = "comboBox4";
|
||||
this.comboBox4.Size = new System.Drawing.Size(121, 21);
|
||||
this.comboBox4.TabIndex = 6;
|
||||
this.comboBox4.SelectedIndexChanged += new System.EventHandler(this.CBProfile_IndexChanged);
|
||||
//
|
||||
// bnSave
|
||||
//
|
||||
this.bnSave.Location = new System.Drawing.Point(655, 180);
|
||||
this.bnSave.Name = "bnSave";
|
||||
this.bnSave.Size = new System.Drawing.Size(67, 23);
|
||||
this.bnSave.TabIndex = 2;
|
||||
this.bnSave.Text = "Save";
|
||||
this.bnSave.UseVisualStyleBackColor = true;
|
||||
this.bnSave.Click += new System.EventHandler(this.bnSave_Click);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(516, 9);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(60, 13);
|
||||
this.label2.TabIndex = 7;
|
||||
this.label2.Text = "Controller 1";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(516, 36);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(60, 13);
|
||||
this.label3.TabIndex = 7;
|
||||
this.label3.Text = "Controller 2";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(516, 63);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(60, 13);
|
||||
this.label4.TabIndex = 7;
|
||||
this.label4.Text = "Controller 3";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(516, 90);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(60, 13);
|
||||
this.label5.TabIndex = 7;
|
||||
this.label5.Text = "Controller 4";
|
||||
//
|
||||
// WinProgs
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(736, 230);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.comboBox4);
|
||||
this.Controls.Add(this.comboBox3);
|
||||
this.Controls.Add(this.comboBox2);
|
||||
this.Controls.Add(this.comboBox1);
|
||||
this.Controls.Add(this.lBProfiles);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.bnSave);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.listBox2);
|
||||
this.Controls.Add(this.listBox1);
|
||||
this.Name = "WinProgs";
|
||||
this.Text = "Auto-Profiles";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListBox listBox1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.ListBox listBox2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ListBox lBProfiles;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.ComboBox comboBox2;
|
||||
private System.Windows.Forms.ComboBox comboBox3;
|
||||
private System.Windows.Forms.ComboBox comboBox4;
|
||||
private System.Windows.Forms.Button bnSave;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label5;
|
||||
}
|
||||
}
|
193
DS4Tool/WinProgs.cs
Normal file
193
DS4Tool/WinProgs.cs
Normal file
@ -0,0 +1,193 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using DS4Control;
|
||||
using System.Xml;
|
||||
|
||||
namespace ScpServer
|
||||
{
|
||||
public partial class WinProgs : Form
|
||||
{
|
||||
ToolTip tp = new ToolTip();
|
||||
public WinProgs(string[] oc)
|
||||
{
|
||||
InitializeComponent();
|
||||
comboBox1.Text = "(none)";
|
||||
comboBox2.Text = "(none)";
|
||||
comboBox3.Text = "(none)";
|
||||
comboBox4.Text = "(none)";
|
||||
comboBox1.Items.AddRange(oc);
|
||||
comboBox2.Items.AddRange(oc);
|
||||
comboBox3.Items.AddRange(oc);
|
||||
comboBox4.Items.AddRange(oc);
|
||||
foreach (string o in oc)
|
||||
lBProfiles.Items.Add(o);
|
||||
string[] lods = Directory.GetDirectories(@"C:\Program Files (x86)\Steam\SteamApps\common");
|
||||
foreach (string s in lods)
|
||||
listBox1.Items.Add(Path.GetFileName(s));
|
||||
if (!File.Exists(Global.appdatapath + @"\Auto Profiles.xml"))
|
||||
Create();
|
||||
//foreach (ListBox.ObjectCollection s in listBox1.Items)
|
||||
// tp.SetToolTip((Control)s, @"C:\Program Files (x86)\Steam\SteamApps\common" + s.ToString());
|
||||
}
|
||||
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
string s = listBox1.SelectedItem.ToString();
|
||||
string[] lods = Directory.GetFiles(@"C:\Program Files (x86)\Steam\SteamApps\common\" + s, "*.exe", SearchOption.AllDirectories);
|
||||
listBox2.Items.Clear();
|
||||
foreach (string st in lods)
|
||||
if (!st.Contains("setup") && !st.Contains("dotnet") && !st.Contains("SETUP") && !st.Contains("vcredist"))
|
||||
listBox2.Items.Add(Path.GetFileNameWithoutExtension(st));
|
||||
}
|
||||
|
||||
private void listBox1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyValue == 13)
|
||||
listBox1_MouseDoubleClick(sender, null);
|
||||
}
|
||||
List<string> lods = new List<string>();
|
||||
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string s = listBox1.SelectedItem.ToString();
|
||||
lods.Clear();
|
||||
lods.AddRange(Directory.GetFiles(@"C:\Program Files (x86)\Steam\SteamApps\common\" + s, "*.exe", SearchOption.AllDirectories));
|
||||
for (int i = lods.Count-1; i >= 0; i--)
|
||||
if (lods[i].Contains("etup") || lods[i].Contains("dotnet") || lods[i].Contains("SETUP")
|
||||
|| lods[i].Contains("edist") || lods[i].Contains("nstall"))
|
||||
lods.RemoveAt(i);
|
||||
|
||||
listBox2.Items.Clear();
|
||||
foreach (string st in lods)
|
||||
//if (!st.Contains("etup") && !st.Contains("dotnet") && !st.Contains("SETUP") && !st.Contains("edist") && !st.Contains("nstall"))
|
||||
listBox2.Items.Add(Path.GetFileNameWithoutExtension(st));
|
||||
}
|
||||
|
||||
private void listBox2_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void listBox2_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyValue == 13)
|
||||
listBox2_MouseDoubleClick(sender, null);
|
||||
}
|
||||
|
||||
private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (listBox2.SelectedIndex >= 0)
|
||||
label1.Text = lods[listBox2.SelectedIndex];
|
||||
}
|
||||
|
||||
private void Controller_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
/*if (cBC1.Checked)
|
||||
Global.setAProfile(0, lBProfiles.SelectedItem.ToString());
|
||||
if (cBC2.Checked)
|
||||
Global.setAProfile(1, lBProfiles.SelectedItem.ToString());
|
||||
if (cBC3.Checked)
|
||||
Global.setAProfile(2, lBProfiles.SelectedItem.ToString());
|
||||
if (cBC4.Checked)
|
||||
Global.setAProfile(3, lBProfiles.SelectedItem.ToString());*/
|
||||
Save();
|
||||
}
|
||||
protected String m_Profile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool\\Auto Profiles.xml";
|
||||
protected XmlDocument m_Xdoc = new XmlDocument();
|
||||
|
||||
public bool Create()
|
||||
{
|
||||
Boolean Saved = true;
|
||||
|
||||
try
|
||||
{
|
||||
XmlNode Node;
|
||||
|
||||
Node = m_Xdoc.CreateXmlDeclaration("1.0", "utf-8", String.Empty);
|
||||
m_Xdoc.AppendChild(Node);
|
||||
|
||||
Node = m_Xdoc.CreateComment(String.Format(" Auto-Profile Configuration Data. {0} ", DateTime.Now));
|
||||
m_Xdoc.AppendChild(Node);
|
||||
|
||||
Node = m_Xdoc.CreateWhitespace("\r\n");
|
||||
m_Xdoc.AppendChild(Node);
|
||||
|
||||
Node = m_Xdoc.CreateNode(XmlNodeType.Element, "Programs", null);
|
||||
m_Xdoc.AppendChild(Node);
|
||||
m_Xdoc.Save(m_Profile);
|
||||
}
|
||||
catch { Saved = false; }
|
||||
|
||||
return Saved;
|
||||
}
|
||||
public bool Save()
|
||||
{
|
||||
Boolean Saved = true;
|
||||
m_Xdoc.Load(m_Profile);
|
||||
//try
|
||||
{
|
||||
XmlNode Node;
|
||||
Node = m_Xdoc.SelectSingleNode("Programs");
|
||||
//Node = m_Xdoc.CreateComment(String.Format(" Auto-Profile Configuration Data. {0} ", DateTime.Now));
|
||||
//m_Xdoc.AppendChild(Node);
|
||||
|
||||
string programname = listBox2.SelectedItem.ToString();
|
||||
//if (programname.Contains(" "))
|
||||
programname.Replace(' ', ',');
|
||||
XmlNode xmlprogram = m_Xdoc.CreateNode(XmlNodeType.Element, programname, null);
|
||||
|
||||
XmlNode xmlController1 = m_Xdoc.CreateNode(XmlNodeType.Element, "Controller1", null);
|
||||
xmlController1.InnerText = comboBox1.Text;
|
||||
xmlprogram.AppendChild(xmlController1);
|
||||
XmlNode xmlController2 = m_Xdoc.CreateNode(XmlNodeType.Element, "Controller2", null);
|
||||
xmlController2.InnerText = comboBox2.Text;
|
||||
xmlprogram.AppendChild(xmlController2);
|
||||
XmlNode xmlController3 = m_Xdoc.CreateNode(XmlNodeType.Element, "Controller3", null);
|
||||
xmlController3.InnerText = comboBox3.Text;
|
||||
xmlprogram.AppendChild(xmlController3);
|
||||
XmlNode xmlController4 = m_Xdoc.CreateNode(XmlNodeType.Element, "Controller4", null);
|
||||
xmlController4.InnerText = comboBox4.Text;
|
||||
xmlprogram.AppendChild(xmlController4);
|
||||
|
||||
try
|
||||
{
|
||||
XmlNode oldxmlprocess = m_Xdoc.SelectSingleNode("/Programs/" + listBox2.SelectedItem.ToString());
|
||||
Node.ReplaceChild(xmlprogram, oldxmlprocess);
|
||||
}
|
||||
catch { Node.AppendChild(xmlprogram); }
|
||||
//Node.AppendChild(oldxmlprocess);
|
||||
m_Xdoc.AppendChild(Node);
|
||||
m_Xdoc.Save(m_Profile);
|
||||
}
|
||||
//catch { Saved = false; }
|
||||
|
||||
return Saved;
|
||||
}
|
||||
|
||||
private void CBProfile_IndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void bnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
}
|
120
DS4Tool/WinProgs.resx
Normal file
120
DS4Tool/WinProgs.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
Loading…
x
Reference in New Issue
Block a user