2014-03-28 02:50:40 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Xml;
|
2014-05-28 04:49:58 +02:00
|
|
|
|
using System.Drawing;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
using DS4Library;
|
2014-06-12 20:46:00 +02:00
|
|
|
|
using System.Security.Principal;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
namespace DS4Control
|
|
|
|
|
{
|
|
|
|
|
[Flags]
|
2014-06-14 21:14:27 +02:00
|
|
|
|
public enum DS4KeyType : byte { None = 0, ScanCode = 1, Toggle = 2, Unbound = 4, Macro = 8, HoldMacro = 16, RepeatMacro = 32 }; //Increment by exponents of 2*, starting at 2^0
|
2014-03-28 02:50:40 +01:00
|
|
|
|
public enum Ds3PadId : byte { None = 0xFF, One = 0x00, Two = 0x01, Three = 0x02, Four = 0x03, All = 0x04 };
|
2014-06-24 00:27:14 +02:00
|
|
|
|
public enum DS4Controls : byte { None, LXNeg, LXPos, LYNeg, LYPos, RXNeg, RXPos, RYNeg, RYPos, L1, L2, L3, R1, R2, R3, Square, Triangle, Circle, Cross, DpadUp, DpadRight, DpadDown, DpadLeft, PS, TouchLeft, TouchUpper, TouchMulti, TouchRight, Share, Options, GyroXPos, GyroXNeg, GyroZPos, GyroZNeg };
|
2014-04-29 23:56:58 +02:00
|
|
|
|
public enum X360Controls : byte { None, LXNeg, LXPos, LYNeg, LYPos, RXNeg, RXPos, RYNeg, RYPos, LB, LT, LS, RB, RT, RS, X, Y, B, A, DpadUp, DpadRight, DpadDown, DpadLeft, Guide, Back, Start, LeftMouse, RightMouse, MiddleMouse, FourthMouse, FifthMouse, WUP, WDOWN, MouseUp, MouseDown, MouseLeft, MouseRight, Unbound };
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
|
|
|
|
public class DebugEventArgs : EventArgs
|
|
|
|
|
{
|
|
|
|
|
protected DateTime m_Time = DateTime.Now;
|
|
|
|
|
protected String m_Data = String.Empty;
|
|
|
|
|
|
|
|
|
|
public DebugEventArgs(String Data)
|
|
|
|
|
{
|
|
|
|
|
m_Data = Data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DateTime Time
|
|
|
|
|
{
|
|
|
|
|
get { return m_Time; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String Data
|
|
|
|
|
{
|
|
|
|
|
get { return m_Data; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class MappingDoneEventArgs : EventArgs
|
|
|
|
|
{
|
|
|
|
|
protected int deviceNum = -1;
|
|
|
|
|
|
|
|
|
|
public MappingDoneEventArgs(int DeviceID)
|
|
|
|
|
{
|
|
|
|
|
deviceNum = DeviceID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int DeviceID
|
|
|
|
|
{
|
|
|
|
|
get { return deviceNum; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ReportEventArgs : EventArgs
|
|
|
|
|
{
|
|
|
|
|
protected Ds3PadId m_Pad = Ds3PadId.None;
|
|
|
|
|
protected Byte[] m_Report = new Byte[64];
|
|
|
|
|
|
|
|
|
|
public ReportEventArgs()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ReportEventArgs(Ds3PadId Pad)
|
|
|
|
|
{
|
|
|
|
|
m_Pad = Pad;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Ds3PadId Pad
|
|
|
|
|
{
|
|
|
|
|
get { return m_Pad; }
|
|
|
|
|
set { m_Pad = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Byte[] Report
|
|
|
|
|
{
|
|
|
|
|
get { return m_Report; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Global
|
|
|
|
|
{
|
|
|
|
|
protected static BackingStore m_Config = new BackingStore();
|
|
|
|
|
protected static Int32 m_IdleTimeout = 600000;
|
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
|
|
|
|
static string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
|
|
|
|
|
public static string appdatapath;
|
2014-09-15 04:37:14 +02:00
|
|
|
|
public static string[] tempprofilename = new string[5] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
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-12 20:46:00 +02:00
|
|
|
|
public static void SaveWhere(string path)
|
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-12 20:46:00 +02:00
|
|
|
|
appdatapath = path;
|
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
|
|
|
|
m_Config.m_Profile = appdatapath + "\\Profiles.xml";
|
|
|
|
|
}
|
2014-06-12 20:46:00 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Check if Admin Rights are needed to write in Appliplation Directory
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static bool AdminNeeded()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2014-06-13 21:52:25 +02:00
|
|
|
|
File.WriteAllText(exepath + "\\test.txt", "test");
|
|
|
|
|
File.Delete(exepath + "\\test.txt");
|
2014-06-12 20:46:00 +02:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
catch (UnauthorizedAccessException)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool IsAdministrator()
|
|
|
|
|
{
|
|
|
|
|
var identity = WindowsIdentity.GetCurrent();
|
|
|
|
|
var principal = new WindowsPrincipal(identity);
|
|
|
|
|
return principal.IsInRole(WindowsBuiltInRole.Administrator);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-29 06:29:08 +01:00
|
|
|
|
public static event EventHandler<EventArgs> ControllerStatusChange; // called when a controller is added/removed/battery or touchpad mode changes/etc.
|
|
|
|
|
public static void ControllerStatusChanged(object sender)
|
|
|
|
|
{
|
|
|
|
|
if (ControllerStatusChange != null)
|
|
|
|
|
ControllerStatusChange(sender, EventArgs.Empty);
|
|
|
|
|
}
|
2014-04-29 23:56:58 +02:00
|
|
|
|
public static void setButtonMouseSensitivity(int device, int data)
|
|
|
|
|
{
|
|
|
|
|
m_Config.buttonMouseSensitivity[device] = data;
|
|
|
|
|
}
|
|
|
|
|
public static int getButtonMouseSensitivity(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.buttonMouseSensitivity[device];
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
public static DS4Color loadColor(int device)
|
|
|
|
|
{
|
|
|
|
|
DS4Color color = new DS4Color();
|
2014-04-29 10:01:13 +02:00
|
|
|
|
color.red = m_Config.m_Leds[device][0];
|
|
|
|
|
color.green = m_Config.m_Leds[device][1];
|
|
|
|
|
color.blue = m_Config.m_Leds[device][2];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
return color;
|
|
|
|
|
}
|
|
|
|
|
public static void saveColor(int device, byte red, byte green, byte blue)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.m_Leds[device][0] = red;
|
|
|
|
|
m_Config.m_Leds[device][1] = green;
|
|
|
|
|
m_Config.m_Leds[device][2] = blue;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static byte loadRumbleBoost(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.m_Rumble[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static void saveRumbleBoost(int device, byte boost)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.m_Rumble[device] = boost;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
|
|
|
|
}
|
2014-04-30 21:32:44 +02:00
|
|
|
|
public static double getRainbow(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.rainbow[device];
|
|
|
|
|
}
|
|
|
|
|
public static void setRainbow(int device, double speed)
|
|
|
|
|
{
|
|
|
|
|
m_Config.rainbow[device] = speed;
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
public static bool getFlushHIDQueue(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.flushHIDQueue[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static void setFlushHIDQueue(int device, bool setting)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.flushHIDQueue[device] = setting;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int getIdleDisconnectTimeout(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.idleDisconnectTimeout[device];
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
|
|
|
|
public static void setIdleDisconnectTimeout(int device, int seconds)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.idleDisconnectTimeout[device] = seconds;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static byte getTouchSensitivity(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.touchSensitivity[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static void setTouchSensitivity(int device, byte sen)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.touchSensitivity[device] = sen;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
|
|
|
|
public static void setFlashWhenLowBattery(int device, bool flash)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.flashLedLowBattery[device] = flash;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public static bool getFlashWhenLowBattery(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.flashLedLowBattery[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-31 06:37:02 +02:00
|
|
|
|
public static void setFlashAt(int device, int when)
|
|
|
|
|
{
|
|
|
|
|
m_Config.flashAt[device] = when;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public static int getFlashAt(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.flashAt[device];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
public static void setLedAsBatteryIndicator(int device, bool ledAsBattery)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.ledAsBattery[device] = ledAsBattery;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public static bool getLedAsBatteryIndicator(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.ledAsBattery[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-06-02 19:29:38 +02:00
|
|
|
|
|
|
|
|
|
public static void setChargingType(int device, int type)
|
|
|
|
|
{
|
|
|
|
|
m_Config.chargingType[device] = type;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public static int getChargingType(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.chargingType[device];
|
|
|
|
|
|
|
|
|
|
}
|
2014-08-23 22:52:20 +02:00
|
|
|
|
|
|
|
|
|
public static void setDinputOnly(int device, bool dinput)
|
|
|
|
|
{
|
|
|
|
|
m_Config.dinputOnly[device] = dinput;
|
|
|
|
|
}
|
|
|
|
|
public static bool getDinputOnly(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.dinputOnly[device];
|
|
|
|
|
}
|
2014-09-15 04:37:14 +02:00
|
|
|
|
public static void setStartTouchpadOff(int device, bool off)
|
|
|
|
|
{
|
|
|
|
|
m_Config.startTouchpadOff[device] = off;
|
|
|
|
|
}
|
|
|
|
|
public static bool getStartTouchpadOff(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.startTouchpadOff[device];
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
public static void setUseExclusiveMode(bool exclusive)
|
|
|
|
|
{
|
|
|
|
|
m_Config.useExclusiveMode = exclusive;
|
|
|
|
|
}
|
|
|
|
|
public static bool getUseExclusiveMode()
|
|
|
|
|
{
|
|
|
|
|
return m_Config.useExclusiveMode;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-21 19:39:56 +02:00
|
|
|
|
public static void setLastChecked(DateTime data)
|
|
|
|
|
{
|
|
|
|
|
m_Config.lastChecked = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DateTime getLastChecked()
|
|
|
|
|
{
|
|
|
|
|
return m_Config.lastChecked;
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
|
|
|
|
public static void setCheckWhen(int data)
|
|
|
|
|
{
|
|
|
|
|
m_Config.CheckWhen = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int getCheckWhen()
|
|
|
|
|
{
|
|
|
|
|
return m_Config.CheckWhen;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void setNotifications(bool data)
|
|
|
|
|
{
|
|
|
|
|
m_Config.notifications = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool getNotifications()
|
|
|
|
|
{
|
|
|
|
|
return m_Config.notifications;
|
|
|
|
|
}
|
2014-06-21 20:00:28 +02:00
|
|
|
|
|
|
|
|
|
public static void setDCBTatStop(bool data)
|
|
|
|
|
{
|
|
|
|
|
m_Config.disconnectBTAtStop = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool getDCBTatStop()
|
|
|
|
|
{
|
|
|
|
|
return m_Config.disconnectBTAtStop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void setSwipeProfiles(bool data)
|
|
|
|
|
{
|
|
|
|
|
m_Config.swipeProfiles = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool getSwipeProfiles()
|
|
|
|
|
{
|
|
|
|
|
return m_Config.swipeProfiles;
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
// New settings
|
|
|
|
|
public static void saveLowColor(int device, byte red, byte green, byte blue)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.m_LowLeds[device][0] = red;
|
|
|
|
|
m_Config.m_LowLeds[device][1] = green;
|
|
|
|
|
m_Config.m_LowLeds[device][2] = blue;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static DS4Color loadLowColor(int device)
|
|
|
|
|
{
|
|
|
|
|
DS4Color color = new DS4Color();
|
2014-04-29 10:01:13 +02:00
|
|
|
|
color.red = m_Config.m_LowLeds[device][0];
|
|
|
|
|
color.green = m_Config.m_LowLeds[device][1];
|
|
|
|
|
color.blue = m_Config.m_LowLeds[device][2];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
return color;
|
|
|
|
|
}
|
2014-06-02 19:29:38 +02:00
|
|
|
|
public static void saveChargingColor(int device, byte red, byte green, byte blue)
|
|
|
|
|
{
|
|
|
|
|
m_Config.m_ChargingLeds[device][0] = red;
|
|
|
|
|
m_Config.m_ChargingLeds[device][1] = green;
|
|
|
|
|
m_Config.m_ChargingLeds[device][2] = blue;
|
|
|
|
|
}
|
|
|
|
|
public static DS4Color loadChargingColor(int device)
|
|
|
|
|
{
|
|
|
|
|
DS4Color color = new DS4Color();
|
|
|
|
|
color.red = m_Config.m_ChargingLeds[device][0];
|
|
|
|
|
color.green = m_Config.m_ChargingLeds[device][1];
|
|
|
|
|
color.blue = m_Config.m_ChargingLeds[device][2];
|
|
|
|
|
return color;
|
|
|
|
|
}
|
2014-07-26 01:17:45 +02:00
|
|
|
|
public static void saveShiftColor(int device, byte red, byte green, byte blue)
|
|
|
|
|
{
|
|
|
|
|
m_Config.m_ShiftLeds[device][0] = red;
|
|
|
|
|
m_Config.m_ShiftLeds[device][1] = green;
|
|
|
|
|
m_Config.m_ShiftLeds[device][2] = blue;
|
|
|
|
|
}
|
|
|
|
|
public static DS4Color loadShiftColor(int device)
|
|
|
|
|
{
|
|
|
|
|
DS4Color color = new DS4Color();
|
|
|
|
|
color.red = m_Config.m_ShiftLeds[device][0];
|
|
|
|
|
color.green = m_Config.m_ShiftLeds[device][1];
|
|
|
|
|
color.blue = m_Config.m_ShiftLeds[device][2];
|
|
|
|
|
return color;
|
|
|
|
|
}
|
|
|
|
|
public static void setShiftColorOn(int device, bool on)
|
|
|
|
|
{
|
|
|
|
|
m_Config.shiftColorOn[device] = on;
|
|
|
|
|
}
|
|
|
|
|
public static bool getShiftColorOn(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.shiftColorOn[device];
|
|
|
|
|
}
|
2014-08-23 22:52:20 +02:00
|
|
|
|
public static void saveFlashColor(int device, byte red, byte green, byte blue)
|
|
|
|
|
{
|
|
|
|
|
m_Config.m_FlashLeds[device][0] = red;
|
|
|
|
|
m_Config.m_FlashLeds[device][1] = green;
|
|
|
|
|
m_Config.m_FlashLeds[device][2] = blue;
|
|
|
|
|
}
|
|
|
|
|
public static DS4Color loadFlashColor(int device)
|
|
|
|
|
{
|
|
|
|
|
DS4Color color = new DS4Color();
|
|
|
|
|
color.red = m_Config.m_FlashLeds[device][0];
|
|
|
|
|
color.green = m_Config.m_FlashLeds[device][1];
|
|
|
|
|
color.blue = m_Config.m_FlashLeds[device][2];
|
|
|
|
|
return color;
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
public static void setTapSensitivity(int device, byte sen)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.tapSensitivity[device] = sen;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static byte getTapSensitivity(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.tapSensitivity[device];
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
2014-04-29 03:14:01 +02:00
|
|
|
|
public static void setDoubleTap(int device, bool on)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.doubleTap[device] = on;
|
2014-04-29 03:14:01 +02:00
|
|
|
|
}
|
|
|
|
|
public static bool getDoubleTap(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.doubleTap[device];
|
2014-04-29 03:14:01 +02:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public static bool getTap(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
if (m_Config.tapSensitivity[device] == 0)
|
2014-04-27 21:32:09 +02:00
|
|
|
|
return false;
|
|
|
|
|
else
|
|
|
|
|
return true;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static void setScrollSensitivity(int device, int sen)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.scrollSensitivity[device] = sen;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static int getScrollSensitivity(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.scrollSensitivity[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public static void setLowerRCOn(int device, bool twoFingerRC)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.lowerRCOn[device] = twoFingerRC;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public static bool getLowerRCOn(int device)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.lowerRCOn[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static void setTouchpadJitterCompensation(int device, bool enabled)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.touchpadJitterCompensation[device] = enabled;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static bool getTouchpadJitterCompensation(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.touchpadJitterCompensation[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static void setStartMinimized(bool startMinimized)
|
|
|
|
|
{
|
|
|
|
|
m_Config.startMinimized = startMinimized;
|
|
|
|
|
}
|
|
|
|
|
public static bool getStartMinimized()
|
|
|
|
|
{
|
|
|
|
|
return m_Config.startMinimized;
|
|
|
|
|
}
|
|
|
|
|
public static void setFormWidth(int size)
|
|
|
|
|
{
|
|
|
|
|
m_Config.formWidth = size;
|
|
|
|
|
}
|
|
|
|
|
public static int getFormWidth()
|
|
|
|
|
{
|
|
|
|
|
return m_Config.formWidth;
|
|
|
|
|
}
|
|
|
|
|
public static void setFormHeight(int size)
|
|
|
|
|
{
|
|
|
|
|
m_Config.formHeight = size;
|
|
|
|
|
}
|
|
|
|
|
public static int getFormHeight()
|
|
|
|
|
{
|
|
|
|
|
return m_Config.formHeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static double getLeftTriggerMiddle(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.m_LeftTriggerMiddle[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-05-21 23:42:25 +02:00
|
|
|
|
public static void setLeftTriggerMiddle(int device, byte value)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.m_LeftTriggerMiddle[device] = value;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static double getRightTriggerMiddle(int device)
|
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
return m_Config.m_RightTriggerMiddle[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-05-21 23:42:25 +02:00
|
|
|
|
public static void setRightTriggerMiddle(int device, byte value)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-29 10:01:13 +02:00
|
|
|
|
m_Config.m_RightTriggerMiddle[device] = value;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-06-26 20:02:01 +02:00
|
|
|
|
public static double getSXDeadzone(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.SXDeadzone[device];
|
|
|
|
|
}
|
|
|
|
|
public static void setSXDeadzone(int device, double value)
|
|
|
|
|
{
|
|
|
|
|
m_Config.SXDeadzone[device] = value;
|
|
|
|
|
}
|
|
|
|
|
public static double getSZDeadzone(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.SZDeadzone[device];
|
|
|
|
|
}
|
|
|
|
|
public static void setSZDeadzone(int device, double value)
|
|
|
|
|
{
|
|
|
|
|
m_Config.SZDeadzone[device] = value;
|
|
|
|
|
}
|
2014-05-21 23:42:25 +02:00
|
|
|
|
public static byte getLSDeadzone(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.LSDeadzone[device];
|
|
|
|
|
}
|
|
|
|
|
public static void setLSDeadzone(int device, byte value)
|
|
|
|
|
{
|
|
|
|
|
m_Config.LSDeadzone[device] = value;
|
|
|
|
|
}
|
|
|
|
|
public static byte getRSDeadzone(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.RSDeadzone[device];
|
|
|
|
|
}
|
|
|
|
|
public static void setRSDeadzone(int device, byte value)
|
|
|
|
|
{
|
|
|
|
|
m_Config.RSDeadzone[device] = value;
|
|
|
|
|
}
|
2014-06-26 20:02:01 +02:00
|
|
|
|
public static bool getMouseAccel(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.mouseAccel[device];
|
|
|
|
|
}
|
|
|
|
|
public static void setMouseAccel(int device, bool value)
|
|
|
|
|
{
|
|
|
|
|
m_Config.mouseAccel[device] = value;
|
|
|
|
|
}
|
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
|
|
|
|
public static int getShiftModifier (int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.shiftModifier[device];
|
|
|
|
|
}
|
|
|
|
|
public static void setShiftModifier(int device, int value)
|
|
|
|
|
{
|
|
|
|
|
m_Config.shiftModifier[device] = value;
|
|
|
|
|
}
|
2014-07-26 01:17:45 +02:00
|
|
|
|
public static string getLaunchProgram(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.launchProgram[device];
|
|
|
|
|
}
|
|
|
|
|
public static void setLaunchProgram(int device, string value)
|
|
|
|
|
{
|
|
|
|
|
m_Config.launchProgram[device] = value;
|
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public static void setAProfile(int device, string filepath)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
m_Config.profilePath[device] = appdatapath + @"\Profiles\" + filepath + ".xml";
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public static string getAProfile(int device)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
return m_Config.profilePath[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public static X360Controls getCustomButton(int device, DS4Controls controlName)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
return m_Config.GetCustomButton(device, controlName);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public static ushort getCustomKey(int device, DS4Controls controlName)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
return m_Config.GetCustomKey(device, controlName);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-05-28 04:49:58 +02:00
|
|
|
|
public static string getCustomMacro(int device, DS4Controls controlName)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.GetCustomMacro(device, controlName);
|
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public static DS4KeyType getCustomKeyType(int device, DS4Controls controlName)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-27 21:32:09 +02:00
|
|
|
|
return m_Config.GetCustomKeyType(device, controlName);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
public static bool getHasCustomKeysorButtons(int device)
|
|
|
|
|
{
|
2014-04-29 11:19:00 +02:00
|
|
|
|
return m_Config.customMapButtons[device].Count > 0
|
|
|
|
|
|| m_Config.customMapKeys[device].Count > 0;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public static Dictionary<DS4Controls, X360Controls> getCustomButtons(int device)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-29 11:19:00 +02:00
|
|
|
|
return m_Config.customMapButtons[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public static Dictionary<DS4Controls, ushort> getCustomKeys(int device)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-29 11:19:00 +02:00
|
|
|
|
return m_Config.customMapKeys[device];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-05-28 04:49:58 +02:00
|
|
|
|
public static Dictionary<DS4Controls, string> getCustomMacros(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.customMapMacros[device];
|
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public static Dictionary<DS4Controls, DS4KeyType> getCustomKeyTypes(int device)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-29 11:19:00 +02:00
|
|
|
|
return m_Config.customMapKeyTypes[device];
|
2014-03-28 02:50:40 +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
|
|
|
|
|
|
|
|
|
public static X360Controls getShiftCustomButton(int device, DS4Controls controlName)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.GetShiftCustomButton(device, controlName);
|
|
|
|
|
}
|
|
|
|
|
public static ushort getShiftCustomKey(int device, DS4Controls controlName)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.GetShiftCustomKey(device, controlName);
|
|
|
|
|
}
|
|
|
|
|
public static string getShiftCustomMacro(int device, DS4Controls controlName)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.GetShiftCustomMacro(device, controlName);
|
|
|
|
|
}
|
|
|
|
|
public static DS4KeyType getShiftCustomKeyType(int device, DS4Controls controlName)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.GetShiftCustomKeyType(device, controlName);
|
|
|
|
|
}
|
|
|
|
|
public static bool getHasShiftCustomKeysorButtons(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.shiftCustomMapButtons[device].Count > 0
|
|
|
|
|
|| m_Config.shiftCustomMapKeys[device].Count > 0;
|
|
|
|
|
}
|
|
|
|
|
public static Dictionary<DS4Controls, X360Controls> getShiftCustomButtons(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.shiftCustomMapButtons[device];
|
|
|
|
|
}
|
|
|
|
|
public static Dictionary<DS4Controls, ushort> getShiftCustomKeys(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.shiftCustomMapKeys[device];
|
|
|
|
|
}
|
|
|
|
|
public static Dictionary<DS4Controls, string> getShiftCustomMacros(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.shiftCustomMapMacros[device];
|
|
|
|
|
}
|
|
|
|
|
public static Dictionary<DS4Controls, DS4KeyType> getShiftCustomKeyTypes(int device)
|
|
|
|
|
{
|
|
|
|
|
return m_Config.shiftCustomMapKeyTypes[device];
|
|
|
|
|
}
|
2014-04-29 11:19:00 +02:00
|
|
|
|
public static bool Load()
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-29 11:19:00 +02:00
|
|
|
|
return m_Config.Load();
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-09-15 04:37:14 +02:00
|
|
|
|
public static void LoadProfile(int device, System.Windows.Forms.Control[] buttons, System.Windows.Forms.Control[] shiftbuttons, bool launchprogram, Control control)
|
2014-04-27 21:32:09 +02:00
|
|
|
|
{
|
2014-09-15 04:37:14 +02:00
|
|
|
|
m_Config.LoadProfile(device, buttons, shiftbuttons, launchprogram, control);
|
|
|
|
|
tempprofilename[device] = string.Empty;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
2014-09-15 04:37:14 +02:00
|
|
|
|
public static void LoadProfile(int device, bool launchprogram, Control control)
|
2014-04-27 21:32:09 +02:00
|
|
|
|
{
|
2014-09-15 04:37:14 +02:00
|
|
|
|
m_Config.LoadProfile(device, null, null, launchprogram, control);
|
|
|
|
|
tempprofilename[device] = string.Empty;
|
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
2014-09-15 04:37:14 +02:00
|
|
|
|
public static void LoadTempProfile(int device, string name, bool launchprogram, Control control)
|
2014-06-06 22:38:52 +02:00
|
|
|
|
{
|
2014-09-15 04:37:14 +02:00
|
|
|
|
m_Config.LoadProfile(device, null, null, launchprogram, control, appdatapath + @"\Profiles\" + name + ".xml");
|
|
|
|
|
tempprofilename[device] = name;
|
2014-06-06 22:38:52 +02:00
|
|
|
|
}
|
2014-06-12 20:46:00 +02:00
|
|
|
|
public static bool Save()
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-06-12 20:46:00 +02:00
|
|
|
|
return m_Config.Save();
|
2014-03-28 02:50:40 +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
|
|
|
|
public static void SaveProfile(int device, string propath, System.Windows.Forms.Control[] buttons, System.Windows.Forms.Control[] shiftbuttons)
|
2014-04-27 21:32:09 +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
|
|
|
|
m_Config.SaveProfile(device, propath, buttons, shiftbuttons);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-02 19:29:38 +02:00
|
|
|
|
private static byte applyRatio(byte b1, byte b2, double r)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-06-02 19:29:38 +02:00
|
|
|
|
if (r > 100)
|
|
|
|
|
r = 100;
|
|
|
|
|
else if (r < 0)
|
|
|
|
|
r = 0;
|
|
|
|
|
uint ratio = (uint)r;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
if (b1 > b2)
|
|
|
|
|
{
|
2014-06-02 19:29:38 +02:00
|
|
|
|
ratio = 100 - (uint)r;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
byte bmax = Math.Max(b1, b2);
|
|
|
|
|
byte bmin = Math.Min(b1, b2);
|
|
|
|
|
byte bdif = (byte)(bmax - bmin);
|
|
|
|
|
return (byte)(bmin + (bdif * ratio / 100));
|
|
|
|
|
}
|
2014-06-02 19:29:38 +02:00
|
|
|
|
public static DS4Color getTransitionedColor(DS4Color c1, DS4Color c2, double ratio)
|
2014-09-02 01:23:02 +02:00
|
|
|
|
{//;
|
|
|
|
|
//Color cs = Color.FromArgb(c1.red, c1.green, c1.blue);
|
2014-03-29 06:29:08 +01:00
|
|
|
|
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;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-05-28 21:47:25 +02:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class BackingStore
|
|
|
|
|
{
|
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
|
|
|
|
//public String m_Profile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool" + "\\Profiles.xml";
|
|
|
|
|
public String m_Profile = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + "\\Profiles.xml";
|
2014-03-28 02:50:40 +01:00
|
|
|
|
protected XmlDocument m_Xdoc = new XmlDocument();
|
2014-05-30 22:39:39 +02:00
|
|
|
|
//fifth value used to for options, not fifth controller
|
|
|
|
|
public int[] buttonMouseSensitivity = { 25, 25, 25, 25, 25 };
|
2014-09-15 04:37:14 +02:00
|
|
|
|
|
|
|
|
|
public bool[] flushHIDQueue = { true, true, true, true, true };
|
|
|
|
|
public int[] idleDisconnectTimeout = { 0, 0, 0, 0, 0 };
|
|
|
|
|
public Boolean[] touchpadJitterCompensation = { true, true, true, true, true };
|
2014-05-30 22:39:39 +02:00
|
|
|
|
public Boolean[] lowerRCOn = { false, false, false, false, false };
|
|
|
|
|
public Boolean[] ledAsBattery = { false, false, false, false, false };
|
|
|
|
|
public Boolean[] flashLedLowBattery = { false, false, false, false, false };
|
|
|
|
|
public Byte[] m_LeftTriggerMiddle = { 0, 0, 0, 0, 0}, m_RightTriggerMiddle = { 0, 0, 0, 0, 0};
|
|
|
|
|
public String[] profilePath = { String.Empty, String.Empty, String.Empty, String.Empty, String.Empty };
|
|
|
|
|
public Byte[] m_Rumble = { 100, 100, 100, 100, 100 };
|
|
|
|
|
public Byte[] touchSensitivity = { 100, 100, 100, 100, 100 };
|
2014-06-26 20:02:01 +02:00
|
|
|
|
public Byte[] LSDeadzone = { 0, 0, 0, 0, 0 }, RSDeadzone = { 0, 0, 0, 0, 0 };
|
|
|
|
|
public double[] SXDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 }, SZDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 };
|
2014-05-30 22:39:39 +02:00
|
|
|
|
public Byte[] tapSensitivity = { 0, 0, 0, 0, 0 };
|
|
|
|
|
public bool[] doubleTap = { false, false, false, false, false };
|
|
|
|
|
public int[] scrollSensitivity = { 0, 0, 0, 0, 0 };
|
|
|
|
|
public double[] rainbow = { 0, 0, 0, 0, 0 };
|
2014-09-15 04:37:14 +02:00
|
|
|
|
public int[] flashAt = { 0, 0, 0, 0, 0 };
|
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
|
|
|
|
public int[] shiftModifier = { 0, 0, 0, 0, 0 };
|
2014-06-26 20:02:01 +02:00
|
|
|
|
public bool[] mouseAccel = { true, true, true, true, true };
|
2014-04-29 10:01:13 +02:00
|
|
|
|
public Byte[][] m_LowLeds = new Byte[][]
|
|
|
|
|
{
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0},
|
2014-05-30 22:39:39 +02:00
|
|
|
|
new Byte[] {0,0,0},
|
2014-04-29 10:01:13 +02:00
|
|
|
|
new Byte[] {0,0,0}
|
|
|
|
|
};
|
|
|
|
|
public Byte[][] m_Leds = new Byte[][]
|
|
|
|
|
{
|
|
|
|
|
new Byte[] {0,0,255},
|
|
|
|
|
new Byte[] {255,0,0},
|
|
|
|
|
new Byte[] {0,255,0},
|
|
|
|
|
new Byte[] {255,0,255},
|
2014-05-30 22:39:39 +02:00
|
|
|
|
new Byte[] {255,255,255}
|
2014-04-29 10:01:13 +02:00
|
|
|
|
};
|
2014-06-02 19:29:38 +02:00
|
|
|
|
public Byte[][] m_ChargingLeds = new Byte[][]
|
|
|
|
|
{
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0}
|
|
|
|
|
};
|
2014-07-26 01:17:45 +02:00
|
|
|
|
public Byte[][] m_ShiftLeds = new Byte[][]
|
|
|
|
|
{
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0}
|
|
|
|
|
};
|
2014-08-23 22:52:20 +02:00
|
|
|
|
public Byte[][] m_FlashLeds = new Byte[][]
|
|
|
|
|
{
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0},
|
|
|
|
|
new Byte[] {0,0,0}
|
|
|
|
|
};
|
2014-07-26 01:17:45 +02:00
|
|
|
|
public bool[] shiftColorOn = { false, false, false, false, false };
|
2014-06-02 19:29:38 +02:00
|
|
|
|
public int[] chargingType = { 0, 0, 0, 0, 0 };
|
2014-07-26 01:17:45 +02:00
|
|
|
|
public string[] launchProgram = { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
2014-08-23 22:52:20 +02:00
|
|
|
|
public bool[] dinputOnly = { false, false, false, false, false };
|
2014-09-15 04:37:14 +02:00
|
|
|
|
public bool[] startTouchpadOff = { false, false, false, false, false };
|
2014-03-28 02:50:40 +01:00
|
|
|
|
public Boolean useExclusiveMode = false;
|
|
|
|
|
public Int32 formWidth = 782;
|
|
|
|
|
public Int32 formHeight = 550;
|
|
|
|
|
public Boolean startMinimized = false;
|
2014-05-21 19:39:56 +02:00
|
|
|
|
public DateTime lastChecked;
|
2014-06-06 22:38:52 +02:00
|
|
|
|
public int CheckWhen = 1;
|
|
|
|
|
public bool notifications = true;
|
2014-06-21 20:00:28 +02:00
|
|
|
|
public bool disconnectBTAtStop = false;
|
|
|
|
|
public bool swipeProfiles = true;
|
2014-06-06 22:38:52 +02:00
|
|
|
|
public Dictionary<DS4Controls, DS4KeyType>[] customMapKeyTypes = { null, null, null, null, null };
|
2014-05-30 22:39:39 +02:00
|
|
|
|
public Dictionary<DS4Controls, UInt16>[] customMapKeys = { null, null, null, null, null };
|
|
|
|
|
public Dictionary<DS4Controls, String>[] customMapMacros = { null, null, null, null, null };
|
|
|
|
|
public Dictionary<DS4Controls, X360Controls>[] customMapButtons = { null, null, null, null, null };
|
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
|
|
|
|
|
|
|
|
|
public Dictionary<DS4Controls, DS4KeyType>[] shiftCustomMapKeyTypes = { null, null, null, null, null };
|
|
|
|
|
public Dictionary<DS4Controls, UInt16>[] shiftCustomMapKeys = { null, null, null, null, null };
|
|
|
|
|
public Dictionary<DS4Controls, String>[] shiftCustomMapMacros = { null, null, null, null, null };
|
|
|
|
|
public Dictionary<DS4Controls, X360Controls>[] shiftCustomMapButtons = { null, null, null, null, null };
|
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public BackingStore()
|
|
|
|
|
{
|
2014-05-30 22:39:39 +02:00
|
|
|
|
for (int i = 0; i < 5; i++)
|
2014-04-27 21:32:09 +02:00
|
|
|
|
{
|
2014-05-21 23:42:25 +02:00
|
|
|
|
customMapKeyTypes[i] = new Dictionary<DS4Controls, DS4KeyType>();
|
|
|
|
|
customMapKeys[i] = new Dictionary<DS4Controls, UInt16>();
|
2014-05-28 04:49:58 +02:00
|
|
|
|
customMapMacros[i] = new Dictionary<DS4Controls, String>();
|
2014-05-21 23:42:25 +02:00
|
|
|
|
customMapButtons[i] = new Dictionary<DS4Controls, X360Controls>();
|
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
|
|
|
|
|
|
|
|
|
shiftCustomMapKeyTypes[i] = new Dictionary<DS4Controls, DS4KeyType>();
|
|
|
|
|
shiftCustomMapKeys[i] = new Dictionary<DS4Controls, UInt16>();
|
|
|
|
|
shiftCustomMapMacros[i] = new Dictionary<DS4Controls, String>();
|
|
|
|
|
shiftCustomMapButtons[i] = new Dictionary<DS4Controls, X360Controls>();
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public X360Controls GetCustomButton(int device, DS4Controls controlName)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-29 11:19:00 +02:00
|
|
|
|
if (customMapButtons[device].ContainsKey(controlName))
|
|
|
|
|
return customMapButtons[device][controlName];
|
2014-04-27 21:32:09 +02:00
|
|
|
|
else return X360Controls.None;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public UInt16 GetCustomKey(int device, DS4Controls controlName)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-04-29 11:19:00 +02:00
|
|
|
|
if (customMapKeys[device].ContainsKey(controlName))
|
|
|
|
|
return customMapKeys[device][controlName];
|
2014-03-28 02:50:40 +01:00
|
|
|
|
else return 0;
|
|
|
|
|
}
|
2014-05-28 04:49:58 +02:00
|
|
|
|
public string GetCustomMacro(int device, DS4Controls controlName)
|
|
|
|
|
{
|
|
|
|
|
if (customMapMacros[device].ContainsKey(controlName))
|
|
|
|
|
return customMapMacros[device][controlName];
|
|
|
|
|
else return "0";
|
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public DS4KeyType GetCustomKeyType(int device, DS4Controls controlName)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-06-03 07:29:42 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (customMapKeyTypes[device].ContainsKey(controlName))
|
|
|
|
|
return customMapKeyTypes[device][controlName];
|
|
|
|
|
else return 0;
|
|
|
|
|
}
|
|
|
|
|
catch { return 0; }
|
2014-03-28 02:50:40 +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
|
|
|
|
public X360Controls GetShiftCustomButton(int device, DS4Controls controlName)
|
|
|
|
|
{
|
|
|
|
|
if (shiftCustomMapButtons[device].ContainsKey(controlName))
|
|
|
|
|
return shiftCustomMapButtons[device][controlName];
|
|
|
|
|
else return X360Controls.None;
|
|
|
|
|
}
|
|
|
|
|
public UInt16 GetShiftCustomKey(int device, DS4Controls controlName)
|
|
|
|
|
{
|
|
|
|
|
if (shiftCustomMapKeys[device].ContainsKey(controlName))
|
|
|
|
|
return shiftCustomMapKeys[device][controlName];
|
|
|
|
|
else return 0;
|
|
|
|
|
}
|
|
|
|
|
public string GetShiftCustomMacro(int device, DS4Controls controlName)
|
|
|
|
|
{
|
|
|
|
|
if (shiftCustomMapMacros[device].ContainsKey(controlName))
|
|
|
|
|
return shiftCustomMapMacros[device][controlName];
|
|
|
|
|
else return "0";
|
|
|
|
|
}
|
|
|
|
|
public DS4KeyType GetShiftCustomKeyType(int device, DS4Controls controlName)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (shiftCustomMapKeyTypes[device].ContainsKey(controlName))
|
|
|
|
|
return shiftCustomMapKeyTypes[device][controlName];
|
|
|
|
|
else return 0;
|
|
|
|
|
}
|
|
|
|
|
catch { return 0; }
|
|
|
|
|
}
|
2014-04-29 10:22:37 +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
|
|
|
|
public Boolean SaveProfile(int device, String propath, System.Windows.Forms.Control[] buttons, System.Windows.Forms.Control[] shiftbuttons)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
|
|
|
|
Boolean Saved = true;
|
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 path = Global.appdatapath + @"\Profiles\" + Path.GetFileNameWithoutExtension(propath) + ".xml";
|
2014-03-28 02:50:40 +01:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
XmlNode Node;
|
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
|
|
|
|
XmlNode xmlControls = m_Xdoc.SelectSingleNode("/ScpControl/Control");
|
|
|
|
|
XmlNode xmlShiftControls = m_Xdoc.SelectSingleNode("/ScpControl/ShiftControl");
|
2014-03-28 02:50:40 +01:00
|
|
|
|
m_Xdoc.RemoveAll();
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
Node = m_Xdoc.CreateXmlDeclaration("1.0", "utf-8", String.Empty);
|
|
|
|
|
m_Xdoc.AppendChild(Node);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
Node = m_Xdoc.CreateComment(String.Format(" ScpControl Configuration Data. {0} ", DateTime.Now));
|
2014-03-28 02:50:40 +01:00
|
|
|
|
m_Xdoc.AppendChild(Node);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
Node = m_Xdoc.CreateWhitespace("\r\n");
|
|
|
|
|
m_Xdoc.AppendChild(Node);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
Node = m_Xdoc.CreateNode(XmlNodeType.Element, "ScpControl", null);
|
|
|
|
|
|
2014-04-29 10:22:37 +02:00
|
|
|
|
XmlNode xmlFlushHIDQueue = m_Xdoc.CreateNode(XmlNodeType.Element, "flushHIDQueue", null); xmlFlushHIDQueue.InnerText = flushHIDQueue[device].ToString(); Node.AppendChild(xmlFlushHIDQueue);
|
|
|
|
|
XmlNode xmlIdleDisconnectTimeout = m_Xdoc.CreateNode(XmlNodeType.Element, "idleDisconnectTimeout", null); xmlIdleDisconnectTimeout.InnerText = idleDisconnectTimeout[device].ToString(); Node.AppendChild(xmlIdleDisconnectTimeout);
|
2014-06-26 20:02:01 +02:00
|
|
|
|
XmlNode xmlColor = m_Xdoc.CreateNode(XmlNodeType.Element, "Color", null);
|
|
|
|
|
xmlColor.InnerText = m_Leds[device][0].ToString() + "," + m_Leds[device][1].ToString() + "," + m_Leds[device][2].ToString();
|
|
|
|
|
Node.AppendChild(xmlColor);
|
2014-04-29 10:22:37 +02:00
|
|
|
|
XmlNode xmlRumbleBoost = m_Xdoc.CreateNode(XmlNodeType.Element, "RumbleBoost", null); xmlRumbleBoost.InnerText = m_Rumble[device].ToString(); Node.AppendChild(xmlRumbleBoost);
|
|
|
|
|
XmlNode xmlLedAsBatteryIndicator = m_Xdoc.CreateNode(XmlNodeType.Element, "ledAsBatteryIndicator", null); xmlLedAsBatteryIndicator.InnerText = ledAsBattery[device].ToString(); Node.AppendChild(xmlLedAsBatteryIndicator);
|
|
|
|
|
XmlNode xmlLowBatteryFlash = m_Xdoc.CreateNode(XmlNodeType.Element, "lowBatteryFlash", null); xmlLowBatteryFlash.InnerText = flashLedLowBattery[device].ToString(); Node.AppendChild(xmlLowBatteryFlash);
|
2014-05-31 06:37:02 +02:00
|
|
|
|
XmlNode xmlFlashBatterAt = m_Xdoc.CreateNode(XmlNodeType.Element, "flashBatteryAt", null); xmlFlashBatterAt.InnerText = flashAt[device].ToString(); Node.AppendChild(xmlFlashBatterAt);
|
2014-04-29 10:22:37 +02:00
|
|
|
|
XmlNode xmlTouchSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "touchSensitivity", null); xmlTouchSensitivity.InnerText = touchSensitivity[device].ToString(); Node.AppendChild(xmlTouchSensitivity);
|
2014-06-26 20:02:01 +02:00
|
|
|
|
XmlNode xmlLowColor = m_Xdoc.CreateNode(XmlNodeType.Element, "LowColor", null);
|
|
|
|
|
xmlLowColor.InnerText = m_LowLeds[device][0].ToString() + "," + m_LowLeds[device][1].ToString() + "," + m_LowLeds[device][2].ToString();
|
|
|
|
|
Node.AppendChild(xmlLowColor);
|
|
|
|
|
XmlNode xmlChargingColor = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingColor", null);
|
|
|
|
|
xmlChargingColor.InnerText = m_ChargingLeds[device][0].ToString() + "," + m_ChargingLeds[device][1].ToString() + "," + m_ChargingLeds[device][2].ToString();
|
|
|
|
|
Node.AppendChild(xmlChargingColor);
|
2014-07-26 01:17:45 +02:00
|
|
|
|
XmlNode xmlShiftColor = m_Xdoc.CreateNode(XmlNodeType.Element, "ShiftColor", null);
|
|
|
|
|
xmlShiftColor.InnerText = m_ShiftLeds[device][0].ToString() + "," + m_ShiftLeds[device][1].ToString() + "," + m_ShiftLeds[device][2].ToString();
|
|
|
|
|
Node.AppendChild(xmlShiftColor);
|
|
|
|
|
XmlNode xmlShiftColorOn = m_Xdoc.CreateNode(XmlNodeType.Element, "ShiftColorOn", null); xmlShiftColorOn.InnerText = shiftColorOn[device].ToString(); Node.AppendChild(xmlShiftColorOn);
|
2014-08-23 22:52:20 +02:00
|
|
|
|
XmlNode xmlFlashColor = m_Xdoc.CreateNode(XmlNodeType.Element, "FlashColor", null);
|
|
|
|
|
xmlFlashColor.InnerText = m_FlashLeds[device][0].ToString() + "," + m_FlashLeds[device][1].ToString() + "," + m_FlashLeds[device][2].ToString();
|
|
|
|
|
Node.AppendChild(xmlFlashColor);
|
2014-04-29 10:22:37 +02:00
|
|
|
|
XmlNode xmlTouchpadJitterCompensation = m_Xdoc.CreateNode(XmlNodeType.Element, "touchpadJitterCompensation", null); xmlTouchpadJitterCompensation.InnerText = touchpadJitterCompensation[device].ToString(); Node.AppendChild(xmlTouchpadJitterCompensation);
|
|
|
|
|
XmlNode xmlLowerRCOn = m_Xdoc.CreateNode(XmlNodeType.Element, "lowerRCOn", null); xmlLowerRCOn.InnerText = lowerRCOn[device].ToString(); Node.AppendChild(xmlLowerRCOn);
|
|
|
|
|
XmlNode xmlTapSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "tapSensitivity", null); xmlTapSensitivity.InnerText = tapSensitivity[device].ToString(); Node.AppendChild(xmlTapSensitivity);
|
|
|
|
|
XmlNode xmlDouble = m_Xdoc.CreateNode(XmlNodeType.Element, "doubleTap", null); xmlDouble.InnerText = doubleTap[device].ToString(); Node.AppendChild(xmlDouble);
|
|
|
|
|
XmlNode xmlScrollSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "scrollSensitivity", null); xmlScrollSensitivity.InnerText = scrollSensitivity[device].ToString(); Node.AppendChild(xmlScrollSensitivity);
|
|
|
|
|
XmlNode xmlLeftTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "LeftTriggerMiddle", null); xmlLeftTriggerMiddle.InnerText = m_LeftTriggerMiddle[device].ToString(); Node.AppendChild(xmlLeftTriggerMiddle);
|
|
|
|
|
XmlNode xmlRightTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "RightTriggerMiddle", null); xmlRightTriggerMiddle.InnerText = m_RightTriggerMiddle[device].ToString(); Node.AppendChild(xmlRightTriggerMiddle);
|
2014-04-29 23:56:58 +02:00
|
|
|
|
XmlNode xmlButtonMouseSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "ButtonMouseSensitivity", null); xmlButtonMouseSensitivity.InnerText = buttonMouseSensitivity[device].ToString(); Node.AppendChild(xmlButtonMouseSensitivity);
|
2014-04-30 21:32:44 +02:00
|
|
|
|
XmlNode xmlRainbow = m_Xdoc.CreateNode(XmlNodeType.Element, "Rainbow", null); xmlRainbow.InnerText = rainbow[device].ToString(); Node.AppendChild(xmlRainbow);
|
2014-05-21 23:42:25 +02:00
|
|
|
|
XmlNode xmlLSD = m_Xdoc.CreateNode(XmlNodeType.Element, "LSDeadZone", null); xmlLSD.InnerText = LSDeadzone[device].ToString(); Node.AppendChild(xmlLSD);
|
|
|
|
|
XmlNode xmlRSD = m_Xdoc.CreateNode(XmlNodeType.Element, "RSDeadZone", null); xmlRSD.InnerText = RSDeadzone[device].ToString(); Node.AppendChild(xmlRSD);
|
2014-06-26 20:02:01 +02:00
|
|
|
|
XmlNode xmlSXD = m_Xdoc.CreateNode(XmlNodeType.Element, "SXDeadZone", null); xmlSXD.InnerText = SXDeadzone[device].ToString(); Node.AppendChild(xmlSXD);
|
|
|
|
|
XmlNode xmlSZD = m_Xdoc.CreateNode(XmlNodeType.Element, "SZDeadZone", null); xmlSZD.InnerText = SZDeadzone[device].ToString(); Node.AppendChild(xmlSZD);
|
2014-06-02 19:29:38 +02:00
|
|
|
|
XmlNode xmlChargingType = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingType", null); xmlChargingType.InnerText = chargingType[device].ToString(); Node.AppendChild(xmlChargingType);
|
2014-06-26 20:02:01 +02:00
|
|
|
|
XmlNode xmlMouseAccel = m_Xdoc.CreateNode(XmlNodeType.Element, "MouseAcceleration", null); xmlMouseAccel.InnerText = mouseAccel[device].ToString(); Node.AppendChild(xmlMouseAccel);
|
2014-07-26 01:17:45 +02:00
|
|
|
|
XmlNode xmlShiftMod = m_Xdoc.CreateNode(XmlNodeType.Element, "ShiftModifier", null); xmlShiftMod.InnerText = shiftModifier[device].ToString(); Node.AppendChild(xmlShiftMod);
|
2014-08-23 22:52:20 +02:00
|
|
|
|
XmlNode xmlLaunchProgram = m_Xdoc.CreateNode(XmlNodeType.Element, "LaunchProgram", null); xmlLaunchProgram.InnerText = launchProgram[device].ToString(); Node.AppendChild(xmlLaunchProgram);
|
|
|
|
|
XmlNode xmlDinput = m_Xdoc.CreateNode(XmlNodeType.Element, "DinputOnly", null); xmlDinput.InnerText = dinputOnly[device].ToString(); Node.AppendChild(xmlDinput);
|
2014-09-15 04:37:14 +02:00
|
|
|
|
XmlNode xmlStartTouchpadOff = m_Xdoc.CreateNode(XmlNodeType.Element, "StartTouchpadOff", null); xmlStartTouchpadOff.InnerText = startTouchpadOff[device].ToString(); Node.AppendChild(xmlStartTouchpadOff);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
XmlNode NodeControl = m_Xdoc.CreateNode(XmlNodeType.Element, "Control", null);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
|
|
|
|
XmlNode Key = m_Xdoc.CreateNode(XmlNodeType.Element, "Key", null);
|
2014-05-28 04:49:58 +02:00
|
|
|
|
XmlNode Macro = m_Xdoc.CreateNode(XmlNodeType.Element, "Macro", null);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
XmlNode KeyType = m_Xdoc.CreateNode(XmlNodeType.Element, "KeyType", null);
|
|
|
|
|
XmlNode Button = m_Xdoc.CreateNode(XmlNodeType.Element, "Button", null);
|
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 (buttons != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var button in buttons)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
|
|
|
|
// Save even if string (for xbox controller buttons)
|
|
|
|
|
if (button.Tag != null)
|
|
|
|
|
{
|
|
|
|
|
XmlNode buttonNode;
|
|
|
|
|
string keyType = String.Empty;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
if (button.Tag is String && (String)button.Tag == "Unbound")
|
|
|
|
|
{
|
|
|
|
|
keyType += DS4KeyType.Unbound;
|
|
|
|
|
}
|
|
|
|
|
{
|
2014-06-14 21:14:27 +02:00
|
|
|
|
if (button.Font.Strikeout)
|
|
|
|
|
keyType += DS4KeyType.HoldMacro;
|
2014-05-28 04:49:58 +02:00
|
|
|
|
if (button.Font.Underline)
|
|
|
|
|
keyType += DS4KeyType.Macro;
|
|
|
|
|
if (button.Font.Italic)
|
|
|
|
|
keyType += DS4KeyType.Toggle;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
if (button.Font.Bold)
|
|
|
|
|
keyType += DS4KeyType.ScanCode;
|
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
if (keyType != String.Empty)
|
|
|
|
|
{
|
|
|
|
|
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
|
|
|
|
buttonNode.InnerText = keyType;
|
|
|
|
|
KeyType.AppendChild(buttonNode);
|
|
|
|
|
}
|
|
|
|
|
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
|
|
|
|
buttonNode.InnerText = button.Tag.ToString();
|
2014-05-28 04:49:58 +02:00
|
|
|
|
if (button.Tag is IEnumerable<int> || button.Tag is Int32[] || button.Tag is UInt16[])
|
|
|
|
|
{
|
|
|
|
|
buttonNode.InnerText = string.Join("/", (int[])button.Tag);
|
|
|
|
|
Macro.AppendChild(buttonNode);
|
|
|
|
|
}
|
|
|
|
|
else if (button.Tag is Int32 || button.Tag is UInt16)
|
2014-03-28 02:50:40 +01:00
|
|
|
|
Key.AppendChild(buttonNode);
|
|
|
|
|
else Button.AppendChild(buttonNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
Node.AppendChild(NodeControl);
|
|
|
|
|
if (Button.HasChildNodes)
|
|
|
|
|
NodeControl.AppendChild(Button);
|
|
|
|
|
if (Macro.HasChildNodes)
|
|
|
|
|
NodeControl.AppendChild(Macro);
|
|
|
|
|
if (Key.HasChildNodes)
|
|
|
|
|
NodeControl.AppendChild(Key);
|
|
|
|
|
if (KeyType.HasChildNodes)
|
|
|
|
|
NodeControl.AppendChild(KeyType);
|
|
|
|
|
}
|
|
|
|
|
else if (xmlControls != null)
|
|
|
|
|
Node.AppendChild(xmlControls);
|
|
|
|
|
if (shiftModifier[device] > 0)
|
|
|
|
|
{
|
|
|
|
|
XmlNode NodeShiftControl = m_Xdoc.CreateNode(XmlNodeType.Element, "ShiftControl", null);
|
|
|
|
|
|
|
|
|
|
XmlNode ShiftKey = m_Xdoc.CreateNode(XmlNodeType.Element, "Key", null);
|
|
|
|
|
XmlNode ShiftMacro = m_Xdoc.CreateNode(XmlNodeType.Element, "Macro", null);
|
|
|
|
|
XmlNode ShiftKeyType = m_Xdoc.CreateNode(XmlNodeType.Element, "KeyType", null);
|
|
|
|
|
XmlNode ShiftButton = m_Xdoc.CreateNode(XmlNodeType.Element, "Button", null);
|
|
|
|
|
if (shiftbuttons != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var button in shiftbuttons)
|
|
|
|
|
{
|
|
|
|
|
// Save even if string (for xbox controller buttons)
|
|
|
|
|
if (button.Tag != null)
|
|
|
|
|
{
|
|
|
|
|
XmlNode buttonNode;
|
|
|
|
|
string keyType = String.Empty;
|
|
|
|
|
if (button.Tag is String && (String)button.Tag == "Unbound")
|
|
|
|
|
{
|
|
|
|
|
keyType += DS4KeyType.Unbound;
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
if (button.Font.Strikeout)
|
|
|
|
|
keyType += DS4KeyType.HoldMacro;
|
|
|
|
|
if (button.Font.Underline)
|
|
|
|
|
keyType += DS4KeyType.Macro;
|
|
|
|
|
if (button.Font.Italic)
|
|
|
|
|
keyType += DS4KeyType.Toggle;
|
|
|
|
|
if (button.Font.Bold)
|
|
|
|
|
keyType += DS4KeyType.ScanCode;
|
|
|
|
|
}
|
|
|
|
|
if (keyType != String.Empty)
|
|
|
|
|
{
|
|
|
|
|
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
|
|
|
|
buttonNode.InnerText = keyType;
|
|
|
|
|
ShiftKeyType.AppendChild(buttonNode);
|
|
|
|
|
}
|
|
|
|
|
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
|
|
|
|
buttonNode.InnerText = button.Tag.ToString();
|
|
|
|
|
if (button.Tag is IEnumerable<int> || button.Tag is Int32[] || button.Tag is UInt16[])
|
|
|
|
|
{
|
|
|
|
|
buttonNode.InnerText = string.Join("/", (int[])button.Tag);
|
|
|
|
|
ShiftMacro.AppendChild(buttonNode);
|
|
|
|
|
}
|
|
|
|
|
else if (button.Tag is Int32 || button.Tag is UInt16)
|
|
|
|
|
ShiftKey.AppendChild(buttonNode);
|
|
|
|
|
else ShiftButton.AppendChild(buttonNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Node.AppendChild(NodeShiftControl);
|
|
|
|
|
if (ShiftButton.HasChildNodes)
|
|
|
|
|
NodeShiftControl.AppendChild(ShiftButton);
|
|
|
|
|
if (ShiftMacro.HasChildNodes)
|
|
|
|
|
NodeShiftControl.AppendChild(ShiftMacro);
|
|
|
|
|
if (ShiftKey.HasChildNodes)
|
|
|
|
|
NodeShiftControl.AppendChild(ShiftKey);
|
|
|
|
|
if (ShiftKeyType.HasChildNodes)
|
|
|
|
|
NodeShiftControl.AppendChild(ShiftKeyType);
|
|
|
|
|
}
|
|
|
|
|
else if (xmlShiftControls != null)
|
|
|
|
|
Node.AppendChild(xmlShiftControls);
|
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
m_Xdoc.AppendChild(Node);
|
|
|
|
|
if (NodeControl.HasChildNodes)
|
|
|
|
|
Node.AppendChild(NodeControl);
|
|
|
|
|
m_Xdoc.Save(path);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
catch { Saved = false; }
|
2014-03-28 02:50:40 +01:00
|
|
|
|
return Saved;
|
|
|
|
|
}
|
|
|
|
|
private DS4Controls getDS4ControlsByName(string key)
|
|
|
|
|
{
|
|
|
|
|
switch (key)
|
|
|
|
|
{
|
|
|
|
|
case "bnShare": return DS4Controls.Share;
|
|
|
|
|
case "bnL3": return DS4Controls.L3;
|
|
|
|
|
case "bnR3": return DS4Controls.R3;
|
|
|
|
|
case "bnOptions": return DS4Controls.Options;
|
|
|
|
|
case "bnUp": return DS4Controls.DpadUp;
|
|
|
|
|
case "bnRight": return DS4Controls.DpadRight;
|
|
|
|
|
case "bnDown": return DS4Controls.DpadDown;
|
|
|
|
|
case "bnLeft": return DS4Controls.DpadLeft;
|
|
|
|
|
|
|
|
|
|
case "bnL1": return DS4Controls.L1;
|
|
|
|
|
case "bnR1": return DS4Controls.R1;
|
|
|
|
|
case "bnTriangle": return DS4Controls.Triangle;
|
|
|
|
|
case "bnCircle": return DS4Controls.Circle;
|
|
|
|
|
case "bnCross": return DS4Controls.Cross;
|
|
|
|
|
case "bnSquare": return DS4Controls.Square;
|
|
|
|
|
|
|
|
|
|
case "bnPS": return DS4Controls.PS;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
case "bnLSLeft": return DS4Controls.LXNeg;
|
|
|
|
|
case "bnLSUp": return DS4Controls.LYNeg;
|
|
|
|
|
case "bnRSLeft": return DS4Controls.RXNeg;
|
|
|
|
|
case "bnRSUp": return DS4Controls.RYNeg;
|
|
|
|
|
|
|
|
|
|
case "bnLSRight": return DS4Controls.LXPos;
|
|
|
|
|
case "bnLSDown": return DS4Controls.LYPos;
|
|
|
|
|
case "bnRSRight": return DS4Controls.RXPos;
|
|
|
|
|
case "bnRSDown": return DS4Controls.RYPos;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
case "bnL2": return DS4Controls.L2;
|
|
|
|
|
case "bnR2": return DS4Controls.R2;
|
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
case "bnTouchLeft": return DS4Controls.TouchLeft;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
case "bnTouchMulti": return DS4Controls.TouchMulti;
|
|
|
|
|
case "bnTouchUpper": return DS4Controls.TouchUpper;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
case "bnTouchRight": return DS4Controls.TouchRight;
|
2014-06-24 00:27:14 +02:00
|
|
|
|
case "bnGyroXP": return DS4Controls.GyroXPos;
|
|
|
|
|
case "bnGyroXN": return DS4Controls.GyroXNeg;
|
|
|
|
|
case "bnGyroZP": return DS4Controls.GyroZPos;
|
|
|
|
|
case "bnGyroZN": return DS4Controls.GyroZNeg;
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "sbnShare": return DS4Controls.Share;
|
|
|
|
|
case "sbnL3": return DS4Controls.L3;
|
|
|
|
|
case "sbnR3": return DS4Controls.R3;
|
|
|
|
|
case "sbnOptions": return DS4Controls.Options;
|
|
|
|
|
case "sbnUp": return DS4Controls.DpadUp;
|
|
|
|
|
case "sbnRight": return DS4Controls.DpadRight;
|
|
|
|
|
case "sbnDown": return DS4Controls.DpadDown;
|
|
|
|
|
case "sbnLeft": return DS4Controls.DpadLeft;
|
|
|
|
|
|
|
|
|
|
case "sbnL1": return DS4Controls.L1;
|
|
|
|
|
case "sbnR1": return DS4Controls.R1;
|
|
|
|
|
case "sbnTriangle": return DS4Controls.Triangle;
|
|
|
|
|
case "sbnCircle": return DS4Controls.Circle;
|
|
|
|
|
case "sbnCross": return DS4Controls.Cross;
|
|
|
|
|
case "sbnSquare": return DS4Controls.Square;
|
|
|
|
|
|
|
|
|
|
case "sbnPS": return DS4Controls.PS;
|
|
|
|
|
case "sbnLSLeft": return DS4Controls.LXNeg;
|
|
|
|
|
case "sbnLSUp": return DS4Controls.LYNeg;
|
|
|
|
|
case "sbnRSLeft": return DS4Controls.RXNeg;
|
|
|
|
|
case "sbnRSUp": return DS4Controls.RYNeg;
|
|
|
|
|
|
|
|
|
|
case "sbnLSRight": return DS4Controls.LXPos;
|
|
|
|
|
case "sbnLSDown": return DS4Controls.LYPos;
|
|
|
|
|
case "sbnRSRight": return DS4Controls.RXPos;
|
|
|
|
|
case "sbnRSDown": return DS4Controls.RYPos;
|
|
|
|
|
case "sbnL2": return DS4Controls.L2;
|
|
|
|
|
case "sbnR2": return DS4Controls.R2;
|
|
|
|
|
|
|
|
|
|
case "sbnTouchLeft": return DS4Controls.TouchLeft;
|
|
|
|
|
case "sbnTouchMulti": return DS4Controls.TouchMulti;
|
|
|
|
|
case "sbnTouchUpper": return DS4Controls.TouchUpper;
|
|
|
|
|
case "sbnTouchRight": return DS4Controls.TouchRight;
|
|
|
|
|
case "sbnGsyroXP": return DS4Controls.GyroXPos;
|
|
|
|
|
case "sbnGyroXN": return DS4Controls.GyroXNeg;
|
|
|
|
|
case "sbnGyroZP": return DS4Controls.GyroZPos;
|
|
|
|
|
case "sbnGyroZN": return DS4Controls.GyroZNeg;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
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-03-28 02:50:40 +01:00
|
|
|
|
private X360Controls getX360ControlsByName(string key)
|
|
|
|
|
{
|
|
|
|
|
switch (key)
|
|
|
|
|
{
|
|
|
|
|
case "Back": return X360Controls.Back;
|
|
|
|
|
case "Left Stick": return X360Controls.LS;
|
|
|
|
|
case "Right Stick": return X360Controls.RS;
|
|
|
|
|
case "Start": return X360Controls.Start;
|
|
|
|
|
case "Up Button": return X360Controls.DpadUp;
|
|
|
|
|
case "Right Button": return X360Controls.DpadRight;
|
|
|
|
|
case "Down Button": return X360Controls.DpadDown;
|
|
|
|
|
case "Left Button": return X360Controls.DpadLeft;
|
|
|
|
|
|
|
|
|
|
case "Left Bumper": return X360Controls.LB;
|
|
|
|
|
case "Right Bumper": return X360Controls.RB;
|
|
|
|
|
case "Y Button": return X360Controls.Y;
|
|
|
|
|
case "B Button": return X360Controls.B;
|
|
|
|
|
case "A Button": return X360Controls.A;
|
|
|
|
|
case "X Button": return X360Controls.X;
|
|
|
|
|
|
|
|
|
|
case "Guide": return X360Controls.Guide;
|
|
|
|
|
case "Left X-Axis-": return X360Controls.LXNeg;
|
|
|
|
|
case "Left Y-Axis-": return X360Controls.LYNeg;
|
|
|
|
|
case "Right X-Axis-": return X360Controls.RXNeg;
|
|
|
|
|
case "Right Y-Axis-": return X360Controls.RYNeg;
|
|
|
|
|
|
|
|
|
|
case "Left X-Axis+": return X360Controls.LXPos;
|
|
|
|
|
case "Left Y-Axis+": return X360Controls.LYPos;
|
|
|
|
|
case "Right X-Axis+": return X360Controls.RXPos;
|
|
|
|
|
case "Right Y-Axis+": return X360Controls.RYPos;
|
|
|
|
|
case "Left Trigger": return X360Controls.LT;
|
|
|
|
|
case "Right Trigger": return X360Controls.RT;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
case "Left Mouse Button": return X360Controls.LeftMouse;
|
|
|
|
|
case "Right Mouse Button": return X360Controls.RightMouse;
|
|
|
|
|
case "Middle Mouse Button": return X360Controls.MiddleMouse;
|
|
|
|
|
case "4th Mouse Button": return X360Controls.FourthMouse;
|
|
|
|
|
case "5th Mouse Button": return X360Controls.FifthMouse;
|
|
|
|
|
case "Mouse Wheel Up": return X360Controls.WUP;
|
|
|
|
|
case "Mouse Wheel Down": return X360Controls.WDOWN;
|
2014-04-29 23:56:58 +02:00
|
|
|
|
case "Mouse Up": return X360Controls.MouseUp;
|
|
|
|
|
case "Mouse Down": return X360Controls.MouseDown;
|
|
|
|
|
case "Mouse Left": return X360Controls.MouseLeft;
|
|
|
|
|
case "Mouse Right": return X360Controls.MouseRight;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
case "Unbound": return X360Controls.Unbound;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return X360Controls.Unbound;
|
|
|
|
|
}
|
2014-06-26 20:02:01 +02:00
|
|
|
|
|
2014-09-15 04:37:14 +02:00
|
|
|
|
public Boolean LoadProfile(int device, System.Windows.Forms.Control[] buttons, System.Windows.Forms.Control[] shiftbuttons, bool launchprogram, Control control, string propath = "")
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
|
|
|
|
Boolean Loaded = true;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Dictionary<DS4Controls, DS4KeyType> customMapKeyTypes = new Dictionary<DS4Controls, DS4KeyType>();
|
|
|
|
|
Dictionary<DS4Controls, UInt16> customMapKeys = new Dictionary<DS4Controls, UInt16>();
|
|
|
|
|
Dictionary<DS4Controls, X360Controls> customMapButtons = new Dictionary<DS4Controls, X360Controls>();
|
2014-05-28 04:49:58 +02:00
|
|
|
|
Dictionary<DS4Controls, String> customMapMacros = new Dictionary<DS4Controls, String>();
|
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
|
|
|
|
Dictionary<DS4Controls, DS4KeyType> shiftCustomMapKeyTypes = new Dictionary<DS4Controls, DS4KeyType>();
|
|
|
|
|
Dictionary<DS4Controls, UInt16> shiftCustomMapKeys = new Dictionary<DS4Controls, UInt16>();
|
|
|
|
|
Dictionary<DS4Controls, X360Controls> shiftCustomMapButtons = new Dictionary<DS4Controls, X360Controls>();
|
|
|
|
|
Dictionary<DS4Controls, String> shiftCustomMapMacros = new Dictionary<DS4Controls, String>();
|
2014-03-28 02:50:40 +01:00
|
|
|
|
Boolean missingSetting = false;
|
2014-06-26 20:02:01 +02:00
|
|
|
|
string profilepath;
|
|
|
|
|
if (propath == "")
|
|
|
|
|
profilepath = profilePath[device];
|
|
|
|
|
else
|
|
|
|
|
profilepath = propath;
|
2014-07-03 04:33:05 +02:00
|
|
|
|
if (File.Exists(profilepath))
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
2014-07-03 04:33:05 +02:00
|
|
|
|
XmlNode Item;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-07-03 04:33:05 +02:00
|
|
|
|
m_Xdoc.Load(profilepath);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/flushHIDQueue"); Boolean.TryParse(Item.InnerText, out flushHIDQueue[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/idleDisconnectTimeout"); Int32.TryParse(Item.InnerText, out idleDisconnectTimeout[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
//New method for saving color
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode("/ScpControl/Color");
|
|
|
|
|
string[] colors;
|
|
|
|
|
if (!string.IsNullOrEmpty(Item.InnerText))
|
|
|
|
|
colors = Item.InnerText.Split(',');
|
|
|
|
|
else
|
|
|
|
|
colors = new string[0];
|
|
|
|
|
for (int i = 0; i < colors.Length; i++)
|
|
|
|
|
m_Leds[device][i] = byte.Parse(colors[i]);
|
|
|
|
|
}
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
if (m_Xdoc.SelectSingleNode("/ScpControl/Color") == null)
|
|
|
|
|
{
|
|
|
|
|
//Old method of color saving
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Red"); Byte.TryParse(Item.InnerText, out m_Leds[device][0]); }
|
2014-04-27 21:32:09 +02:00
|
|
|
|
catch { missingSetting = true; }
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Green"); Byte.TryParse(Item.InnerText, out m_Leds[device][1]); }
|
2014-04-27 21:32:09 +02:00
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Blue"); Byte.TryParse(Item.InnerText, out m_Leds[device][2]); }
|
2014-04-27 21:32:09 +02:00
|
|
|
|
catch { missingSetting = true; }
|
2014-07-03 04:33:05 +02:00
|
|
|
|
}
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RumbleBoost"); Byte.TryParse(Item.InnerText, out m_Rumble[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ledAsBatteryIndicator"); Boolean.TryParse(Item.InnerText, out ledAsBattery[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/lowBatteryFlash"); Boolean.TryParse(Item.InnerText, out flashLedLowBattery[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/flashBatteryAt"); Int32.TryParse(Item.InnerText, out flashAt[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
2014-05-31 06:37:02 +02:00
|
|
|
|
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/touchSensitivity"); Byte.TryParse(Item.InnerText, out touchSensitivity[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
//New method for saving color
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode("/ScpControl/LowColor");
|
|
|
|
|
string[] colors;
|
|
|
|
|
if (!string.IsNullOrEmpty(Item.InnerText))
|
|
|
|
|
colors = Item.InnerText.Split(',');
|
|
|
|
|
else
|
|
|
|
|
colors = new string[0];
|
|
|
|
|
for (int i = 0; i < colors.Length; i++)
|
|
|
|
|
m_LowLeds[device][i] = byte.Parse(colors[i]);
|
|
|
|
|
}
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
if (m_Xdoc.SelectSingleNode("/ScpControl/LowColor") == null)
|
|
|
|
|
{
|
|
|
|
|
//Old method of color saving
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowRed"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][0]); }
|
2014-05-21 23:42:25 +02:00
|
|
|
|
catch { missingSetting = true; }
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowGreen"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][1]); }
|
2014-05-21 23:42:25 +02:00
|
|
|
|
catch { missingSetting = true; }
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowBlue"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][2]); }
|
2014-06-26 20:02:01 +02:00
|
|
|
|
catch { missingSetting = true; }
|
2014-07-03 04:33:05 +02:00
|
|
|
|
}
|
|
|
|
|
//New method for saving color
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingColor");
|
|
|
|
|
string[] colors;
|
|
|
|
|
if (!string.IsNullOrEmpty(Item.InnerText))
|
|
|
|
|
colors = Item.InnerText.Split(',');
|
|
|
|
|
else
|
|
|
|
|
colors = new string[0];
|
|
|
|
|
for (int i = 0; i < colors.Length; i++)
|
|
|
|
|
m_ChargingLeds[device][i] = byte.Parse(colors[i]);
|
|
|
|
|
}
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
if (m_Xdoc.SelectSingleNode("/ScpControl/ChargingColor") == null)
|
|
|
|
|
{
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingRed"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][0]); }
|
2014-06-26 20:02:01 +02:00
|
|
|
|
catch { missingSetting = true; }
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingGreen"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][1]); }
|
2014-06-02 19:29:38 +02:00
|
|
|
|
catch { missingSetting = true; }
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingBlue"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][2]); }
|
2014-06-26 20:02:01 +02:00
|
|
|
|
catch { missingSetting = true; }
|
2014-07-03 04:33:05 +02:00
|
|
|
|
}
|
2014-07-26 01:17:45 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode("/ScpControl/ShiftColor");
|
|
|
|
|
string[] colors;
|
|
|
|
|
if (!string.IsNullOrEmpty(Item.InnerText))
|
|
|
|
|
colors = Item.InnerText.Split(',');
|
|
|
|
|
else
|
|
|
|
|
colors = new string[0];
|
|
|
|
|
for (int i = 0; i < colors.Length; i++)
|
|
|
|
|
m_ShiftLeds[device][i] = byte.Parse(colors[i]);
|
|
|
|
|
}
|
|
|
|
|
catch { m_ShiftLeds[device] = m_Leds[device]; missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ShiftColorOn"); Boolean.TryParse(Item.InnerText, out shiftColorOn[device]); }
|
|
|
|
|
catch { shiftColorOn[device] = false; missingSetting = true; }
|
2014-08-23 22:52:20 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode("/ScpControl/FlashColor");
|
|
|
|
|
string[] colors;
|
|
|
|
|
if (!string.IsNullOrEmpty(Item.InnerText))
|
|
|
|
|
colors = Item.InnerText.Split(',');
|
|
|
|
|
else
|
|
|
|
|
colors = new string[0];
|
|
|
|
|
for (int i = 0; i < colors.Length; i++)
|
|
|
|
|
m_FlashLeds[device][i] = byte.Parse(colors[i]);
|
|
|
|
|
}
|
|
|
|
|
catch { missingSetting = true; }
|
2014-07-03 04:33:05 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/touchpadJitterCompensation"); Boolean.TryParse(Item.InnerText, out touchpadJitterCompensation[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/lowerRCOn"); Boolean.TryParse(Item.InnerText, out lowerRCOn[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/tapSensitivity"); Byte.TryParse(Item.InnerText, out tapSensitivity[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/doubleTap"); Boolean.TryParse(Item.InnerText, out doubleTap[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/scrollSensitivity"); Int32.TryParse(Item.InnerText, out scrollSensitivity[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LeftTriggerMiddle"); Byte.TryParse(Item.InnerText, out m_LeftTriggerMiddle[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RightTriggerMiddle"); Byte.TryParse(Item.InnerText, out m_RightTriggerMiddle[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ButtonMouseSensitivity"); Int32.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Rainbow"); Double.TryParse(Item.InnerText, out rainbow[device]); }
|
|
|
|
|
catch { rainbow[device] = 0; missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LSDeadZone"); Byte.TryParse(Item.InnerText, out LSDeadzone[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RSDeadZone"); Byte.TryParse(Item.InnerText, out RSDeadzone[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/SXDeadZone"); Double.TryParse(Item.InnerText, out SXDeadzone[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/SZDeadZone"); Double.TryParse(Item.InnerText, out SZDeadzone[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingType"); Int32.TryParse(Item.InnerText, out chargingType[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/MouseAcceleration"); Boolean.TryParse(Item.InnerText, out mouseAccel[device]); }
|
|
|
|
|
catch { missingSetting = true; }
|
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
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ShiftModifier"); Int32.TryParse(Item.InnerText, out shiftModifier[device]); }
|
|
|
|
|
catch { shiftModifier[device] = 0; missingSetting = true; }
|
2014-09-15 04:37:14 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode("/ScpControl/LaunchProgram");
|
|
|
|
|
launchProgram[device] = Item.InnerText;
|
|
|
|
|
if (launchprogram == true && launchProgram[device] != string.Empty) System.Diagnostics.Process.Start(launchProgram[device]);
|
|
|
|
|
}
|
2014-07-26 01:17:45 +02:00
|
|
|
|
catch { launchProgram[device] = string.Empty; missingSetting = true; }
|
2014-09-15 04:37:14 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode("/ScpControl/DinputOnly");
|
|
|
|
|
Boolean.TryParse(Item.InnerText, out dinputOnly[device]);
|
2014-09-15 04:52:21 +02:00
|
|
|
|
if (device < 4)
|
|
|
|
|
{
|
|
|
|
|
if (dinputOnly[device] == true) control.x360Bus.Unplug(device);
|
|
|
|
|
else if (control.DS4Controllers[device].IsAlive()) control.x360Bus.Plugin(device);
|
|
|
|
|
}
|
2014-09-15 04:37:14 +02:00
|
|
|
|
}
|
2014-08-23 22:52:20 +02:00
|
|
|
|
catch { missingSetting = true; }
|
2014-09-15 04:37:14 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode("/ScpControl/StartTouchpadOff");
|
|
|
|
|
Boolean.TryParse(Item.InnerText, out startTouchpadOff[device]);
|
|
|
|
|
if (startTouchpadOff[device] == true) control.StartTPOff(device);
|
|
|
|
|
}
|
|
|
|
|
catch { startTouchpadOff[device] = false; missingSetting = true; }
|
2014-07-03 04:33:05 +02:00
|
|
|
|
DS4KeyType keyType;
|
|
|
|
|
UInt16 wvk;
|
|
|
|
|
if (buttons == null)
|
|
|
|
|
{
|
|
|
|
|
XmlNode ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/Button");
|
|
|
|
|
if (ParentItem != null)
|
|
|
|
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
|
|
|
|
customMapButtons.Add(getDS4ControlsByName(item.Name), getX360ControlsByName(item.InnerText));
|
|
|
|
|
ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/Macro");
|
|
|
|
|
if (ParentItem != null)
|
|
|
|
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
|
|
|
|
customMapMacros.Add(getDS4ControlsByName(item.Name), item.InnerText);
|
|
|
|
|
ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/Key");
|
|
|
|
|
if (ParentItem != null)
|
|
|
|
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
|
|
|
|
if (UInt16.TryParse(item.InnerText, out wvk))
|
|
|
|
|
customMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
|
|
|
|
|
ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/KeyType");
|
|
|
|
|
if (ParentItem != null)
|
|
|
|
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
|
|
|
|
if (item != null)
|
|
|
|
|
{
|
|
|
|
|
keyType = DS4KeyType.None;
|
|
|
|
|
if (item.InnerText.Contains(DS4KeyType.ScanCode.ToString()))
|
|
|
|
|
keyType |= DS4KeyType.ScanCode;
|
|
|
|
|
if (item.InnerText.Contains(DS4KeyType.Toggle.ToString()))
|
|
|
|
|
keyType |= DS4KeyType.Toggle;
|
|
|
|
|
if (item.InnerText.Contains(DS4KeyType.Macro.ToString()))
|
|
|
|
|
keyType |= DS4KeyType.Macro;
|
|
|
|
|
if (item.InnerText.Contains(DS4KeyType.HoldMacro.ToString()))
|
|
|
|
|
keyType |= DS4KeyType.HoldMacro;
|
|
|
|
|
if (item.InnerText.Contains(DS4KeyType.Unbound.ToString()))
|
|
|
|
|
keyType |= DS4KeyType.Unbound;
|
|
|
|
|
if (keyType != DS4KeyType.None)
|
|
|
|
|
customMapKeyTypes.Add(getDS4ControlsByName(item.Name), keyType);
|
|
|
|
|
}
|
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 (shiftModifier[device] > 0)
|
|
|
|
|
{
|
|
|
|
|
ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/ShiftControl/Button");
|
|
|
|
|
if (ParentItem != null)
|
|
|
|
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
|
|
|
|
shiftCustomMapButtons.Add(getDS4ControlsByName(item.Name), getX360ControlsByName(item.InnerText));
|
|
|
|
|
ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/ShiftControl/Macro");
|
|
|
|
|
if (ParentItem != null)
|
|
|
|
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
|
|
|
|
shiftCustomMapMacros.Add(getDS4ControlsByName(item.Name), item.InnerText);
|
|
|
|
|
ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/ShiftControl/Key");
|
|
|
|
|
if (ParentItem != null)
|
|
|
|
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
|
|
|
|
if (UInt16.TryParse(item.InnerText, out wvk))
|
|
|
|
|
shiftCustomMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
|
|
|
|
|
ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/ShiftControl/KeyType");
|
|
|
|
|
if (ParentItem != null)
|
|
|
|
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
|
|
|
|
if (item != null)
|
2014-04-27 21:32:09 +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
|
|
|
|
keyType = DS4KeyType.None;
|
|
|
|
|
if (item.InnerText.Contains(DS4KeyType.ScanCode.ToString()))
|
2014-04-27 21:32:09 +02:00
|
|
|
|
keyType |= DS4KeyType.ScanCode;
|
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 (item.InnerText.Contains(DS4KeyType.Toggle.ToString()))
|
2014-05-28 04:49:58 +02:00
|
|
|
|
keyType |= DS4KeyType.Toggle;
|
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 (item.InnerText.Contains(DS4KeyType.Macro.ToString()))
|
2014-05-28 04:49:58 +02:00
|
|
|
|
keyType |= DS4KeyType.Macro;
|
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 (item.InnerText.Contains(DS4KeyType.HoldMacro.ToString()))
|
|
|
|
|
keyType |= DS4KeyType.HoldMacro;
|
|
|
|
|
if (item.InnerText.Contains(DS4KeyType.Unbound.ToString()))
|
|
|
|
|
keyType |= DS4KeyType.Unbound;
|
|
|
|
|
if (keyType != DS4KeyType.None)
|
|
|
|
|
shiftCustomMapKeyTypes.Add(getDS4ControlsByName(item.Name), keyType);
|
2014-04-27 21:32:09 +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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LoadButtons(buttons, "Control", customMapKeyTypes, customMapKeys, customMapButtons, customMapMacros);
|
|
|
|
|
LoadButtons(shiftbuttons, "ShiftControl", shiftCustomMapKeyTypes, shiftCustomMapKeys, shiftCustomMapButtons, shiftCustomMapMacros);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-07-03 04:33:05 +02:00
|
|
|
|
}
|
|
|
|
|
//catch { Loaded = false; }
|
2014-04-27 21:32:09 +02:00
|
|
|
|
if (Loaded)
|
|
|
|
|
{
|
2014-04-29 11:19:00 +02:00
|
|
|
|
this.customMapButtons[device] = customMapButtons;
|
|
|
|
|
this.customMapKeys[device] = customMapKeys;
|
|
|
|
|
this.customMapKeyTypes[device] = customMapKeyTypes;
|
2014-05-28 04:49:58 +02:00
|
|
|
|
this.customMapMacros[device] = customMapMacros;
|
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
|
|
|
|
|
|
|
|
|
this.shiftCustomMapButtons[device] = shiftCustomMapButtons;
|
|
|
|
|
this.shiftCustomMapKeys[device] = shiftCustomMapKeys;
|
|
|
|
|
this.shiftCustomMapKeyTypes[device] = shiftCustomMapKeyTypes;
|
|
|
|
|
this.shiftCustomMapMacros[device] = shiftCustomMapMacros;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
2014-03-28 02:50:40 +01:00
|
|
|
|
// Only add missing settings if the actual load was graceful
|
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 (missingSetting && Loaded)// && buttons != null)
|
|
|
|
|
SaveProfile(device, profilepath, buttons, shiftbuttons);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
return Loaded;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
public void LoadButtons(System.Windows.Forms.Control[] buttons, string control, Dictionary<DS4Controls, DS4KeyType> customMapKeyTypes,
|
|
|
|
|
Dictionary<DS4Controls, UInt16> customMapKeys, Dictionary<DS4Controls, X360Controls> customMapButtons, Dictionary<DS4Controls, String> customMapMacros)
|
|
|
|
|
{
|
|
|
|
|
XmlNode Item;
|
|
|
|
|
DS4KeyType keyType;
|
|
|
|
|
UInt16 wvk;
|
|
|
|
|
foreach (var button in buttons)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//bool foundBinding = false;
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/" + control + "/KeyType/{0}", button.Name));
|
|
|
|
|
if (Item != null)
|
|
|
|
|
{
|
|
|
|
|
//foundBinding = true;
|
|
|
|
|
keyType = DS4KeyType.None;
|
|
|
|
|
if (Item.InnerText.Contains(DS4KeyType.Unbound.ToString()))
|
|
|
|
|
{
|
|
|
|
|
keyType = DS4KeyType.Unbound;
|
|
|
|
|
button.Tag = "Unbound";
|
|
|
|
|
button.Text = "Unbound";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool SC = Item.InnerText.Contains(DS4KeyType.ScanCode.ToString());
|
|
|
|
|
bool TG = Item.InnerText.Contains(DS4KeyType.Toggle.ToString());
|
|
|
|
|
bool MC = Item.InnerText.Contains(DS4KeyType.Macro.ToString());
|
|
|
|
|
bool MR = Item.InnerText.Contains(DS4KeyType.HoldMacro.ToString());
|
|
|
|
|
button.Font = new Font(button.Font,
|
|
|
|
|
(SC ? FontStyle.Bold : FontStyle.Regular) | (TG ? FontStyle.Italic : FontStyle.Regular) |
|
|
|
|
|
(MC ? FontStyle.Underline : FontStyle.Regular) | (MR ? FontStyle.Strikeout : FontStyle.Regular));
|
|
|
|
|
if (Item.InnerText.Contains(DS4KeyType.ScanCode.ToString()))
|
|
|
|
|
keyType |= DS4KeyType.ScanCode;
|
|
|
|
|
if (Item.InnerText.Contains(DS4KeyType.Toggle.ToString()))
|
|
|
|
|
keyType |= DS4KeyType.Toggle;
|
|
|
|
|
if (Item.InnerText.Contains(DS4KeyType.Macro.ToString()))
|
|
|
|
|
keyType |= DS4KeyType.Macro;
|
|
|
|
|
}
|
|
|
|
|
if (keyType != DS4KeyType.None)
|
|
|
|
|
customMapKeyTypes.Add(getDS4ControlsByName(Item.Name), keyType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/" + control + "/Macro/{0}", button.Name));
|
|
|
|
|
if (Item != null)
|
|
|
|
|
{
|
|
|
|
|
string[] splitter = Item.InnerText.Split('/');
|
|
|
|
|
int[] keys = new int[splitter.Length];
|
|
|
|
|
for (int i = 0; i < keys.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
keys[i] = int.Parse(splitter[i]);
|
|
|
|
|
if (keys[i] < 255) splitter[i] = ((System.Windows.Forms.Keys)keys[i]).ToString();
|
|
|
|
|
else if (keys[i] == 256) splitter[i] = "Left Mouse Button";
|
|
|
|
|
else if (keys[i] == 257) splitter[i] = "Right Mouse Button";
|
|
|
|
|
else if (keys[i] == 258) splitter[i] = "Middle Mouse Button";
|
|
|
|
|
else if (keys[i] == 259) splitter[i] = "4th Mouse Button";
|
|
|
|
|
else if (keys[i] == 260) splitter[i] = "5th Mouse Button";
|
|
|
|
|
else if (keys[i] > 300) splitter[i] = "Wait " + (keys[i] - 300) + "ms";
|
|
|
|
|
}
|
|
|
|
|
button.Text = "Macro";
|
|
|
|
|
button.Tag = keys;
|
|
|
|
|
customMapMacros.Add(getDS4ControlsByName(button.Name), Item.InnerText);
|
|
|
|
|
}
|
|
|
|
|
else if (m_Xdoc.SelectSingleNode(String.Format("/ScpControl/" + control + "/Key/{0}", button.Name)) != null)
|
|
|
|
|
{
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/" + control + "/Key/{0}", button.Name));
|
|
|
|
|
if (UInt16.TryParse(Item.InnerText, out wvk))
|
|
|
|
|
{
|
|
|
|
|
//foundBinding = true;
|
|
|
|
|
customMapKeys.Add(getDS4ControlsByName(Item.Name), wvk);
|
|
|
|
|
button.Tag = wvk;
|
|
|
|
|
button.Text = ((System.Windows.Forms.Keys)wvk).ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/" + control + "/Button/{0}", button.Name));
|
|
|
|
|
if (Item != null)
|
|
|
|
|
{
|
|
|
|
|
//foundBinding = true;
|
|
|
|
|
button.Tag = Item.InnerText;
|
|
|
|
|
button.Text = Item.InnerText;
|
|
|
|
|
customMapButtons.Add(getDS4ControlsByName(button.Name), getX360ControlsByName(Item.InnerText));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public bool Load()
|
|
|
|
|
{
|
|
|
|
|
Boolean Loaded = true;
|
2014-04-29 11:23:28 +02:00
|
|
|
|
Boolean missingSetting = false;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (File.Exists(m_Profile))
|
|
|
|
|
{
|
|
|
|
|
XmlNode Item;
|
|
|
|
|
|
|
|
|
|
m_Xdoc.Load(m_Profile);
|
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/useExclusiveMode"); Boolean.TryParse(Item.InnerText, out useExclusiveMode); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/startMinimized"); Boolean.TryParse(Item.InnerText, out startMinimized); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/formWidth"); Int32.TryParse(Item.InnerText, out formWidth); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/formHeight"); Int32.TryParse(Item.InnerText, out formHeight); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/Controller1"); profilePath[0] = Item.InnerText; }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/Controller2"); profilePath[1] = Item.InnerText; }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/Controller3"); profilePath[2] = Item.InnerText; }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/Controller4"); profilePath[3] = Item.InnerText; }
|
|
|
|
|
catch { missingSetting = true; }
|
2014-05-21 19:39:56 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/LastChecked"); DateTime.TryParse(Item.InnerText, out lastChecked); }
|
|
|
|
|
catch { missingSetting = true; }
|
2014-06-06 22:38:52 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/CheckWhen"); Int32.TryParse(Item.InnerText, out CheckWhen); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/Notifications"); Boolean.TryParse(Item.InnerText, out notifications); }
|
|
|
|
|
catch { missingSetting = true; }
|
2014-06-21 20:00:28 +02:00
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/DisconnectBTAtStop"); Boolean.TryParse(Item.InnerText, out disconnectBTAtStop); }
|
|
|
|
|
catch { missingSetting = true; }
|
|
|
|
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/SwipeProfiles"); Boolean.TryParse(Item.InnerText, out swipeProfiles); }
|
|
|
|
|
catch { missingSetting = true; }
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
if (missingSetting)
|
2014-04-29 11:23:28 +02:00
|
|
|
|
Save();
|
2014-04-29 11:19:00 +02:00
|
|
|
|
return Loaded;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public bool Save()
|
2014-03-28 02:50:40 +01:00
|
|
|
|
{
|
|
|
|
|
Boolean Saved = true;
|
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
XmlNode Node;
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
m_Xdoc.RemoveAll();
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
Node = m_Xdoc.CreateXmlDeclaration("1.0", "utf-8", String.Empty);
|
|
|
|
|
m_Xdoc.AppendChild(Node);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
Node = m_Xdoc.CreateComment(String.Format(" Profile Configuration Data. {0} ", DateTime.Now));
|
|
|
|
|
m_Xdoc.AppendChild(Node);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
Node = m_Xdoc.CreateWhitespace("\r\n");
|
|
|
|
|
m_Xdoc.AppendChild(Node);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
Node = m_Xdoc.CreateNode(XmlNodeType.Element, "Profile", null);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
XmlNode xmlUseExclNode = m_Xdoc.CreateNode(XmlNodeType.Element, "useExclusiveMode", null); xmlUseExclNode.InnerText = useExclusiveMode.ToString(); Node.AppendChild(xmlUseExclNode);
|
|
|
|
|
XmlNode xmlStartMinimized = m_Xdoc.CreateNode(XmlNodeType.Element, "startMinimized", null); xmlStartMinimized.InnerText = startMinimized.ToString(); Node.AppendChild(xmlStartMinimized);
|
|
|
|
|
XmlNode xmlFormWidth = m_Xdoc.CreateNode(XmlNodeType.Element, "formWidth", null); xmlFormWidth.InnerText = formWidth.ToString(); Node.AppendChild(xmlFormWidth);
|
|
|
|
|
XmlNode xmlFormHeight = m_Xdoc.CreateNode(XmlNodeType.Element, "formHeight", null); xmlFormHeight.InnerText = formHeight.ToString(); Node.AppendChild(xmlFormHeight);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
XmlNode xmlController1 = m_Xdoc.CreateNode(XmlNodeType.Element, "Controller1", null); xmlController1.InnerText = profilePath[0]; Node.AppendChild(xmlController1);
|
|
|
|
|
XmlNode xmlController2 = m_Xdoc.CreateNode(XmlNodeType.Element, "Controller2", null); xmlController2.InnerText = profilePath[1]; Node.AppendChild(xmlController2);
|
|
|
|
|
XmlNode xmlController3 = m_Xdoc.CreateNode(XmlNodeType.Element, "Controller3", null); xmlController3.InnerText = profilePath[2]; Node.AppendChild(xmlController3);
|
|
|
|
|
XmlNode xmlController4 = m_Xdoc.CreateNode(XmlNodeType.Element, "Controller4", null); xmlController4.InnerText = profilePath[3]; Node.AppendChild(xmlController4);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
XmlNode xmlLastChecked = m_Xdoc.CreateNode(XmlNodeType.Element, "LastChecked", null); xmlLastChecked.InnerText = lastChecked.ToString(); Node.AppendChild(xmlLastChecked);
|
|
|
|
|
XmlNode xmlCheckWhen = m_Xdoc.CreateNode(XmlNodeType.Element, "CheckWhen", null); xmlCheckWhen.InnerText = CheckWhen.ToString(); Node.AppendChild(xmlCheckWhen);
|
|
|
|
|
XmlNode xmlNotifications = m_Xdoc.CreateNode(XmlNodeType.Element, "Notifications", null); xmlNotifications.InnerText = notifications.ToString(); Node.AppendChild(xmlNotifications);
|
|
|
|
|
XmlNode xmlDisconnectBT = m_Xdoc.CreateNode(XmlNodeType.Element, "DisconnectBTAtStop", null); xmlDisconnectBT.InnerText = disconnectBTAtStop.ToString(); Node.AppendChild(xmlDisconnectBT);
|
|
|
|
|
XmlNode xmlSwipeProfiles = m_Xdoc.CreateNode(XmlNodeType.Element, "SwipeProfiles", null); xmlSwipeProfiles.InnerText = swipeProfiles.ToString(); Node.AppendChild(xmlSwipeProfiles);
|
|
|
|
|
m_Xdoc.AppendChild(Node);
|
2014-03-28 02:50:40 +01:00
|
|
|
|
|
2014-06-21 20:00:28 +02:00
|
|
|
|
try { m_Xdoc.Save(m_Profile); }
|
|
|
|
|
catch (UnauthorizedAccessException) { Saved = false; }
|
2014-03-28 02:50:40 +01:00
|
|
|
|
return Saved;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|