Merge branch 'mika-n-jay' into jay

This commit is contained in:
Travis Nickles 2019-02-22 01:53:35 -06:00
commit 988eb1a407
16 changed files with 2014 additions and 303 deletions

View File

@ -6,7 +6,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Diagnostics;
using static DS4Windows.Global;
using System.Drawing; // Point struct
namespace DS4Windows
{
@ -1602,6 +1602,11 @@ namespace DS4Windows
if (macroControl[24]) MappedState.RY = 0;
}
if (GetSASteeringWheelEmulationAxis(device) != SASteeringWheelEmulationAxisType.None)
{
MappedState.SASteeringWheelEmulationUnit = Mapping.Scale360degreeGyroAxis(device, eState, ctrl);
}
calculateFinalMouseMovement(ref tempMouseDeltaX, ref tempMouseDeltaY,
out mouseDeltaX, out mouseDeltaY);
if (mouseDeltaX != 0 || mouseDeltaY != 0)
@ -1916,6 +1921,25 @@ namespace DS4Windows
}
actionDone[index].dev[device] = true;
}
else if (action.typeID == SpecialAction.ActionTypeId.SASteeringWheelEmulationCalibrate)
{
actionFound = true;
DS4Device d = ctrl.DS4Controllers[device];
// If controller is not already in SASteeringWheelCalibration state then enable it now. If calibration is active then complete it (commit calibration values)
if (d.WheelRecalibrateActiveState == 0 && DateTime.UtcNow > (action.firstTap + TimeSpan.FromMilliseconds(3000)))
{
action.firstTap = DateTime.UtcNow;
d.WheelRecalibrateActiveState = 1; // Start calibration process
}
else if (d.WheelRecalibrateActiveState == 2 && DateTime.UtcNow > (action.firstTap + TimeSpan.FromMilliseconds(3000)))
{
action.firstTap = DateTime.UtcNow;
d.WheelRecalibrateActiveState = 3; // Complete calibration process
}
actionDone[index].dev[device] = true;
}
}
else
{
@ -3665,5 +3689,424 @@ namespace DS4Windows
fieldMap.buttons[controlNum] = false;
}
}
// BEGIN: SixAxis steering wheel emulation logic
private const int C_WHEEL_ANGLE_PRECISION = 10; // 1=precision of one degree, 10=precision of 1/10 of degree. Bigger number means fine graned precision
private const int C_WHEEL_ANGLE_PRECISION_DECIMALS = (C_WHEEL_ANGLE_PRECISION == 1 ? 0 : C_WHEEL_ANGLE_PRECISION / 10);
// "In-game" calibration process:
// - Place controller at "steering wheel center" position and press "Calibrate SA steering wheel" special action button to start the calibration
// - Hold the controller still for a while at center point and press "X"
// - Turn the controller at 90 degree left or right position and hold still for few seconds and press "X"
// - Turn the controller at 90 degree position on the opposite side and press "X"
// - Now you can check the calibratio by turning the wheel and see when the green lightbar starts to blink (it should blink at those three calibrated positions)
// - Press "Calibrate SA steering wheel" special action key to accept the calibration (result is saved to ControllerConfigs.xml xml file)
//
private static readonly DS4Color calibrationColor_0 = new DS4Color { red = 0xA0, green = 0x00, blue = 0x00 };
private static readonly DS4Color calibrationColor_1 = new DS4Color { red = 0xFF, green = 0xFF, blue = 0x00 };
private static readonly DS4Color calibrationColor_2 = new DS4Color { red = 0x00, green = 0x50, blue = 0x50 };
private static readonly DS4Color calibrationColor_3 = new DS4Color { red = 0x00, green = 0xC0, blue = 0x00 };
private static DateTime latestDebugMsgTime;
private static string latestDebugData;
private static void LogToGuiSACalibrationDebugMsg(string data, bool forceOutput = false)
{
// Print debug calibration log messages only once per 2 secs to avoid flooding the log receiver
DateTime curTime = DateTime.Now;
if (forceOutput || ((TimeSpan)(curTime - latestDebugMsgTime)).TotalSeconds > 2)
{
latestDebugMsgTime = curTime;
if (data != latestDebugData)
{
AppLogger.LogToGui(data, false);
latestDebugData = data;
}
}
}
// Return number of bits set in a value
protected static int CountNumOfSetBits(int bitValue)
{
int count = 0;
while (bitValue != 0)
{
count++;
bitValue &= (bitValue - 1);
}
return count;
}
// Calculate and return the angle of the controller as -180...0...+180 value.
private static Int32 CalculateControllerAngle(int gyroAccelX, int gyroAccelZ, DS4Device controller)
{
Int32 result;
if (gyroAccelX == controller.wheelCenterPoint.X && Math.Abs(gyroAccelZ - controller.wheelCenterPoint.Y) <= 1)
{
// When the current gyro position is "close enough" the wheel center point then no need to go through the hassle of calculating an angle
result = 0;
}
else
{
// Calculate two vectors based on "circle center" (ie. circle represents the 360 degree wheel turn and wheelCenterPoint and currentPosition vectors both start from circle center).
// To improve accuracy both left and right turns use a decicated calibration "circle" because DS4 gyro and DoItYourselfWheelRig may return slightly different SA sensor values depending on the tilt direction (well, only one or two degree difference so nothing major).
Point vectorAB;
Point vectorCD;
if (gyroAccelX >= controller.wheelCenterPoint.X)
{
// "DS4 gyro wheel" tilted to right
vectorAB = new Point(controller.wheelCenterPoint.X - controller.wheelCircleCenterPointRight.X, controller.wheelCenterPoint.Y - controller.wheelCircleCenterPointRight.Y);
vectorCD = new Point(gyroAccelX - controller.wheelCircleCenterPointRight.X, gyroAccelZ - controller.wheelCircleCenterPointRight.Y);
}
else
{
// "DS4 gyro wheel" tilted to left
vectorAB = new Point(controller.wheelCenterPoint.X - controller.wheelCircleCenterPointLeft.X, controller.wheelCenterPoint.Y - controller.wheelCircleCenterPointLeft.Y);
vectorCD = new Point(gyroAccelX - controller.wheelCircleCenterPointLeft.X, gyroAccelZ - controller.wheelCircleCenterPointLeft.Y);
}
// Calculate dot product and magnitude of vectors (center vector and the current tilt vector)
double dotProduct = vectorAB.X * vectorCD.X + vectorAB.Y * vectorCD.Y;
double magAB = Math.Sqrt(vectorAB.X * vectorAB.X + vectorAB.Y * vectorAB.Y);
double magCD = Math.Sqrt(vectorCD.X * vectorCD.X + vectorCD.Y * vectorCD.Y);
// Calculate angle between vectors and convert radian to degrees
if (magAB == 0 || magCD == 0)
{
result = 0;
}
else
{
double angle = Math.Acos(dotProduct / (magAB * magCD));
result = Convert.ToInt32(Global.Clamp(
-180.0 * C_WHEEL_ANGLE_PRECISION,
Math.Round((angle * (180.0 / Math.PI)), C_WHEEL_ANGLE_PRECISION_DECIMALS) * C_WHEEL_ANGLE_PRECISION,
180.0 * C_WHEEL_ANGLE_PRECISION)
);
}
// Left turn is -180..0 and right turn 0..180 degrees
if (gyroAccelX < controller.wheelCenterPoint.X) result = -result;
}
return result;
}
// Calibrate sixaxis steering wheel emulation. Use DS4Windows configuration screen to start a calibration or press a special action key (if defined)
private static void SAWheelEmulationCalibration(int device, DS4StateExposed exposedState, ControlService ctrl, DS4State currentDeviceState, DS4Device controller)
{
int gyroAccelX, gyroAccelZ;
int result;
gyroAccelX = exposedState.getAccelX();
gyroAccelZ = exposedState.getAccelZ();
//gyroAccelX = exposedState.OutputAccelX;
//gyroAccelZ = exposedState.OutputAccelZ;
// State 0=Normal mode (ie. calibration process is not running), 1=Activating calibration, 2=Calibration process running, 3=Completing calibration, 4=Cancelling calibration
if (controller.WheelRecalibrateActiveState == 1)
{
AppLogger.LogToGui($"Controller {ctrl.x360Bus.FirstController + device} activated re-calibration of SA steering wheel emulation", false);
controller.WheelRecalibrateActiveState = 2;
controller.wheelPrevPhysicalAngle = 0;
controller.wheelPrevFullAngle = 0;
controller.wheelFullTurnCount = 0;
// Clear existing calibration value and use current position as "center" point.
// This initial center value may be off-center because of shaking the controller while button was pressed. The value will be overriden with correct value once controller is stabilized and hold still few secs at the center point
controller.wheelCenterPoint.X = gyroAccelX;
controller.wheelCenterPoint.Y = gyroAccelZ;
controller.wheel90DegPointRight.X = gyroAccelX + 20;
controller.wheel90DegPointLeft.X = gyroAccelX - 20;
// Clear bitmask for calibration points. All three calibration points need to be set before re-calibration process is valid
controller.wheelCalibratedAxisBitmask = DS4Device.WheelCalibrationPoint.None;
controller.wheelPrevRecalibrateTime = new DateTime(2500, 1, 1);
}
else if (controller.WheelRecalibrateActiveState == 3)
{
AppLogger.LogToGui($"Controller {ctrl.x360Bus.FirstController + device} completed the calibration of SA steering wheel emulation. center=({controller.wheelCenterPoint.X}, {controller.wheelCenterPoint.Y}) 90L=({controller.wheel90DegPointLeft.X}, {controller.wheel90DegPointLeft.Y}) 90R=({controller.wheel90DegPointRight.X}, {controller.wheel90DegPointRight.Y})", false);
// If any of the calibration points (center, left 90deg, right 90deg) are missing then reset back to default calibration values
if (((controller.wheelCalibratedAxisBitmask & DS4Device.WheelCalibrationPoint.All) == DS4Device.WheelCalibrationPoint.All))
Global.SaveControllerConfigs(controller);
else
controller.wheelCenterPoint.X = controller.wheelCenterPoint.Y = 0;
controller.WheelRecalibrateActiveState = 0;
controller.wheelPrevRecalibrateTime = DateTime.Now;
}
else if (controller.WheelRecalibrateActiveState == 4)
{
AppLogger.LogToGui($"Controller {ctrl.x360Bus.FirstController + device} cancelled the calibration of SA steering wheel emulation.", false);
controller.WheelRecalibrateActiveState = 0;
controller.wheelPrevRecalibrateTime = DateTime.Now;
}
if (controller.WheelRecalibrateActiveState > 0)
{
// Cross "X" key pressed. Set calibration point when the key is released and controller hold steady for a few seconds
if (currentDeviceState.Cross == true) controller.wheelPrevRecalibrateTime = DateTime.Now;
// Make sure controller is hold steady (velocity of gyro axis) to avoid misaligments and set calibration few secs after the "X" key was released
if (Math.Abs(currentDeviceState.Motion.angVelPitch) < 0.5 && Math.Abs(currentDeviceState.Motion.angVelYaw) < 0.5 && Math.Abs(currentDeviceState.Motion.angVelRoll) < 0.5
&& ((TimeSpan)(DateTime.Now - controller.wheelPrevRecalibrateTime)).TotalSeconds > 1)
{
controller.wheelPrevRecalibrateTime = new DateTime(2500, 1, 1);
if (controller.wheelCalibratedAxisBitmask == DS4Device.WheelCalibrationPoint.None)
{
controller.wheelCenterPoint.X = gyroAccelX;
controller.wheelCenterPoint.Y = gyroAccelZ;
controller.wheelCalibratedAxisBitmask |= DS4Device.WheelCalibrationPoint.Center;
}
else if (controller.wheel90DegPointRight.X < gyroAccelX)
{
controller.wheel90DegPointRight.X = gyroAccelX;
controller.wheel90DegPointRight.Y = gyroAccelZ;
controller.wheelCircleCenterPointRight.X = controller.wheelCenterPoint.X;
controller.wheelCircleCenterPointRight.Y = controller.wheel90DegPointRight.Y;
controller.wheelCalibratedAxisBitmask |= DS4Device.WheelCalibrationPoint.Right90;
}
else if (controller.wheel90DegPointLeft.X > gyroAccelX)
{
controller.wheel90DegPointLeft.X = gyroAccelX;
controller.wheel90DegPointLeft.Y = gyroAccelZ;
controller.wheelCircleCenterPointLeft.X = controller.wheelCenterPoint.X;
controller.wheelCircleCenterPointLeft.Y = controller.wheel90DegPointLeft.Y;
controller.wheelCalibratedAxisBitmask |= DS4Device.WheelCalibrationPoint.Left90;
}
}
// Show lightbar color feedback how the calibration process is proceeding.
// red / yellow / blue / green = No calibration anchors/one anchor/two anchors/all three anchors calibrated when color turns to green (center, 90DegLeft, 90DegRight).
int bitsSet = CountNumOfSetBits((int)controller.wheelCalibratedAxisBitmask);
if (bitsSet >= 3) DS4LightBar.forcedColor[device] = calibrationColor_3;
else if (bitsSet == 2) DS4LightBar.forcedColor[device] = calibrationColor_2;
else if (bitsSet == 1) DS4LightBar.forcedColor[device] = calibrationColor_1;
else DS4LightBar.forcedColor[device] = calibrationColor_0;
result = CalculateControllerAngle(gyroAccelX, gyroAccelZ, controller);
// Force lightbar flashing when controller is currently at calibration point (user can verify the calibration before accepting it by looking at flashing lightbar)
if (((controller.wheelCalibratedAxisBitmask & DS4Device.WheelCalibrationPoint.Center) != 0 && Math.Abs(result) <= 1 * C_WHEEL_ANGLE_PRECISION)
|| ((controller.wheelCalibratedAxisBitmask & DS4Device.WheelCalibrationPoint.Left90) != 0 && result <= -89 * C_WHEEL_ANGLE_PRECISION && result >= -91 * C_WHEEL_ANGLE_PRECISION)
|| ((controller.wheelCalibratedAxisBitmask & DS4Device.WheelCalibrationPoint.Right90) != 0 && result >= 89 * C_WHEEL_ANGLE_PRECISION && result <= 91 * C_WHEEL_ANGLE_PRECISION)
|| ((controller.wheelCalibratedAxisBitmask & DS4Device.WheelCalibrationPoint.Left90) != 0 && Math.Abs(result) >= 179 * C_WHEEL_ANGLE_PRECISION))
DS4LightBar.forcedFlash[device] = 2;
else
DS4LightBar.forcedFlash[device] = 0;
DS4LightBar.forcelight[device] = true;
LogToGuiSACalibrationDebugMsg($"Calibration values ({gyroAccelX}, {gyroAccelZ}) angle={result / (1.0 * C_WHEEL_ANGLE_PRECISION)}\n");
}
else
{
// Re-calibration completed or cancelled. Set lightbar color back to normal color
DS4LightBar.forcedFlash[device] = 0;
DS4LightBar.forcedColor[device] = Global.getMainColor(device);
DS4LightBar.forcelight[device] = false;
DS4LightBar.updateLightBar(controller, device);
}
}
protected static Int32 Scale360degreeGyroAxis(int device, DS4StateExposed exposedState, ControlService ctrl)
{
unchecked
{
DS4Device controller;
DS4State currentDeviceState;
int gyroAccelX, gyroAccelZ;
int result;
controller = ctrl.DS4Controllers[device];
if (controller == null) return 0;
currentDeviceState = controller.getCurrentStateRef();
// If calibration is active then do the calibration process instead of the normal "angle calculation"
if (controller.WheelRecalibrateActiveState > 0)
{
SAWheelEmulationCalibration(device, exposedState, ctrl, currentDeviceState, controller);
// Return center wheel position while SA wheel emuation is being calibrated
return 0;
}
gyroAccelX = exposedState.getAccelX();
gyroAccelZ = exposedState.getAccelZ();
//gyroAccelX = exposedState.OutputAccelX;
//gyroAccelZ = exposedState.OutputAccelZ;
// If calibration values are missing then use "educated guesses" about good starting values
if (controller.wheelCenterPoint.IsEmpty)
{
if (!Global.LoadControllerConfigs(controller))
{
AppLogger.LogToGui($"Controller {ctrl.x360Bus.FirstController + device} sixaxis steering wheel calibration data missing. It is recommended to run steering wheel calibration process by pressing SASteeringWheelEmulationCalibration special action key. Using estimated values until the controller is calibrated at least once.", false);
// Use current controller position as "center point". Assume DS4Windows was started while controller was hold in center position (yes, dangerous assumption but can't do much until controller is calibrated)
controller.wheelCenterPoint.X = gyroAccelX;
controller.wheelCenterPoint.Y = gyroAccelZ;
controller.wheel90DegPointRight.X = controller.wheelCenterPoint.X + 113;
controller.wheel90DegPointRight.Y = controller.wheelCenterPoint.Y + 110;
controller.wheel90DegPointLeft.X = controller.wheelCenterPoint.X - 127;
controller.wheel90DegPointLeft.Y = controller.wheel90DegPointRight.Y;
}
controller.wheelCircleCenterPointRight.X = controller.wheelCenterPoint.X;
controller.wheelCircleCenterPointRight.Y = controller.wheel90DegPointRight.Y;
controller.wheelCircleCenterPointLeft.X = controller.wheelCenterPoint.X;
controller.wheelCircleCenterPointLeft.Y = controller.wheel90DegPointLeft.Y;
AppLogger.LogToGui($"Controller {ctrl.x360Bus.FirstController + device} steering wheel emulation calibration values. center=({controller.wheelCenterPoint.X}, {controller.wheelCenterPoint.Y}) 90L=({controller.wheel90DegPointLeft.X}, {controller.wheel90DegPointLeft.Y}) 90R=({controller.wheel90DegPointRight.X}, {controller.wheel90DegPointRight.Y})", false);
controller.wheelPrevRecalibrateTime = DateTime.Now;
}
int maxRangeRight = Global.GetSASteeringWheelEmulationRange(device) / 2 * C_WHEEL_ANGLE_PRECISION;
int maxRangeLeft = -maxRangeRight;
result = CalculateControllerAngle(gyroAccelX, gyroAccelZ, controller);
// Apply deadzone (SA X-deadzone value). This code assumes that 20deg is the max deadzone anyone ever might wanna use (in practice effective deadzone
// is probably just few degrees by using SXDeadZone values 0.01...0.05)
double sxDead = getSXDeadzone(device);
if (sxDead > 0 && result != 0 && Math.Abs(result) < (20.0 * C_WHEEL_ANGLE_PRECISION * sxDead))
{
result = 0;
}
// If wrapped around from +180 to -180 side (or vice versa) then SA steering wheel keeps on turning beyond 360 degrees (if range is >360)
int wheelFullTurnCount = controller.wheelFullTurnCount;
if (controller.wheelPrevPhysicalAngle < 0 && result > 0)
{
if ((result - controller.wheelPrevPhysicalAngle) > 180 * C_WHEEL_ANGLE_PRECISION)
if (maxRangeRight > 360 * C_WHEEL_ANGLE_PRECISION)
wheelFullTurnCount--;
else
result = maxRangeLeft;
}
else if (controller.wheelPrevPhysicalAngle > 0 && result < 0)
{
if ((controller.wheelPrevPhysicalAngle - result) > 180 * C_WHEEL_ANGLE_PRECISION)
if (maxRangeRight > 360 * C_WHEEL_ANGLE_PRECISION)
wheelFullTurnCount++;
else
result = maxRangeRight;
}
controller.wheelPrevPhysicalAngle = result;
if (wheelFullTurnCount != 0)
{
if (wheelFullTurnCount > 0)
result = (wheelFullTurnCount * 180 * C_WHEEL_ANGLE_PRECISION) + ((wheelFullTurnCount * 180 * C_WHEEL_ANGLE_PRECISION) + result);
else
result = (wheelFullTurnCount * 180 * C_WHEEL_ANGLE_PRECISION) - ((wheelFullTurnCount * -180 * C_WHEEL_ANGLE_PRECISION) - result);
}
// If the new angle is more than 180 degrees further away then this is probably bogus value (controller shaking too much and gyro and velocity sensors went crazy).
// Accept the new angle only when the new angle is within a "stability threshold", otherwise use the previous full angle value.
if (Math.Abs(result - controller.wheelPrevFullAngle) <= 180 * C_WHEEL_ANGLE_PRECISION)
{
controller.wheelPrevFullAngle = result;
controller.wheelFullTurnCount = wheelFullTurnCount;
}
else
{
result = controller.wheelPrevFullAngle;
}
result = Mapping.ClampInt(maxRangeLeft, result, maxRangeRight);
// Debug log output of SA sensor values
//LogToGuiSACalibrationDebugMsg($"DBG gyro=({gyroAccelX}, {gyroAccelZ}) output=({exposedState.OutputAccelX}, {exposedState.OutputAccelZ}) PitRolYaw=({currentDeviceState.Motion.gyroPitch}, {currentDeviceState.Motion.gyroRoll}, {currentDeviceState.Motion.gyroYaw}) VelPitRolYaw=({currentDeviceState.Motion.angVelPitch}, {currentDeviceState.Motion.angVelRoll}, {currentDeviceState.Motion.angVelYaw}) angle={result / (1.0 * C_WHEEL_ANGLE_PRECISION)} fullTurns={controller.wheelFullTurnCount}", false);
// Apply anti-deadzone (SA X-antideadzone value)
double sxAntiDead = getSXAntiDeadzone(device);
switch (Global.GetSASteeringWheelEmulationAxis(device))
{
case SASteeringWheelEmulationAxisType.LX:
case SASteeringWheelEmulationAxisType.LY:
case SASteeringWheelEmulationAxisType.RX:
case SASteeringWheelEmulationAxisType.RY:
// DS4 thumbstick axis output (-32768..32767 raw value range)
//return (((result - maxRangeLeft) * (32767 - (-32768))) / (maxRangeRight - maxRangeLeft)) + (-32768);
if (result == 0) return 0;
if (sxAntiDead > 0)
{
sxAntiDead *= 32767;
if (result < 0) return (((result - maxRangeLeft) * (-Convert.ToInt32(sxAntiDead) - (-32768))) / (0 - maxRangeLeft)) + (-32768);
else return (((result - 0) * (32767 - (Convert.ToInt32(sxAntiDead)))) / (maxRangeRight - 0)) + (Convert.ToInt32(sxAntiDead));
}
else
{
return (((result - maxRangeLeft) * (32767 - (-32768))) / (maxRangeRight - maxRangeLeft)) + (-32768);
}
case SASteeringWheelEmulationAxisType.L2R2:
// DS4 Trigger axis output. L2+R2 triggers share the same axis in x360 xInput/DInput controller,
// so L2+R2 steering output supports only 360 turn range (-255..255 raw value range in the shared trigger axis)
// return (((result - (-180)) * (255 - (-255))) / (180 - (-180))) + (-255);
if (result == 0) return 0;
result = Convert.ToInt32(Math.Round(result / (1.0 * C_WHEEL_ANGLE_PRECISION)));
if (result < 0) result = -181 - result;
if (sxAntiDead > 0)
{
sxAntiDead *= 255;
if (result < 0) return (((result - (-180)) * (-Convert.ToInt32(sxAntiDead) - (-255))) / (0 - (-180))) + (-255);
else return (((result - (0)) * (255 - (Convert.ToInt32(sxAntiDead)))) / (180 - (0))) + (Convert.ToInt32(sxAntiDead));
}
else
{
return (((result - (-180)) * (255 - (-255))) / (180 - (-180))) + (-255);
}
case SASteeringWheelEmulationAxisType.VJoy1X:
case SASteeringWheelEmulationAxisType.VJoy1Y:
case SASteeringWheelEmulationAxisType.VJoy1Z:
case SASteeringWheelEmulationAxisType.VJoy2X:
case SASteeringWheelEmulationAxisType.VJoy2Y:
case SASteeringWheelEmulationAxisType.VJoy2Z:
// SASteeringWheelEmulationAxisType.VJoy1X/VJoy1Y/VJoy1Z/VJoy2X/VJoy2Y/VJoy2Z VJoy axis output (0..32767 raw value range by default)
// return (((result - maxRangeLeft) * (32767 - (-0))) / (maxRangeRight - maxRangeLeft)) + (-0);
if (result == 0) return 16384;
if (sxAntiDead > 0)
{
sxAntiDead *= 16384;
if (result < 0) return (((result - maxRangeLeft) * (16384 - Convert.ToInt32(sxAntiDead) - (-0))) / (0 - maxRangeLeft)) + (-0);
else return (((result - 0) * (32767 - (16384 + Convert.ToInt32(sxAntiDead)))) / (maxRangeRight - 0)) + (16384 + Convert.ToInt32(sxAntiDead));
}
else
{
return (((result - maxRangeLeft) * (32767 - (-0))) / (maxRangeRight - maxRangeLeft)) + (-0);
}
default:
// Should never come here, but C# case statement syntax requires DEFAULT handler
return 0;
}
}
}
// END: SixAxis steering wheel emulation logic
}
}

View File

@ -20,6 +20,8 @@ namespace DS4Windows
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, SwipeLeft, SwipeRight, SwipeUp, SwipeDown };
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 };
public enum SASteeringWheelEmulationAxisType: byte { None = 0, LX, LY, RX, RY, L2R2, VJoy1X, VJoy1Y, VJoy1Z, VJoy2X, VJoy2Y, VJoy2Z };
public class DS4ControlSettings
{
public DS4Controls control;
@ -270,6 +272,7 @@ namespace DS4Windows
m_Config.m_Profile = appdatapath + "\\Profiles.xml";
m_Config.m_Actions = appdatapath + "\\Actions.xml";
m_Config.m_linkedProfiles = Global.appdatapath + "\\LinkedProfiles.xml";
m_Config.m_controllerConfigs = Global.appdatapath + "\\ControllerConfigs.xml";
}
/// <summary>
@ -730,6 +733,18 @@ namespace DS4Windows
m_Config.SetSaTriggerCond(index, text);
}
public static SASteeringWheelEmulationAxisType[] SASteeringWheelEmulationAxis => m_Config.sASteeringWheelEmulationAxis;
public static SASteeringWheelEmulationAxisType GetSASteeringWheelEmulationAxis(int index)
{
return m_Config.sASteeringWheelEmulationAxis[index];
}
public static int[] SASteeringWheelEmulationRange => m_Config.sASteeringWheelEmulationRange;
public static int GetSASteeringWheelEmulationRange(int index)
{
return m_Config.sASteeringWheelEmulationRange[index];
}
public static int[][] TouchDisInvertTriggers => m_Config.touchDisInvertTriggers;
public static int[] getTouchDisInvertTriggers(int index)
{
@ -1312,6 +1327,30 @@ namespace DS4Windows
return m_Config.LoadLinkedProfiles();
}
public static bool SaveControllerConfigs(DS4Device device = null)
{
if (device != null)
return m_Config.SaveControllerConfigsForDevice(device);
for (int idx = 0; idx < ControlService.DS4_CONTROLLER_COUNT; idx++)
if (Program.rootHub.DS4Controllers[idx] != null)
m_Config.SaveControllerConfigsForDevice(Program.rootHub.DS4Controllers[idx]);
return true;
}
public static bool LoadControllerConfigs(DS4Device device = null)
{
if (device != null)
return m_Config.LoadControllerConfigsForDevice(device);
for (int idx = 0; idx < ControlService.DS4_CONTROLLER_COUNT; idx++)
if (Program.rootHub.DS4Controllers[idx] != null)
m_Config.LoadControllerConfigsForDevice(Program.rootHub.DS4Controllers[idx]);
return true;
}
private static byte applyRatio(byte b1, byte b2, double r)
{
if (r > 100.0)
@ -1413,6 +1452,7 @@ namespace DS4Windows
public String m_Profile = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + "\\Profiles.xml";
public String m_Actions = Global.appdatapath + "\\Actions.xml";
public string m_linkedProfiles = Global.appdatapath + "\\LinkedProfiles.xml";
public string m_controllerConfigs = Global.appdatapath + "\\ControllerConfigs.xml";
protected XmlDocument m_Xdoc = new XmlDocument();
// fifth value used for options, not fifth controller
@ -1517,6 +1557,8 @@ namespace DS4Windows
public bool[] useSAforMouse = new bool[5] { false, false, false, false, false };
public string[] sATriggers = new string[5] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
public bool[] sATriggerCond = new bool[5] { true, true, true, true, true };
public SASteeringWheelEmulationAxisType[] sASteeringWheelEmulationAxis = new SASteeringWheelEmulationAxisType[5] { SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None };
public int[] sASteeringWheelEmulationRange = new int[5] { 360, 360, 360, 360, 360 };
public int[][] touchDisInvertTriggers = new int[5][] { new int[1] { -1 }, new int[1] { -1 }, new int[1] { -1 },
new int[1] { -1 }, new int[1] { -1 } };
public int[] lsCurve = new int[5] { 0, 0, 0, 0, 0 };
@ -1781,6 +1823,8 @@ namespace DS4Windows
XmlNode xmlUseSAforMouse = m_Xdoc.CreateNode(XmlNodeType.Element, "UseSAforMouse", null); xmlUseSAforMouse.InnerText = useSAforMouse[device].ToString(); Node.AppendChild(xmlUseSAforMouse);
XmlNode xmlSATriggers = m_Xdoc.CreateNode(XmlNodeType.Element, "SATriggers", null); xmlSATriggers.InnerText = sATriggers[device].ToString(); Node.AppendChild(xmlSATriggers);
XmlNode xmlSATriggerCond = m_Xdoc.CreateNode(XmlNodeType.Element, "SATriggerCond", null); xmlSATriggerCond.InnerText = SaTriggerCondString(sATriggerCond[device]); Node.AppendChild(xmlSATriggerCond);
XmlNode xmlSASteeringWheelEmulationAxis = m_Xdoc.CreateNode(XmlNodeType.Element, "SASteeringWheelEmulationAxis", null); xmlSASteeringWheelEmulationAxis.InnerText = sASteeringWheelEmulationAxis[device].ToString("G"); Node.AppendChild(xmlSASteeringWheelEmulationAxis);
XmlNode xmlSASteeringWheelEmulationRange = m_Xdoc.CreateNode(XmlNodeType.Element, "SASteeringWheelEmulationRange", null); xmlSASteeringWheelEmulationRange.InnerText = sASteeringWheelEmulationRange[device].ToString(); Node.AppendChild(xmlSASteeringWheelEmulationRange);
XmlNode xmlTouchDisInvTriggers = m_Xdoc.CreateNode(XmlNodeType.Element, "TouchDisInvTriggers", null);
string tempTouchDisInv = string.Join(",", touchDisInvertTriggers[device]);
@ -2652,7 +2696,14 @@ namespace DS4Windows
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SATriggerCond"); sATriggerCond[device] = SaTriggerCondValue(Item.InnerText); }
catch { sATriggerCond[device] = true; missingSetting = true; }
try {
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SASteeringWheelEmulationAxis"); SASteeringWheelEmulationAxisType.TryParse(Item.InnerText, out sASteeringWheelEmulationAxis[device]); }
catch { sASteeringWheelEmulationAxis[device] = SASteeringWheelEmulationAxisType.None; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SASteeringWheelEmulationRange"); int.TryParse(Item.InnerText, out sASteeringWheelEmulationRange[device]); }
catch { sASteeringWheelEmulationRange[device] = 360; missingSetting = true; }
try
{
Item = m_Xdoc.SelectSingleNode("/" + rootname + "/TouchDisInvTriggers");
string[] triggers = Item.InnerText.Split(',');
int temp = -1;
@ -3304,6 +3355,10 @@ namespace DS4Windows
el.AppendChild(m_Xdoc.CreateElement("Type")).InnerText = "MultiAction";
el.AppendChild(m_Xdoc.CreateElement("Details")).InnerText = details;
break;
case 8:
el.AppendChild(m_Xdoc.CreateElement("Type")).InnerText = "SASteeringWheelEmulationCalibrate";
el.AppendChild(m_Xdoc.CreateElement("Details")).InnerText = details;
break;
}
if (edit)
@ -3423,6 +3478,14 @@ namespace DS4Windows
{
actions.Add(new SpecialAction(name, controls, type, details));
}
else if (type == "SASteeringWheelEmulationCalibrate")
{
double doub;
if (double.TryParse(details, out doub))
actions.Add(new SpecialAction(name, controls, type, "", doub));
else
actions.Add(new SpecialAction(name, controls, type, ""));
}
}
}
catch { saved = false; }
@ -3530,6 +3593,107 @@ namespace DS4Windows
return saved;
}
public bool createControllerConfigs()
{
bool saved = true;
XmlDocument configXdoc = new XmlDocument();
XmlNode Node;
Node = configXdoc.CreateXmlDeclaration("1.0", "utf-8", string.Empty);
configXdoc.AppendChild(Node);
Node = configXdoc.CreateComment(string.Format(" Controller config data. {0} ", DateTime.Now));
configXdoc.AppendChild(Node);
Node = configXdoc.CreateWhitespace("\r\n");
configXdoc.AppendChild(Node);
Node = configXdoc.CreateNode(XmlNodeType.Element, "Controllers", "");
configXdoc.AppendChild(Node);
try { configXdoc.Save(m_controllerConfigs); }
catch (UnauthorizedAccessException) { AppLogger.LogToGui("Unauthorized Access - Save failed to path: " + m_controllerConfigs, false); saved = false; }
return saved;
}
public bool LoadControllerConfigsForDevice(DS4Device device)
{
bool loaded = false;
if (device == null) return false;
if (!File.Exists(m_controllerConfigs)) createControllerConfigs();
try
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(m_controllerConfigs);
XmlNode node = xmlDoc.SelectSingleNode("/Controllers/Controller[@Mac=\"" + device.getMacAddress() + "\"]");
if (node != null)
{
Int32 intValue;
if (Int32.TryParse(node["wheelCenterPoint"].InnerText.Split(',')[0], out intValue)) device.wheelCenterPoint.X = intValue;
if (Int32.TryParse(node["wheelCenterPoint"].InnerText.Split(',')[1], out intValue)) device.wheelCenterPoint.Y = intValue;
if (Int32.TryParse(node["wheel90DegPointLeft"].InnerText.Split(',')[0], out intValue)) device.wheel90DegPointLeft.X = intValue;
if (Int32.TryParse(node["wheel90DegPointLeft"].InnerText.Split(',')[1], out intValue)) device.wheel90DegPointLeft.Y = intValue;
if (Int32.TryParse(node["wheel90DegPointRight"].InnerText.Split(',')[0], out intValue)) device.wheel90DegPointRight.X = intValue;
if (Int32.TryParse(node["wheel90DegPointRight"].InnerText.Split(',')[1], out intValue)) device.wheel90DegPointRight.Y = intValue;
loaded = true;
}
}
catch
{
AppLogger.LogToGui("ControllerConfigs.xml can't be found.", false);
loaded = false;
}
return loaded;
}
public bool SaveControllerConfigsForDevice(DS4Device device)
{
bool saved = true;
if (device == null) return false;
if (!File.Exists(m_controllerConfigs)) createControllerConfigs();
try
{
//XmlNode node = null;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(m_controllerConfigs);
XmlNode node = xmlDoc.SelectSingleNode("/Controllers/Controller[@Mac=\"" + device.getMacAddress() + "\"]");
if (node == null)
{
XmlNode xmlControllersNode = xmlDoc.SelectSingleNode("/Controllers");
XmlElement el = xmlDoc.CreateElement("Controller");
el.SetAttribute("Mac", device.getMacAddress());
el.AppendChild(xmlDoc.CreateElement("wheelCenterPoint"));
el.AppendChild(xmlDoc.CreateElement("wheel90DegPointLeft"));
el.AppendChild(xmlDoc.CreateElement("wheel90DegPointRight"));
node = xmlControllersNode.AppendChild(el);
}
node["wheelCenterPoint"].InnerText = $"{device.wheelCenterPoint.X},{device.wheelCenterPoint.Y}";
node["wheel90DegPointLeft"].InnerText = $"{device.wheel90DegPointLeft.X},{device.wheel90DegPointLeft.Y}";
node["wheel90DegPointRight"].InnerText = $"{device.wheel90DegPointRight.X},{device.wheel90DegPointRight.Y}";
xmlDoc.Save(m_controllerConfigs);
}
catch (UnauthorizedAccessException)
{
AppLogger.LogToGui("Unauthorized Access - Save failed to path: " + m_controllerConfigs, false);
saved = false;
}
return saved;
}
public void UpdateDS4CSetting(int deviceNum, string buttonName, bool shift, object action, string exts, DS4KeyType kt, int trigger = 0)
{
DS4Controls dc;
@ -3830,6 +3994,8 @@ namespace DS4Windows
useSAforMouse[device] = false;
sATriggers[device] = string.Empty;
sATriggerCond[device] = true;
sASteeringWheelEmulationAxis[device] = SASteeringWheelEmulationAxisType.None;
sASteeringWheelEmulationRange[device] = 360;
touchDisInvertTriggers[device] = new int[1] { -1 };
lsCurve[device] = rsCurve[device] = 0;
gyroSensitivity[device] = 100;
@ -3851,7 +4017,7 @@ namespace DS4Windows
public class SpecialAction
{
public enum ActionTypeId { None, Key, Program, Profile, Macro, DisconnectBT, BatteryCheck, MultiAction, XboxGameDVR }
public enum ActionTypeId { None, Key, Program, Profile, Macro, DisconnectBT, BatteryCheck, MultiAction, XboxGameDVR, SASteeringWheelEmulationCalibrate }
public string name;
public List<DS4Controls> trigger = new List<DS4Controls>();
@ -3969,6 +4135,10 @@ namespace DS4Windows
type = "MultiAction";
this.details = string.Join(",", macros);
}
else if (type == "SASteeringWheelEmulationCalibrate")
{
typeID = ActionTypeId.SASteeringWheelEmulationCalibrate;
}
else
this.details = details;

View File

@ -100,7 +100,7 @@ namespace DS4Windows
Output[4] = (Byte)(device + firstController);
Output[9] = 0x14;
for (int i = 10, outLen = Output.Length; i < outLen; i++)
for (int i = 10; i < 28; i++)
{
Output[i] = 0;
}
@ -127,13 +127,78 @@ namespace DS4Windows
if (state.PS) Output[11] |= (Byte)(1 << 2); // Guide
SASteeringWheelEmulationAxisType steeringWheelMappedAxis = Global.GetSASteeringWheelEmulationAxis(device);
Int32 ThumbLX;
Int32 ThumbLY;
Int32 ThumbRX;
Int32 ThumbRY;
Output[12] = state.L2; // Left Trigger
Output[13] = state.R2; // Right Trigger
Int32 ThumbLX = Scale(state.LX, false);
Int32 ThumbLY = Scale(state.LY, true);
Int32 ThumbRX = Scale(state.RX, false);
Int32 ThumbRY = Scale(state.RY, true);
switch(steeringWheelMappedAxis)
{
case SASteeringWheelEmulationAxisType.None:
ThumbLX = Scale(state.LX, false);
ThumbLY = Scale(state.LY, true);
ThumbRX = Scale(state.RX, false);
ThumbRY = Scale(state.RY, true);
break;
case SASteeringWheelEmulationAxisType.LX:
ThumbLX = state.SASteeringWheelEmulationUnit;
ThumbLY = Scale(state.LY, true);
ThumbRX = Scale(state.RX, false);
ThumbRY = Scale(state.RY, true);
break;
case SASteeringWheelEmulationAxisType.LY:
ThumbLX = Scale(state.LX, false);
ThumbLY = state.SASteeringWheelEmulationUnit;
ThumbRX = Scale(state.RX, false);
ThumbRY = Scale(state.RY, true);
break;
case SASteeringWheelEmulationAxisType.RX:
ThumbLX = Scale(state.LX, false);
ThumbLY = Scale(state.LY, true);
ThumbRX = state.SASteeringWheelEmulationUnit;
ThumbRY = Scale(state.RY, true);
break;
case SASteeringWheelEmulationAxisType.RY:
ThumbLX = Scale(state.LX, false);
ThumbLY = Scale(state.LY, true);
ThumbRX = Scale(state.RX, false);
ThumbRY = state.SASteeringWheelEmulationUnit;
break;
case SASteeringWheelEmulationAxisType.L2R2:
Output[12] = Output[13] = 0;
if (state.SASteeringWheelEmulationUnit >= 0) Output[12] = (Byte)state.SASteeringWheelEmulationUnit;
else Output[13] = (Byte)state.SASteeringWheelEmulationUnit;
goto case SASteeringWheelEmulationAxisType.None;
case SASteeringWheelEmulationAxisType.VJoy1X:
case SASteeringWheelEmulationAxisType.VJoy2X:
DS4Windows.VJoyFeeder.vJoyFeeder.FeedAxisValue(state.SASteeringWheelEmulationUnit, ((((uint)steeringWheelMappedAxis) - ((uint)SASteeringWheelEmulationAxisType.VJoy1X)) / 3) + 1, DS4Windows.VJoyFeeder.HID_USAGES.HID_USAGE_X);
goto case SASteeringWheelEmulationAxisType.None;
case SASteeringWheelEmulationAxisType.VJoy1Y:
case SASteeringWheelEmulationAxisType.VJoy2Y:
DS4Windows.VJoyFeeder.vJoyFeeder.FeedAxisValue(state.SASteeringWheelEmulationUnit, ((((uint)steeringWheelMappedAxis) - ((uint)SASteeringWheelEmulationAxisType.VJoy1X)) / 3) + 1, DS4Windows.VJoyFeeder.HID_USAGES.HID_USAGE_Y);
goto case SASteeringWheelEmulationAxisType.None;
case SASteeringWheelEmulationAxisType.VJoy1Z:
case SASteeringWheelEmulationAxisType.VJoy2Z:
DS4Windows.VJoyFeeder.vJoyFeeder.FeedAxisValue(state.SASteeringWheelEmulationUnit, ((((uint)steeringWheelMappedAxis) - ((uint)SASteeringWheelEmulationAxisType.VJoy1X)) / 3) + 1, DS4Windows.VJoyFeeder.HID_USAGES.HID_USAGE_Z);
goto case SASteeringWheelEmulationAxisType.None;
default:
// Should never come here but just in case use the NONE case as default handler....
goto case SASteeringWheelEmulationAxisType.None;
}
Output[14] = (Byte)((ThumbLX >> 0) & 0xFF); // LX
Output[15] = (Byte)((ThumbLX >> 8) & 0xFF);
Output[16] = (Byte)((ThumbLY >> 0) & 0xFF); // LY

View File

@ -188,6 +188,11 @@
this.lbGyroXP = new System.Windows.Forms.Label();
this.bnGyroXN = new System.Windows.Forms.Button();
this.lbGyroXN = new System.Windows.Forms.Label();
this.lblSteeringWheelEmulationAxis = new System.Windows.Forms.Label();
this.cBSteeringWheelEmulationAxis = new System.Windows.Forms.ComboBox();
this.lblSteeringWheelEmulationRange = new System.Windows.Forms.Label();
this.cBSteeringWheelEmulationRange = new System.Windows.Forms.ComboBox();
this.btnSteeringWheelEmulationCalibrate = new System.Windows.Forms.Button();
this.tCControls = new System.Windows.Forms.TabControl();
this.tPControls = new System.Windows.Forms.TabPage();
this.lBControls = new System.Windows.Forms.ListBox();
@ -1860,6 +1865,11 @@
this.fLPTiltControls.Controls.Add(this.lbGyroXP);
this.fLPTiltControls.Controls.Add(this.bnGyroXN);
this.fLPTiltControls.Controls.Add(this.lbGyroXN);
this.fLPTiltControls.Controls.Add(this.lblSteeringWheelEmulationAxis);
this.fLPTiltControls.Controls.Add(this.cBSteeringWheelEmulationAxis);
this.fLPTiltControls.Controls.Add(this.lblSteeringWheelEmulationRange);
this.fLPTiltControls.Controls.Add(this.cBSteeringWheelEmulationRange);
this.fLPTiltControls.Controls.Add(this.btnSteeringWheelEmulationCalibrate);
resources.ApplyResources(this.fLPTiltControls, "fLPTiltControls");
this.fLPTiltControls.Name = "fLPTiltControls";
//
@ -1915,6 +1925,62 @@
resources.ApplyResources(this.lbGyroXN, "lbGyroXN");
this.lbGyroXN.Name = "lbGyroXN";
//
// lblSteeringWheelEmulationAxis
//
resources.ApplyResources(this.lblSteeringWheelEmulationAxis, "lblSteeringWheelEmulationAxis");
this.lblSteeringWheelEmulationAxis.Name = "lblSteeringWheelEmulationAxis";
//
// cBSteeringWheelEmulationAxis
//
this.cBSteeringWheelEmulationAxis.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBSteeringWheelEmulationAxis.FormattingEnabled = true;
this.cBSteeringWheelEmulationAxis.Items.AddRange(new object[] {
resources.GetString("cBSteeringWheelEmulationAxis.Items"),
resources.GetString("cBSteeringWheelEmulationAxis.Items1"),
resources.GetString("cBSteeringWheelEmulationAxis.Items2"),
resources.GetString("cBSteeringWheelEmulationAxis.Items3"),
resources.GetString("cBSteeringWheelEmulationAxis.Items4"),
resources.GetString("cBSteeringWheelEmulationAxis.Items5"),
resources.GetString("cBSteeringWheelEmulationAxis.Items6"),
resources.GetString("cBSteeringWheelEmulationAxis.Items7"),
resources.GetString("cBSteeringWheelEmulationAxis.Items8"),
resources.GetString("cBSteeringWheelEmulationAxis.Items9"),
resources.GetString("cBSteeringWheelEmulationAxis.Items10"),
resources.GetString("cBSteeringWheelEmulationAxis.Items11")});
resources.ApplyResources(this.cBSteeringWheelEmulationAxis, "cBSteeringWheelEmulationAxis");
this.cBSteeringWheelEmulationAxis.Name = "cBSteeringWheelEmulationAxis";
this.cBSteeringWheelEmulationAxis.SelectedIndexChanged += new System.EventHandler(this.cBSteeringWheelEmulationAxis_SelectedIndexChanged);
//
// lblSteeringWheelEmulationRange
//
resources.ApplyResources(this.lblSteeringWheelEmulationRange, "lblSteeringWheelEmulationRange");
this.lblSteeringWheelEmulationRange.Name = "lblSteeringWheelEmulationRange";
//
// cBSteeringWheelEmulationRange
//
this.cBSteeringWheelEmulationRange.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBSteeringWheelEmulationRange.FormattingEnabled = true;
this.cBSteeringWheelEmulationRange.Items.AddRange(new object[] {
resources.GetString("cBSteeringWheelEmulationRange.Items"),
resources.GetString("cBSteeringWheelEmulationRange.Items1"),
resources.GetString("cBSteeringWheelEmulationRange.Items2"),
resources.GetString("cBSteeringWheelEmulationRange.Items3"),
resources.GetString("cBSteeringWheelEmulationRange.Items4"),
resources.GetString("cBSteeringWheelEmulationRange.Items5"),
resources.GetString("cBSteeringWheelEmulationRange.Items6"),
resources.GetString("cBSteeringWheelEmulationRange.Items7"),
resources.GetString("cBSteeringWheelEmulationRange.Items8")});
resources.ApplyResources(this.cBSteeringWheelEmulationRange, "cBSteeringWheelEmulationRange");
this.cBSteeringWheelEmulationRange.Name = "cBSteeringWheelEmulationRange";
this.cBSteeringWheelEmulationRange.SelectedIndexChanged += new System.EventHandler(this.cBSteeringWheelEmulationRange_SelectedIndexChanged);
//
// btnSteeringWheelEmulationCalibrate
//
resources.ApplyResources(this.btnSteeringWheelEmulationCalibrate, "btnSteeringWheelEmulationCalibrate");
this.btnSteeringWheelEmulationCalibrate.Name = "btnSteeringWheelEmulationCalibrate";
this.btnSteeringWheelEmulationCalibrate.UseVisualStyleBackColor = true;
this.btnSteeringWheelEmulationCalibrate.Click += new System.EventHandler(this.btnSteeringWheelEmulationCalibrate_Click);
//
// tCControls
//
this.tCControls.Controls.Add(this.tPControls);
@ -3372,8 +3438,8 @@
this.gBGyro.BackColor = System.Drawing.SystemColors.Control;
this.gBGyro.Controls.Add(this.rBSAControls);
this.gBGyro.Controls.Add(this.rBSAMouse);
this.gBGyro.Controls.Add(this.pnlSAMouse);
this.gBGyro.Controls.Add(this.fLPTiltControls);
this.gBGyro.Controls.Add(this.pnlSAMouse);
resources.ApplyResources(this.gBGyro, "gBGyro");
this.gBGyro.Name = "gBGyro";
this.gBGyro.TabStop = false;
@ -4651,6 +4717,11 @@
private System.Windows.Forms.CheckBox trackballCk;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.ComboBox triggerCondAndCombo;
private System.Windows.Forms.Label lblSteeringWheelEmulationAxis;
private System.Windows.Forms.ComboBox cBSteeringWheelEmulationAxis;
private System.Windows.Forms.Label lblSteeringWheelEmulationRange;
private System.Windows.Forms.ComboBox cBSteeringWheelEmulationRange;
private System.Windows.Forms.Button btnSteeringWheelEmulationCalibrate;
private System.Windows.Forms.Label label27;
private System.Windows.Forms.NumericUpDown gyroMouseDzNUD;
private System.Windows.Forms.CheckBox toggleGyroMCb;

View File

@ -720,6 +720,11 @@ namespace DS4Windows
triggerCondAndCombo.SelectedIndex = SATriggerCond[device] ? 0 : 1;
gyroMouseDzNUD.Value = GyroMouseDeadZone[device];
toggleGyroMCb.Checked = GyroMouseToggle[device];
cBSteeringWheelEmulationAxis.SelectedIndex = (int) GetSASteeringWheelEmulationAxis(device);
int idxSASteeringWheelEmulationRange = cBSteeringWheelEmulationRange.Items.IndexOf(GetSASteeringWheelEmulationRange(device).ToString());
if (idxSASteeringWheelEmulationRange >= 0) cBSteeringWheelEmulationRange.SelectedIndex = idxSASteeringWheelEmulationRange;
}
else
{
@ -840,6 +845,8 @@ namespace DS4Windows
toggleGyroMCb.Checked = false;
cBGyroMouseXAxis.SelectedIndex = 0;
triggerCondAndCombo.SelectedIndex = 0;
cBSteeringWheelEmulationAxis.SelectedIndex = 0;
cBSteeringWheelEmulationRange.SelectedIndex = cBSteeringWheelEmulationRange.Items.IndexOf("360");
Set();
}
@ -877,6 +884,9 @@ namespace DS4Windows
case "MultiAction":
lvi.SubItems.Add(Properties.Resources.MultiAction);
break;
case "SASteeringWheelEmulationCalibrate":
lvi.SubItems.Add(Properties.Resources.SASteeringWheelEmulationCalibrate);
break;
}
if (newp)
@ -2997,6 +3007,78 @@ namespace DS4Windows
}
}
private void cBSteeringWheelEmulationRange_SelectedIndexChanged(object sender, EventArgs e)
{
if (loading == false)
{
SASteeringWheelEmulationRange[device] = Convert.ToInt32(cBSteeringWheelEmulationRange.Items[cBSteeringWheelEmulationRange.SelectedIndex].ToString());
}
}
private void cBSteeringWheelEmulationAxis_SelectedIndexChanged(object sender, EventArgs e)
{
if (loading == false)
{
if (cBSteeringWheelEmulationAxis.SelectedIndex >= 0) SASteeringWheelEmulationAxis[device] = (SASteeringWheelEmulationAxisType) ((byte) cBSteeringWheelEmulationAxis.SelectedIndex);
else SASteeringWheelEmulationAxis[device] = SASteeringWheelEmulationAxisType.None;
}
}
private void btnSteeringWheelEmulationCalibrate_Click(object sender, EventArgs e)
{
if(cBSteeringWheelEmulationAxis.SelectedIndex > 0)
{
DS4Device d;
int tempDeviceNum = (int)nUDSixaxis.Value - 1;
d = Program.rootHub.DS4Controllers[tempDeviceNum];
if (d != null)
{
Point origWheelCenterPoint = new Point(d.wheelCenterPoint.X, d.wheelCenterPoint.Y);
Point origWheel90DegPointLeft = new Point(d.wheel90DegPointLeft.X, d.wheel90DegPointLeft.Y);
Point origWheel90DegPointRight = new Point(d.wheel90DegPointRight.X, d.wheel90DegPointRight.Y);
d.WheelRecalibrateActiveState = 1;
DialogResult msgBoxResult = MessageBox.Show($"{Properties.Resources.SASteeringWheelEmulationCalibrate}.\n\n" +
$"{Properties.Resources.SASteeringWheelEmulationCalibrateInstruction1}.\n" +
$"{Properties.Resources.SASteeringWheelEmulationCalibrateInstruction2}.\n" +
$"{Properties.Resources.SASteeringWheelEmulationCalibrateInstruction3}.\n\n" +
$"{Properties.Resources.SASteeringWheelEmulationCalibrateInstruction}.\n",
Properties.Resources.SASteeringWheelEmulationCalibrate,
MessageBoxButtons.OKCancel,
MessageBoxIcon.Information,
MessageBoxDefaultButton.Button1,
0,
false);
if (msgBoxResult == DialogResult.OK)
{
// Accept new calibration values (State 3 is "Complete calibration" state)
d.WheelRecalibrateActiveState = 3;
}
else
{
// Cancel calibration and reset back to original calibration values
d.WheelRecalibrateActiveState = 4;
d.wheelFullTurnCount = 0;
d.wheelCenterPoint = origWheelCenterPoint;
d.wheel90DegPointLeft = origWheel90DegPointLeft;
d.wheel90DegPointRight = origWheel90DegPointRight;
}
}
else
{
MessageBox.Show($"{Properties.Resources.SASteeringWheelEmulationCalibrateNoControllerError}.");
}
}
else
{
MessageBox.Show($"{Properties.Resources.SASteeringWheelEmulationCalibrateNoneAxisError}.");
}
}
private void gyroMouseDzNUD_ValueChanged(object sender, EventArgs e)
{
if (loading == false)

View File

@ -4057,6 +4057,204 @@ with profile</value>
<data name="&gt;&gt;lbGyroXN.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="lblSteeringWheelEmulationAxis.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblSteeringWheelEmulationAxis.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lblSteeringWheelEmulationAxis.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 116</value>
</data>
<data name="lblSteeringWheelEmulationAxis.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 5, 0, 0</value>
</data>
<data name="lblSteeringWheelEmulationAxis.Size" type="System.Drawing.Size, System.Drawing">
<value>98, 18</value>
</data>
<data name="lblSteeringWheelEmulationAxis.TabIndex" type="System.Int32, mscorlib">
<value>290</value>
</data>
<data name="lblSteeringWheelEmulationAxis.Text" xml:space="preserve">
<value>Steering wheel axis</value>
</data>
<data name="&gt;&gt;lblSteeringWheelEmulationAxis.Name" xml:space="preserve">
<value>lblSteeringWheelEmulationAxis</value>
</data>
<data name="&gt;&gt;lblSteeringWheelEmulationAxis.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblSteeringWheelEmulationAxis.Parent" xml:space="preserve">
<value>fLPTiltControls</value>
</data>
<data name="&gt;&gt;lblSteeringWheelEmulationAxis.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items" xml:space="preserve">
<value>None</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items1" xml:space="preserve">
<value>Left X-Axis</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items2" xml:space="preserve">
<value>Left Y-Axis</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items3" xml:space="preserve">
<value>Right X-Axis</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items4" xml:space="preserve">
<value>Right Y-Axis</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items5" xml:space="preserve">
<value>Trigger L+R Axis</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items6" xml:space="preserve">
<value>VJoy1 X-Axis</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items7" xml:space="preserve">
<value>VJoy1 Y-Axis</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items8" xml:space="preserve">
<value>VJoy1 Z-Axis</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items9" xml:space="preserve">
<value>VJoy2 X-Axis</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items10" xml:space="preserve">
<value>VJoy2 Y-Axis</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Items11" xml:space="preserve">
<value>VJoy2 Z-Axis</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Location" type="System.Drawing.Point, System.Drawing">
<value>107, 119</value>
</data>
<data name="cBSteeringWheelEmulationAxis.Size" type="System.Drawing.Size, System.Drawing">
<value>110, 21</value>
</data>
<data name="cBSteeringWheelEmulationAxis.TabIndex" type="System.Int32, mscorlib">
<value>291</value>
</data>
<data name="&gt;&gt;cBSteeringWheelEmulationAxis.Name" xml:space="preserve">
<value>cBSteeringWheelEmulationAxis</value>
</data>
<data name="&gt;&gt;cBSteeringWheelEmulationAxis.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cBSteeringWheelEmulationAxis.Parent" xml:space="preserve">
<value>fLPTiltControls</value>
</data>
<data name="&gt;&gt;cBSteeringWheelEmulationAxis.ZOrder" xml:space="preserve">
<value>9</value>
</data>
<data name="lblSteeringWheelEmulationRange.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblSteeringWheelEmulationRange.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lblSteeringWheelEmulationRange.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 143</value>
</data>
<data name="lblSteeringWheelEmulationRange.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 5, 0, 0</value>
</data>
<data name="lblSteeringWheelEmulationRange.Size" type="System.Drawing.Size, System.Drawing">
<value>107, 18</value>
</data>
<data name="lblSteeringWheelEmulationRange.TabIndex" type="System.Int32, mscorlib">
<value>292</value>
</data>
<data name="lblSteeringWheelEmulationRange.Text" xml:space="preserve">
<value>Steering wheel range</value>
</data>
<data name="&gt;&gt;lblSteeringWheelEmulationRange.Name" xml:space="preserve">
<value>lblSteeringWheelEmulationRange</value>
</data>
<data name="&gt;&gt;lblSteeringWheelEmulationRange.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblSteeringWheelEmulationRange.Parent" xml:space="preserve">
<value>fLPTiltControls</value>
</data>
<data name="&gt;&gt;lblSteeringWheelEmulationRange.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="cBSteeringWheelEmulationRange.Items" xml:space="preserve">
<value>90</value>
</data>
<data name="cBSteeringWheelEmulationRange.Items1" xml:space="preserve">
<value>180</value>
</data>
<data name="cBSteeringWheelEmulationRange.Items2" xml:space="preserve">
<value>270</value>
</data>
<data name="cBSteeringWheelEmulationRange.Items3" xml:space="preserve">
<value>360</value>
</data>
<data name="cBSteeringWheelEmulationRange.Items4" xml:space="preserve">
<value>450</value>
</data>
<data name="cBSteeringWheelEmulationRange.Items5" xml:space="preserve">
<value>720</value>
</data>
<data name="cBSteeringWheelEmulationRange.Items6" xml:space="preserve">
<value>900</value>
</data>
<data name="cBSteeringWheelEmulationRange.Items7" xml:space="preserve">
<value>1080</value>
</data>
<data name="cBSteeringWheelEmulationRange.Items8" xml:space="preserve">
<value>1440</value>
</data>
<data name="cBSteeringWheelEmulationRange.Location" type="System.Drawing.Point, System.Drawing">
<value>116, 146</value>
</data>
<data name="cBSteeringWheelEmulationRange.Size" type="System.Drawing.Size, System.Drawing">
<value>60, 21</value>
</data>
<data name="cBSteeringWheelEmulationRange.TabIndex" type="System.Int32, mscorlib">
<value>293</value>
</data>
<data name="&gt;&gt;cBSteeringWheelEmulationRange.Name" xml:space="preserve">
<value>cBSteeringWheelEmulationRange</value>
</data>
<data name="&gt;&gt;cBSteeringWheelEmulationRange.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cBSteeringWheelEmulationRange.Parent" xml:space="preserve">
<value>fLPTiltControls</value>
</data>
<data name="&gt;&gt;cBSteeringWheelEmulationRange.ZOrder" xml:space="preserve">
<value>11</value>
</data>
<data name="btnSteeringWheelEmulationCalibrate.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnSteeringWheelEmulationCalibrate.Location" type="System.Drawing.Point, System.Drawing">
<value>182, 146</value>
</data>
<data name="btnSteeringWheelEmulationCalibrate.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="btnSteeringWheelEmulationCalibrate.TabIndex" type="System.Int32, mscorlib">
<value>294</value>
</data>
<data name="btnSteeringWheelEmulationCalibrate.Text" xml:space="preserve">
<value>Calibrate...</value>
</data>
<data name="&gt;&gt;btnSteeringWheelEmulationCalibrate.Name" xml:space="preserve">
<value>btnSteeringWheelEmulationCalibrate</value>
</data>
<data name="&gt;&gt;btnSteeringWheelEmulationCalibrate.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;btnSteeringWheelEmulationCalibrate.Parent" xml:space="preserve">
<value>fLPTiltControls</value>
</data>
<data name="&gt;&gt;btnSteeringWheelEmulationCalibrate.ZOrder" xml:space="preserve">
<value>12</value>
</data>
<data name="fLPTiltControls.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 43</value>
</data>
@ -4076,7 +4274,7 @@ with profile</value>
<value>gBGyro</value>
</data>
<data name="&gt;&gt;fLPTiltControls.ZOrder" xml:space="preserve">
<value>3</value>
<value>2</value>
</data>
<data name="tPControls.AutoScroll" type="System.Boolean, mscorlib">
<value>True</value>
@ -8393,7 +8591,7 @@ with profile</value>
<value>gBGyro</value>
</data>
<data name="&gt;&gt;pnlSAMouse.ZOrder" xml:space="preserve">
<value>2</value>
<value>3</value>
</data>
<data name="gBGyro.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 242</value>
@ -9056,7 +9254,7 @@ with profile</value>
<value>True</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>102</value>
<value>25</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>96, 96</value>

View File

@ -86,7 +86,6 @@
this.lbDTapDVR = new System.Windows.Forms.Label();
this.lbHoldDVR = new System.Windows.Forms.Label();
this.lbTapDVR = new System.Windows.Forms.Label();
this.advColorDialog = new DS4Windows.AdvancedColorDialog();
((System.ComponentModel.ISupportInitialize)(this.pBProgram)).BeginInit();
this.pnlProgram.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDProg)).BeginInit();
@ -221,7 +220,8 @@
resources.GetString("cBActions.Items4"),
resources.GetString("cBActions.Items5"),
resources.GetString("cBActions.Items6"),
resources.GetString("cBActions.Items7")});
resources.GetString("cBActions.Items7"),
resources.GetString("cBActions.Items8")});
resources.ApplyResources(this.cBActions, "cBActions");
this.cBActions.Name = "cBActions";
this.cBActions.SelectedIndexChanged += new System.EventHandler(this.cBActions_SelectedIndexChanged);
@ -596,13 +596,6 @@
resources.ApplyResources(this.lbTapDVR, "lbTapDVR");
this.lbTapDVR.Name = "lbTapDVR";
//
// advColorDialog
//
this.advColorDialog.AnyColor = true;
this.advColorDialog.Color = System.Drawing.Color.Blue;
this.advColorDialog.FullOpen = true;
this.advColorDialog.OnUpdateColor += new DS4Windows.AdvancedColorDialog.ColorUpdateHandler(this.advColorDialog_OnUpdateColor);
//
// SpecActions
//
resources.ApplyResources(this, "$this");

View File

@ -177,6 +177,10 @@ namespace DS4Windows
cBHoldDVR.SelectedIndex = int.Parse(dets[1]);
cBDTapDVR.SelectedIndex = int.Parse(dets[2]);*/
break;
case "SASteeringWheelEmulationCalibrate":
cBActions.SelectedIndex = 8;
nUDDCBT.Value = (decimal)act.delayTime;
break;
}
}
@ -331,6 +335,13 @@ namespace DS4Windows
}
break;
case 8:
action = Properties.Resources.SASteeringWheelEmulationCalibrate;
actRe = true;
if (!string.IsNullOrEmpty(oldprofilename) && oldprofilename != tBName.Text)
Global.RemoveAction(oldprofilename);
Global.SaveAction(tBName.Text, String.Join("/", controls), cBActions.SelectedIndex, Math.Round(nUDDCBT.Value, 1).ToString(), edit);
break;
}
if (actRe)
{
@ -368,7 +379,7 @@ namespace DS4Windows
pnlProgram.Visible = i == 2;
pnlProfile.Visible = i == 3;
pnlKeys.Visible = i == 4;
pnlDisconnectBT.Visible = i == 5;
pnlDisconnectBT.Visible = i == 5 || i == 8; // SASteeringWheelEmulationCalibrate action #8 re-uses DisconnectBT panel ("hold for X secs" detail option)
pnlBatteryCheck.Visible = i == 6;
pnlGameDVR.Visible = i == 7;
btnSave.Enabled = i > 0;

View File

@ -796,13 +796,10 @@
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="lVTrigger.Location" type="System.Drawing.Point, System.Drawing">
<value>19, 41</value>
</data>
<data name="lVTrigger.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>14, 33</value>
</data>
<data name="lVTrigger.Size" type="System.Drawing.Size, System.Drawing">
<value>237, 267</value>
<value>178, 217</value>
</data>
<data name="lVTrigger.TabIndex" type="System.Int32, mscorlib">
<value>14</value>
@ -825,11 +822,8 @@
<data name="btnRecordMacro.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="btnRecordMacro.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
</data>
<data name="btnRecordMacro.Size" type="System.Drawing.Size, System.Drawing">
<value>204, 28</value>
<value>153, 23</value>
</data>
<data name="btnRecordMacro.TabIndex" type="System.Int32, mscorlib">
<value>16</value>
@ -853,13 +847,10 @@
<value>NoControl</value>
</data>
<data name="btnBrowse.Location" type="System.Drawing.Point, System.Drawing">
<value>1, 33</value>
</data>
<data name="btnBrowse.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>1, 27</value>
</data>
<data name="btnBrowse.Size" type="System.Drawing.Size, System.Drawing">
<value>204, 28</value>
<value>153, 23</value>
</data>
<data name="btnBrowse.TabIndex" type="System.Int32, mscorlib">
<value>16</value>
@ -882,11 +873,8 @@
<data name="cBProfiles.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="cBProfiles.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
</data>
<data name="cBProfiles.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 24</value>
<value>153, 21</value>
</data>
<data name="cBProfiles.TabIndex" type="System.Int32, mscorlib">
<value>17</value>
@ -913,13 +901,10 @@
<value>NoControl</value>
</data>
<data name="btnSave.Location" type="System.Drawing.Point, System.Drawing">
<value>275, 282</value>
</data>
<data name="btnSave.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>206, 229</value>
</data>
<data name="btnSave.Size" type="System.Drawing.Size, System.Drawing">
<value>105, 28</value>
<value>79, 23</value>
</data>
<data name="btnSave.TabIndex" type="System.Int32, mscorlib">
<value>16</value>
@ -946,13 +931,10 @@
<value>NoControl</value>
</data>
<data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
<value>388, 282</value>
</data>
<data name="btnCancel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>291, 229</value>
</data>
<data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
<value>91, 28</value>
<value>68, 23</value>
</data>
<data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
<value>16</value>
@ -976,13 +958,10 @@
<value>NoControl</value>
</data>
<data name="lbName.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 10</value>
</data>
<data name="lbName.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>12, 8</value>
</data>
<data name="lbName.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 16</value>
<value>54, 13</value>
</data>
<data name="lbName.TabIndex" type="System.Int32, mscorlib">
<value>15</value>
@ -1009,13 +988,10 @@
<value>Top, Left, Right</value>
</data>
<data name="tBName.Location" type="System.Drawing.Point, System.Drawing">
<value>77, 6</value>
</data>
<data name="tBName.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>58, 5</value>
</data>
<data name="tBName.Size" type="System.Drawing.Size, System.Drawing">
<value>431, 22</value>
<value>324, 20</value>
</data>
<data name="tBName.TabIndex" type="System.Int32, mscorlib">
<value>18</value>
@ -1056,14 +1032,14 @@
<data name="cBActions.Items7" xml:space="preserve">
<value>Mutli Action Button</value>
</data>
<data name="cBActions.Location" type="System.Drawing.Point, System.Drawing">
<value>273, 38</value>
<data name="cBActions.Items8" xml:space="preserve">
<value>Calibration of sixaxis wheel emulation</value>
</data>
<data name="cBActions.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<data name="cBActions.Location" type="System.Drawing.Point, System.Drawing">
<value>205, 31</value>
</data>
<data name="cBActions.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 24</value>
<value>153, 21</value>
</data>
<data name="cBActions.TabIndex" type="System.Int32, mscorlib">
<value>17</value>
@ -1093,13 +1069,10 @@
<value>NoControl</value>
</data>
<data name="pBProgram.Location" type="System.Drawing.Point, System.Drawing">
<value>173, 65</value>
</data>
<data name="pBProgram.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>130, 53</value>
</data>
<data name="pBProgram.Size" type="System.Drawing.Size, System.Drawing">
<value>31, 28</value>
<value>23, 23</value>
</data>
<data name="pBProgram.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value>
@ -1123,13 +1096,10 @@
<value>NoControl</value>
</data>
<data name="lbProgram.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 65</value>
</data>
<data name="lbProgram.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>3, 53</value>
</data>
<data name="lbProgram.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 28</value>
<value>122, 23</value>
</data>
<data name="lbProgram.TabIndex" type="System.Int32, mscorlib">
<value>15</value>
@ -1159,13 +1129,10 @@
<value>NoControl</value>
</data>
<data name="btnBorder.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 38</value>
</data>
<data name="btnBorder.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>12, 31</value>
</data>
<data name="btnBorder.Size" type="System.Drawing.Size, System.Drawing">
<value>243, 272</value>
<value>182, 221</value>
</data>
<data name="btnBorder.TabIndex" type="System.Int32, mscorlib">
<value>257</value>
@ -1186,13 +1153,10 @@
<value>NoControl</value>
</data>
<data name="btnSetUTriggerProfile.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 33</value>
</data>
<data name="btnSetUTriggerProfile.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>0, 27</value>
</data>
<data name="btnSetUTriggerProfile.Size" type="System.Drawing.Size, System.Drawing">
<value>204, 28</value>
<value>153, 23</value>
</data>
<data name="btnSetUTriggerProfile.TabIndex" type="System.Int32, mscorlib">
<value>258</value>
@ -1888,13 +1852,10 @@
</value>
</data>
<data name="lVUnloadTrigger.Location" type="System.Drawing.Point, System.Drawing">
<value>19, 41</value>
</data>
<data name="lVUnloadTrigger.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>14, 33</value>
</data>
<data name="lVUnloadTrigger.Size" type="System.Drawing.Size, System.Drawing">
<value>237, 267</value>
<value>178, 217</value>
</data>
<data name="lVUnloadTrigger.TabIndex" type="System.Int32, mscorlib">
<value>259</value>
@ -1912,13 +1873,10 @@
<value>7</value>
</data>
<data name="tBArg.Location" type="System.Drawing.Point, System.Drawing">
<value>5, 112</value>
</data>
<data name="tBArg.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>4, 91</value>
</data>
<data name="tBArg.Size" type="System.Drawing.Size, System.Drawing">
<value>196, 22</value>
<value>148, 20</value>
</data>
<data name="tBArg.TabIndex" type="System.Int32, mscorlib">
<value>264</value>
@ -1936,13 +1894,10 @@
<value>0</value>
</data>
<data name="nUDProg.Location" type="System.Drawing.Point, System.Drawing">
<value>75, 4</value>
</data>
<data name="nUDProg.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>56, 3</value>
</data>
<data name="nUDProg.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 22</value>
<value>53, 20</value>
</data>
<data name="nUDProg.TabIndex" type="System.Int32, mscorlib">
<value>263</value>
@ -1966,13 +1921,10 @@
<value>NoControl</value>
</data>
<data name="lbArg.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 94</value>
</data>
<data name="lbArg.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>3, 76</value>
</data>
<data name="lbArg.Size" type="System.Drawing.Size, System.Drawing">
<value>76, 17</value>
<value>57, 13</value>
</data>
<data name="lbArg.TabIndex" type="System.Int32, mscorlib">
<value>261</value>
@ -1999,20 +1951,17 @@
<value>NoControl</value>
</data>
<data name="lbHoldForProg.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 6</value>
</data>
<data name="lbHoldForProg.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>3, 5</value>
</data>
<data name="lbHoldForProg.Size" type="System.Drawing.Size, System.Drawing">
<value>63, 22</value>
<value>47, 18</value>
</data>
<data name="lbHoldForProg.TabIndex" type="System.Int32, mscorlib">
<value>261</value>
</data>
<data name="lbHoldForProg.Text" xml:space="preserve">
<value>Hold for</value>
<comment>@Invariant</comment></data>
</data>
<data name="lbHoldForProg.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>TopCenter</value>
</data>
@ -2032,20 +1981,17 @@
<value>NoControl</value>
</data>
<data name="lbSecsProg.Location" type="System.Drawing.Point, System.Drawing">
<value>153, 6</value>
</data>
<data name="lbSecsProg.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>115, 5</value>
</data>
<data name="lbSecsProg.Size" type="System.Drawing.Size, System.Drawing">
<value>44, 22</value>
<value>33, 18</value>
</data>
<data name="lbSecsProg.TabIndex" type="System.Int32, mscorlib">
<value>262</value>
</data>
<data name="lbSecsProg.Text" xml:space="preserve">
<value>secs</value>
<comment>@Invariant</comment></data>
</data>
<data name="lbSecsProg.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>TopCenter</value>
</data>
@ -2062,13 +2008,10 @@
<value>4</value>
</data>
<data name="pnlProgram.Location" type="System.Drawing.Point, System.Drawing">
<value>275, 71</value>
</data>
<data name="pnlProgram.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>206, 58</value>
</data>
<data name="pnlProgram.Size" type="System.Drawing.Size, System.Drawing">
<value>216, 153</value>
<value>162, 124</value>
</data>
<data name="pnlProgram.TabIndex" type="System.Int32, mscorlib">
<value>260</value>
@ -2095,13 +2038,10 @@
<value>NoControl</value>
</data>
<data name="cBMacroScanCode.Location" type="System.Drawing.Point, System.Drawing">
<value>5, 37</value>
</data>
<data name="cBMacroScanCode.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>4, 30</value>
</data>
<data name="cBMacroScanCode.Size" type="System.Drawing.Size, System.Drawing">
<value>99, 21</value>
<value>79, 17</value>
</data>
<data name="cBMacroScanCode.TabIndex" type="System.Int32, mscorlib">
<value>17</value>
@ -2125,13 +2065,10 @@
<value>NoControl</value>
</data>
<data name="lbMacroRecorded.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 62</value>
</data>
<data name="lbMacroRecorded.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>0, 50</value>
</data>
<data name="lbMacroRecorded.Size" type="System.Drawing.Size, System.Drawing">
<value>204, 28</value>
<value>153, 23</value>
</data>
<data name="lbMacroRecorded.TabIndex" type="System.Int32, mscorlib">
<value>15</value>
@ -2152,13 +2089,10 @@
<value>2</value>
</data>
<data name="pnlMacro.Location" type="System.Drawing.Point, System.Drawing">
<value>275, 71</value>
</data>
<data name="pnlMacro.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>206, 58</value>
</data>
<data name="pnlMacro.Size" type="System.Drawing.Size, System.Drawing">
<value>217, 116</value>
<value>163, 94</value>
</data>
<data name="pnlMacro.TabIndex" type="System.Int32, mscorlib">
<value>261</value>
@ -2182,13 +2116,10 @@
<value>NoControl</value>
</data>
<data name="lbUnloadTipProfile.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 68</value>
</data>
<data name="lbUnloadTipProfile.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>0, 55</value>
</data>
<data name="lbUnloadTipProfile.Size" type="System.Drawing.Size, System.Drawing">
<value>133, 28</value>
<value>100, 23</value>
</data>
<data name="lbUnloadTipProfile.TabIndex" type="System.Int32, mscorlib">
<value>259</value>
@ -2206,13 +2137,10 @@
<value>0</value>
</data>
<data name="pnlProfile.Location" type="System.Drawing.Point, System.Drawing">
<value>275, 71</value>
</data>
<data name="pnlProfile.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>206, 58</value>
</data>
<data name="pnlProfile.Size" type="System.Drawing.Size, System.Drawing">
<value>215, 116</value>
<value>161, 94</value>
</data>
<data name="pnlProfile.TabIndex" type="System.Int32, mscorlib">
<value>262</value>
@ -2233,13 +2161,10 @@
<value>11</value>
</data>
<data name="nUDDCBT.Location" type="System.Drawing.Point, System.Drawing">
<value>75, 4</value>
</data>
<data name="nUDDCBT.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>56, 3</value>
</data>
<data name="nUDDCBT.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 22</value>
<value>53, 20</value>
</data>
<data name="nUDDCBT.TabIndex" type="System.Int32, mscorlib">
<value>260</value>
@ -2260,13 +2185,10 @@
<value>NoControl</value>
</data>
<data name="lbHoldFor.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 6</value>
</data>
<data name="lbHoldFor.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>3, 5</value>
</data>
<data name="lbHoldFor.Size" type="System.Drawing.Size, System.Drawing">
<value>63, 22</value>
<value>47, 18</value>
</data>
<data name="lbHoldFor.TabIndex" type="System.Int32, mscorlib">
<value>259</value>
@ -2293,13 +2215,10 @@
<value>NoControl</value>
</data>
<data name="lbSecs.Location" type="System.Drawing.Point, System.Drawing">
<value>153, 6</value>
</data>
<data name="lbSecs.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>115, 5</value>
</data>
<data name="lbSecs.Size" type="System.Drawing.Size, System.Drawing">
<value>44, 22</value>
<value>33, 18</value>
</data>
<data name="lbSecs.TabIndex" type="System.Int32, mscorlib">
<value>259</value>
@ -2323,13 +2242,10 @@
<value>2</value>
</data>
<data name="pnlDisconnectBT.Location" type="System.Drawing.Point, System.Drawing">
<value>275, 71</value>
</data>
<data name="pnlDisconnectBT.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>206, 58</value>
</data>
<data name="pnlDisconnectBT.Size" type="System.Drawing.Size, System.Drawing">
<value>215, 73</value>
<value>161, 59</value>
</data>
<data name="pnlDisconnectBT.TabIndex" type="System.Int32, mscorlib">
<value>262</value>
@ -2353,13 +2269,10 @@
<value>NoControl</value>
</data>
<data name="btnSelectKey.Location" type="System.Drawing.Point, System.Drawing">
<value>7, 4</value>
</data>
<data name="btnSelectKey.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>5, 3</value>
</data>
<data name="btnSelectKey.Size" type="System.Drawing.Size, System.Drawing">
<value>204, 28</value>
<value>153, 23</value>
</data>
<data name="btnSelectKey.TabIndex" type="System.Int32, mscorlib">
<value>260</value>
@ -2386,13 +2299,10 @@
<value>releasing unload trigger</value>
</data>
<data name="cBPressRelease.Location" type="System.Drawing.Point, System.Drawing">
<value>7, 94</value>
</data>
<data name="cBPressRelease.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>5, 76</value>
</data>
<data name="cBPressRelease.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 24</value>
<value>153, 21</value>
</data>
<data name="cBPressRelease.TabIndex" type="System.Int32, mscorlib">
<value>17</value>
@ -2416,13 +2326,10 @@
<value>NoControl</value>
</data>
<data name="btnSetUTriggerKeys.Location" type="System.Drawing.Point, System.Drawing">
<value>7, 36</value>
</data>
<data name="btnSetUTriggerKeys.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>5, 29</value>
</data>
<data name="btnSetUTriggerKeys.Size" type="System.Drawing.Size, System.Drawing">
<value>204, 28</value>
<value>153, 23</value>
</data>
<data name="btnSetUTriggerKeys.TabIndex" type="System.Int32, mscorlib">
<value>258</value>
@ -2449,13 +2356,10 @@
<value>NoControl</value>
</data>
<data name="lbUnloadTipKey.Location" type="System.Drawing.Point, System.Drawing">
<value>7, 75</value>
</data>
<data name="lbUnloadTipKey.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>5, 61</value>
</data>
<data name="lbUnloadTipKey.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 27</value>
<value>152, 22</value>
</data>
<data name="lbUnloadTipKey.TabIndex" type="System.Int32, mscorlib">
<value>259</value>
@ -2482,13 +2386,10 @@
<value>3</value>
</data>
<data name="pnlKeys.Location" type="System.Drawing.Point, System.Drawing">
<value>267, 71</value>
</data>
<data name="pnlKeys.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>200, 58</value>
</data>
<data name="pnlKeys.Size" type="System.Drawing.Size, System.Drawing">
<value>215, 132</value>
<value>161, 107</value>
</data>
<data name="pnlKeys.TabIndex" type="System.Int32, mscorlib">
<value>263</value>
@ -2512,13 +2413,10 @@
<value>NoControl</value>
</data>
<data name="pBGraident.Location" type="System.Drawing.Point, System.Drawing">
<value>37, 87</value>
</data>
<data name="pBGraident.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>28, 71</value>
</data>
<data name="pBGraident.Size" type="System.Drawing.Size, System.Drawing">
<value>145, 16</value>
<value>109, 13</value>
</data>
<data name="pBGraident.TabIndex" type="System.Int32, mscorlib">
<value>264</value>
@ -2542,13 +2440,10 @@
<value>NoControl</value>
</data>
<data name="cBNotificationBatt.Location" type="System.Drawing.Point, System.Drawing">
<value>24, 31</value>
</data>
<data name="cBNotificationBatt.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>18, 25</value>
</data>
<data name="cBNotificationBatt.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 21</value>
<value>94, 17</value>
</data>
<data name="cBNotificationBatt.TabIndex" type="System.Int32, mscorlib">
<value>263</value>
@ -2575,13 +2470,10 @@
<value>NoControl</value>
</data>
<data name="cbLightbarBatt.Location" type="System.Drawing.Point, System.Drawing">
<value>24, 54</value>
</data>
<data name="cbLightbarBatt.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>18, 44</value>
</data>
<data name="cbLightbarBatt.Size" type="System.Drawing.Size, System.Drawing">
<value>99, 21</value>
<value>77, 17</value>
</data>
<data name="cbLightbarBatt.TabIndex" type="System.Int32, mscorlib">
<value>262</value>
@ -2608,13 +2500,10 @@
<value>NoControl</value>
</data>
<data name="bnFullColor.Location" type="System.Drawing.Point, System.Drawing">
<value>191, 87</value>
</data>
<data name="bnFullColor.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>143, 71</value>
</data>
<data name="bnFullColor.Size" type="System.Drawing.Size, System.Drawing">
<value>17, 16</value>
<value>13, 13</value>
</data>
<data name="bnFullColor.TabIndex" type="System.Int32, mscorlib">
<value>261</value>
@ -2638,13 +2527,10 @@
<value>NoControl</value>
</data>
<data name="bnEmptyColor.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 87</value>
</data>
<data name="bnEmptyColor.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>9, 71</value>
</data>
<data name="bnEmptyColor.Size" type="System.Drawing.Size, System.Drawing">
<value>17, 16</value>
<value>13, 13</value>
</data>
<data name="bnEmptyColor.TabIndex" type="System.Int32, mscorlib">
<value>261</value>
@ -2662,13 +2548,10 @@
<value>4</value>
</data>
<data name="nUDDCBatt.Location" type="System.Drawing.Point, System.Drawing">
<value>75, 4</value>
</data>
<data name="nUDDCBatt.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>56, 3</value>
</data>
<data name="nUDDCBatt.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 22</value>
<value>53, 20</value>
</data>
<data name="nUDDCBatt.TabIndex" type="System.Int32, mscorlib">
<value>260</value>
@ -2689,20 +2572,17 @@
<value>NoControl</value>
</data>
<data name="lbHoldForBatt.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 6</value>
</data>
<data name="lbHoldForBatt.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>3, 5</value>
</data>
<data name="lbHoldForBatt.Size" type="System.Drawing.Size, System.Drawing">
<value>63, 22</value>
<value>47, 18</value>
</data>
<data name="lbHoldForBatt.TabIndex" type="System.Int32, mscorlib">
<value>259</value>
</data>
<data name="lbHoldForBatt.Text" xml:space="preserve">
<value>Hold for</value>
<comment>@Invariant</comment></data>
</data>
<data name="lbHoldForBatt.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>TopCenter</value>
</data>
@ -2722,20 +2602,17 @@
<value>NoControl</value>
</data>
<data name="lbFullBatt.Location" type="System.Drawing.Point, System.Drawing">
<value>171, 114</value>
</data>
<data name="lbFullBatt.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>128, 93</value>
</data>
<data name="lbFullBatt.Size" type="System.Drawing.Size, System.Drawing">
<value>44, 22</value>
<value>33, 18</value>
</data>
<data name="lbFullBatt.TabIndex" type="System.Int32, mscorlib">
<value>259</value>
</data>
<data name="lbFullBatt.Text" xml:space="preserve">
<value>100%</value>
<comment>@Invariant</comment></data>
</data>
<data name="lbFullBatt.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>TopRight</value>
</data>
@ -2755,20 +2632,17 @@
<value>NoControl</value>
</data>
<data name="lbEmptyBatt.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 114</value>
</data>
<data name="lbEmptyBatt.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>6, 93</value>
</data>
<data name="lbEmptyBatt.Size" type="System.Drawing.Size, System.Drawing">
<value>44, 22</value>
<value>33, 18</value>
</data>
<data name="lbEmptyBatt.TabIndex" type="System.Int32, mscorlib">
<value>259</value>
</data>
<data name="lbEmptyBatt.Text" xml:space="preserve">
<value>0%</value>
<comment>@Invariant</comment></data>
</data>
<data name="&gt;&gt;lbEmptyBatt.Name" xml:space="preserve">
<value>lbEmptyBatt</value>
</data>
@ -2785,20 +2659,17 @@
<value>NoControl</value>
</data>
<data name="lbSecsBatt.Location" type="System.Drawing.Point, System.Drawing">
<value>153, 6</value>
</data>
<data name="lbSecsBatt.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>115, 5</value>
</data>
<data name="lbSecsBatt.Size" type="System.Drawing.Size, System.Drawing">
<value>44, 22</value>
<value>33, 18</value>
</data>
<data name="lbSecsBatt.TabIndex" type="System.Int32, mscorlib">
<value>259</value>
</data>
<data name="lbSecsBatt.Text" xml:space="preserve">
<value>secs</value>
<comment>@Invariant</comment></data>
</data>
<data name="lbSecsBatt.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>TopCenter</value>
</data>
@ -2815,13 +2686,10 @@
<value>9</value>
</data>
<data name="pnlBatteryCheck.Location" type="System.Drawing.Point, System.Drawing">
<value>271, 73</value>
</data>
<data name="pnlBatteryCheck.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>203, 59</value>
</data>
<data name="pnlBatteryCheck.Size" type="System.Drawing.Size, System.Drawing">
<value>215, 151</value>
<value>161, 123</value>
</data>
<data name="pnlBatteryCheck.TabIndex" type="System.Int32, mscorlib">
<value>264</value>
@ -2845,13 +2713,10 @@
<value>NoControl</value>
</data>
<data name="btnDTapT.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 123</value>
</data>
<data name="btnDTapT.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>3, 100</value>
</data>
<data name="btnDTapT.Size" type="System.Drawing.Size, System.Drawing">
<value>217, 28</value>
<value>163, 23</value>
</data>
<data name="btnDTapT.TabIndex" type="System.Int32, mscorlib">
<value>267</value>
@ -2875,13 +2740,10 @@
<value>NoControl</value>
</data>
<data name="btnHoldT.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 73</value>
</data>
<data name="btnHoldT.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>4, 59</value>
</data>
<data name="btnHoldT.Size" type="System.Drawing.Size, System.Drawing">
<value>217, 28</value>
<value>163, 23</value>
</data>
<data name="btnHoldT.TabIndex" type="System.Int32, mscorlib">
<value>266</value>
@ -2905,13 +2767,10 @@
<value>NoControl</value>
</data>
<data name="btnSTapT.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 25</value>
</data>
<data name="btnSTapT.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>4, 20</value>
</data>
<data name="btnSTapT.Size" type="System.Drawing.Size, System.Drawing">
<value>217, 28</value>
<value>163, 23</value>
</data>
<data name="btnSTapT.TabIndex" type="System.Int32, mscorlib">
<value>265</value>
@ -2938,13 +2797,10 @@
<value>NoControl</value>
</data>
<data name="lbDTapDVR.Location" type="System.Drawing.Point, System.Drawing">
<value>5, 102</value>
</data>
<data name="lbDTapDVR.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>4, 83</value>
</data>
<data name="lbDTapDVR.Size" type="System.Drawing.Size, System.Drawing">
<value>132, 17</value>
<value>99, 13</value>
</data>
<data name="lbDTapDVR.TabIndex" type="System.Int32, mscorlib">
<value>263</value>
@ -2971,13 +2827,10 @@
<value>NoControl</value>
</data>
<data name="lbHoldDVR.Location" type="System.Drawing.Point, System.Drawing">
<value>5, 54</value>
</data>
<data name="lbHoldDVR.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>4, 44</value>
</data>
<data name="lbHoldDVR.Size" type="System.Drawing.Size, System.Drawing">
<value>87, 17</value>
<value>65, 13</value>
</data>
<data name="lbHoldDVR.TabIndex" type="System.Int32, mscorlib">
<value>261</value>
@ -3004,13 +2857,10 @@
<value>NoControl</value>
</data>
<data name="lbTapDVR.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 4</value>
</data>
<data name="lbTapDVR.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 0, 4, 0</value>
<value>3, 3</value>
</data>
<data name="lbTapDVR.Size" type="System.Drawing.Size, System.Drawing">
<value>83, 17</value>
<value>62, 13</value>
</data>
<data name="lbTapDVR.TabIndex" type="System.Int32, mscorlib">
<value>259</value>
@ -3031,13 +2881,10 @@
<value>5</value>
</data>
<data name="pnlGameDVR.Location" type="System.Drawing.Point, System.Drawing">
<value>267, 70</value>
</data>
<data name="pnlGameDVR.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>200, 57</value>
</data>
<data name="pnlGameDVR.Size" type="System.Drawing.Size, System.Drawing">
<value>228, 154</value>
<value>171, 125</value>
</data>
<data name="pnlGameDVR.TabIndex" type="System.Int32, mscorlib">
<value>264</value>
@ -3057,24 +2904,18 @@
<data name="&gt;&gt;pnlGameDVR.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="advColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>267, 17</value>
</metadata>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>8, 16</value>
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>536, 325</value>
</data>
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
<value>402, 264</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>SpecActions</value>
<comment>@Invariant</comment></data>
</data>
<data name="&gt;&gt;cHTrigger.Name" xml:space="preserve">
<value>cHTrigger</value>
</data>
@ -3099,12 +2940,6 @@
<data name="&gt;&gt;cHUnloadTrigger.Type" xml:space="preserve">
<value>System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;advColorDialog.Name" xml:space="preserve">
<value>advColorDialog</value>
</data>
<data name="&gt;&gt;advColorDialog.Type" xml:space="preserve">
<value>DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.4.5.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>SpecActions</value>
</data>

View File

@ -147,6 +147,38 @@ namespace DS4Windows
return warnInterval;
}
public Int32 wheelPrevPhysicalAngle = 0;
public Int32 wheelPrevFullAngle = 0;
public Int32 wheelFullTurnCount = 0;
public Point wheelCenterPoint;
public Point wheel90DegPointLeft;
public Point wheelCircleCenterPointLeft;
public Point wheel90DegPointRight;
public Point wheelCircleCenterPointRight;
public DateTime wheelPrevRecalibrateTime;
private int wheelRecalibrateActiveState = 0;
public int WheelRecalibrateActiveState
{
get { return wheelRecalibrateActiveState; }
set
{
wheelRecalibrateActiveState = value;
}
}
public enum WheelCalibrationPoint
{
None = 0,
Center = 1,
Right90 = 2,
Left90 = 4,
All = Center | Right90 | Left90
}
public WheelCalibrationPoint wheelCalibratedAxisBitmask;
private bool exitOutputThread = false;
public bool ExitOutputThread => exitOutputThread;
private bool exitInputThread = false;

View File

@ -28,6 +28,7 @@ namespace DS4Windows
public ulong totalMicroSec = 0;
public SixAxis Motion = null;
public static readonly int DEFAULT_AXISDIR_VALUE = 127;
public Int32 SASteeringWheelEmulationUnit;
public struct TrackPadTouch
{
@ -66,6 +67,7 @@ namespace DS4Windows
Motion = new SixAxis(0, 0, 0, 0, 0, 0, 0.0);
TrackPadTouch0.IsActive = false;
TrackPadTouch1.IsActive = false;
SASteeringWheelEmulationUnit = 0;
}
public DS4State(DS4State state)
@ -120,6 +122,7 @@ namespace DS4Windows
Motion = state.Motion;
TrackPadTouch0 = state.TrackPadTouch0;
TrackPadTouch1 = state.TrackPadTouch1;
SASteeringWheelEmulationUnit = state.SASteeringWheelEmulationUnit;
}
public DS4State Clone()
@ -179,6 +182,7 @@ namespace DS4Windows
state.Motion = Motion;
state.TrackPadTouch0 = TrackPadTouch0;
state.TrackPadTouch1 = TrackPadTouch1;
state.SASteeringWheelEmulationUnit = SASteeringWheelEmulationUnit;
}
public void calculateStickAngles()

View File

@ -232,6 +232,7 @@
<Compile Include="HidLibrary\NativeMethods.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings.cs" />
<Compile Include="VJoyFeeder\vJoyFeeder.cs" />
<EmbeddedResource Include="DS4Forms\DS4Form.ar.resx">
<DependentUpon>DS4Form.cs</DependentUpon>
<SubType>Designer</SubType>
@ -297,6 +298,7 @@
</EmbeddedResource>
<EmbeddedResource Include="DS4Forms\DS4Form.resx">
<DependentUpon>DS4Form.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="DS4Forms\DS4Form.ro-RO.resx">
<DependentUpon>DS4Form.cs</DependentUpon>
@ -622,6 +624,7 @@
</EmbeddedResource>
<EmbeddedResource Include="DS4Forms\Options.resx">
<DependentUpon>Options.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="DS4Forms\Options.ro-RO.resx">
<DependentUpon>Options.cs</DependentUpon>
@ -856,6 +859,7 @@
</EmbeddedResource>
<EmbeddedResource Include="DS4Forms\SpecActions.resx">
<DependentUpon>SpecActions.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="DS4Forms\SpecActions.ro-RO.resx">
<DependentUpon>SpecActions.cs</DependentUpon>
@ -1044,7 +1048,9 @@
<EmbeddedResource Include="Properties\Resources.cs.resx" />
<EmbeddedResource Include="Properties\Resources.de-DE.resx" />
<EmbeddedResource Include="Properties\Resources.el.resx" />
<EmbeddedResource Include="Properties\Resources.es.resx" />
<EmbeddedResource Include="Properties\Resources.es.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.fi.resx" />
<EmbeddedResource Include="Properties\Resources.fr-FR.resx" />
<EmbeddedResource Include="Properties\Resources.he.resx" />
@ -1172,6 +1178,7 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="PostBuildMacros">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">

View File

@ -96,7 +96,7 @@ namespace DS4Windows
//if (mutex.WaitOne(TimeSpan.Zero, true))
//{
createControlService();
createControlService();
//rootHub = new ControlService();
Application.EnableVisualStyles();
ds4form = new DS4Form(args);

View File

@ -1627,6 +1627,69 @@ namespace DS4Windows.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Calibration of sixaxis wheel emulation.
/// </summary>
internal static string SASteeringWheelEmulationCalibrate {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to All calibraton points are set when lightbar color turns to green. While turning the controller the lightbar color flashes when the controller is at calibration point. Accept calibration with OK button.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateInstruction {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateInstruction", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to (1) Center the controller, hold it steady and press &quot;X&quot;.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateInstruction1 {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateInstruction1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to (2) Turn to 90° left (or right) position and press &quot;X&quot;.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateInstruction2 {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateInstruction2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to (3) Turn to 90° right (or left) position and press &quot;X&quot;.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateInstruction3 {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateInstruction3", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot calibrate gyro (sixaxis) steering wheel emulation values without a controller. Connect a controller via bluetooth or usb.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateNoControllerError {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateNoControllerError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Gyro steering wheel emulation axis option is set to NONE (emulation is not used). Please select an axis option before calibrating the sixaxis gyro steering wheel emulation.
/// </summary>
internal static string SASteeringWheelEmulationCalibrateNoneAxisError {
get {
return ResourceManager.GetString("SASteeringWheelEmulationCalibrateNoneAxisError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@ -637,6 +637,27 @@
<data name="Shortcuts" xml:space="preserve">
<value>Shortcuts</value>
</data>
<data name="SASteeringWheelEmulationCalibrate" xml:space="preserve">
<value>Calibration of sixaxis wheel emulation</value>
</data>
<data name="SASteeringWheelEmulationCalibrateInstruction1" xml:space="preserve">
<value>(1) Center the controller, hold it steady and press "X"</value>
</data>
<data name="SASteeringWheelEmulationCalibrateInstruction2" xml:space="preserve">
<value>(2) Turn to 90° left (or right) position and press "X"</value>
</data>
<data name="SASteeringWheelEmulationCalibrateInstruction3" xml:space="preserve">
<value>(3) Turn to 90° right (or left) position and press "X"</value>
</data>
<data name="SASteeringWheelEmulationCalibrateInstruction" xml:space="preserve">
<value>All calibraton points are set when lightbar color turns to green. While turning the controller the lightbar color flashes when the controller is at calibration point. Accept calibration with OK button</value>
</data>
<data name="SASteeringWheelEmulationCalibrateNoControllerError" xml:space="preserve">
<value>Cannot calibrate gyro (sixaxis) steering wheel emulation values without a controller. Connect a controller via bluetooth or usb</value>
</data>
<data name="SASteeringWheelEmulationCalibrateNoneAxisError" xml:space="preserve">
<value>Gyro steering wheel emulation axis option is set to NONE (emulation is not used). Please select an axis option before calibrating the sixaxis gyro steering wheel emulation</value>
</data>
<data name="SixAxisReading" xml:space="preserve">
<value>Click for advanced Sixaxis reading</value>
</data>

View File

@ -0,0 +1,716 @@
// VJoy C# interface file taken from an excellent Shaul's virtual joystick driver project.
// Licensed to public domain as is (http://vjoystick.sourceforge.net/site/index.php/forum/5-Discussion/104-what-is-the-usage-license-for-this-software).
// http://vjoystick.sourceforge.net/site/
// https://github.com/shauleiz/vJoy/tree/master/apps/common/vJoyInterfaceCS
//
// This module is a feeder for VJoy virtual joystick driver. DS4Windows can optionally re-map and feed buttons and analog axis values from DS4 Controller to VJoy device.
// At first this may seem silly because DS4Windows can already do re-mapping by using a virtual X360 Controller driver, so why feed VJoy virtual driver also?
// Sometimes X360 driver may run out of analog axis options, so for example "SA motion sensor steering wheel emulation" in DS4Windows would reserve a thumbstick X or Y
// axis for SA steering wheel emulation usage. That thumbstick axis would be unavailable for "normal" thumbstick usage after this re-mapping.
// The problem can be solved by configuring DS4Windows to re-map SA steering wheel emulation axis to VJoy axis, so all analog axies in DS4 controller are still available for normal usage.
//
using System;
using System.Runtime.InteropServices;
using System.Security; // SuppressUnmanagedCodeSecurity support to optimize for performance instead of code security
namespace DS4Windows.VJoyFeeder
{
[Flags]
public enum HID_USAGES
{
HID_USAGE_X = 0x30,
HID_USAGE_Y = 0x31,
HID_USAGE_Z = 0x32,
HID_USAGE_RX = 0x33,
HID_USAGE_RY = 0x34,
HID_USAGE_RZ = 0x35,
HID_USAGE_SL0 = 0x36,
HID_USAGE_SL1 = 0x37,
HID_USAGE_WHL = 0x38,
HID_USAGE_POV = 0x39,
}
public enum VjdStat /* Declares an enumeration data type called BOOLEAN */
{
VJD_STAT_OWN, // The vJoy Device is owned by this application.
VJD_STAT_FREE, // The vJoy Device is NOT owned by any application (including this one).
VJD_STAT_BUSY, // The vJoy Device is owned by another application. It cannot be acquired by this application.
VJD_STAT_MISS, // The vJoy Device is missing. It either does not exist or the driver is down.
VJD_STAT_UNKN // Unknown
};
// FFB Declarations
// HID Descriptor definitions - FFB Report IDs
public enum FFBPType // FFB Packet Type
{
// Write
PT_EFFREP = 0x01, // Usage Set Effect Report
PT_ENVREP = 0x02, // Usage Set Envelope Report
PT_CONDREP = 0x03, // Usage Set Condition Report
PT_PRIDREP = 0x04, // Usage Set Periodic Report
PT_CONSTREP = 0x05, // Usage Set Constant Force Report
PT_RAMPREP = 0x06, // Usage Set Ramp Force Report
PT_CSTMREP = 0x07, // Usage Custom Force Data Report
PT_SMPLREP = 0x08, // Usage Download Force Sample
PT_EFOPREP = 0x0A, // Usage Effect Operation Report
PT_BLKFRREP = 0x0B, // Usage PID Block Free Report
PT_CTRLREP = 0x0C, // Usage PID Device Control
PT_GAINREP = 0x0D, // Usage Device Gain Report
PT_SETCREP = 0x0E, // Usage Set Custom Force Report
// Feature
PT_NEWEFREP = 0x01 + 0x10, // Usage Create New Effect Report
PT_BLKLDREP = 0x02 + 0x10, // Usage Block Load Report
PT_POOLREP = 0x03 + 0x10, // Usage PID Pool Report
};
public enum FFBEType // FFB Effect Type
{
// Effect Type
ET_NONE = 0, // No Force
ET_CONST = 1, // Constant Force
ET_RAMP = 2, // Ramp
ET_SQR = 3, // Square
ET_SINE = 4, // Sine
ET_TRNGL = 5, // Triangle
ET_STUP = 6, // Sawtooth Up
ET_STDN = 7, // Sawtooth Down
ET_SPRNG = 8, // Spring
ET_DMPR = 9, // Damper
ET_INRT = 10, // Inertia
ET_FRCTN = 11, // Friction
ET_CSTM = 12, // Custom Force Data
};
public enum FFB_CTRL
{
CTRL_ENACT = 1, // Enable all device actuators.
CTRL_DISACT = 2, // Disable all the device actuators.
CTRL_STOPALL = 3, // Stop All Effects­ Issues a stop on every running effect.
CTRL_DEVRST = 4, // Device Reset Clears any device paused condition, enables all actuators and clears all effects from memory.
CTRL_DEVPAUSE = 5, // Device Pause The all effects on the device are paused at the current time step.
CTRL_DEVCONT = 6, // Device Continue The all effects that running when the device was paused are restarted from their last time step.
};
public enum FFBOP
{
EFF_START = 1, // EFFECT START
EFF_SOLO = 2, // EFFECT SOLO START
EFF_STOP = 3, // EFFECT STOP
};
//namespace vJoyInterfaceWrap
//{
[SuppressUnmanagedCodeSecurity]
public class VJoy
{
/***************************************************/
/*********** Various declarations ******************/
/***************************************************/
private static RemovalCbFunc UserRemCB;
private static WrapRemovalCbFunc wrf;
private static GCHandle hRemUserData;
private static FfbCbFunc UserFfbCB;
private static WrapFfbCbFunc wf;
private static GCHandle hFfbUserData;
[StructLayout(LayoutKind.Sequential)]
public struct JoystickState
{
public byte bDevice;
public Int32 Throttle;
public Int32 Rudder;
public Int32 Aileron;
public Int32 AxisX;
public Int32 AxisY;
public Int32 AxisZ;
public Int32 AxisXRot;
public Int32 AxisYRot;
public Int32 AxisZRot;
public Int32 Slider;
public Int32 Dial;
public Int32 Wheel;
public Int32 AxisVX;
public Int32 AxisVY;
public Int32 AxisVZ;
public Int32 AxisVBRX;
public Int32 AxisVBRY;
public Int32 AxisVBRZ;
public UInt32 Buttons;
public UInt32 bHats; // Lower 4 bits: HAT switch or 16-bit of continuous HAT switch
public UInt32 bHatsEx1; // Lower 4 bits: HAT switch or 16-bit of continuous HAT switch
public UInt32 bHatsEx2; // Lower 4 bits: HAT switch or 16-bit of continuous HAT switch
public UInt32 bHatsEx3; // Lower 4 bits: HAT switch or 16-bit of continuous HAT switch
public UInt32 ButtonsEx1;
public UInt32 ButtonsEx2;
public UInt32 ButtonsEx3;
};
[StructLayout(LayoutKind.Sequential)]
private struct FFB_DATA
{
private UInt32 size;
private UInt32 cmd;
private IntPtr data;
}
[StructLayout(LayoutKind.Explicit)]
public struct FFB_EFF_CONSTANT
{
[FieldOffset(0)]
public Byte EffectBlockIndex;
[FieldOffset(4)]
public Int16 Magnitude;
}
[System.Obsolete("use FFB_EFF_REPORT")]
[StructLayout(LayoutKind.Explicit)]
public struct FFB_EFF_CONST
{
[FieldOffset(0)]
public Byte EffectBlockIndex;
[FieldOffset(4)]
public FFBEType EffectType;
[FieldOffset(8)]
public UInt16 Duration;// Value in milliseconds. 0xFFFF means infinite
[FieldOffset(10)]
public UInt16 TrigerRpt;
[FieldOffset(12)]
public UInt16 SamplePrd;
[FieldOffset(14)]
public Byte Gain;
[FieldOffset(15)]
public Byte TrigerBtn;
[FieldOffset(16)]
public bool Polar; // How to interpret force direction Polar (0-360°) or Cartesian (X,Y)
[FieldOffset(20)]
public Byte Direction; // Polar direction: (0x00-0xFF correspond to 0-360°)
[FieldOffset(20)]
public Byte DirX; // X direction: Positive values are To the right of the center (X); Negative are Two's complement
[FieldOffset(21)]
public Byte DirY; // Y direction: Positive values are below the center (Y); Negative are Two's complement
}
[StructLayout(LayoutKind.Explicit)]
public struct FFB_EFF_REPORT
{
[FieldOffset(0)]
public Byte EffectBlockIndex;
[FieldOffset(4)]
public FFBEType EffectType;
[FieldOffset(8)]
public UInt16 Duration;// Value in milliseconds. 0xFFFF means infinite
[FieldOffset(10)]
public UInt16 TrigerRpt;
[FieldOffset(12)]
public UInt16 SamplePrd;
[FieldOffset(14)]
public Byte Gain;
[FieldOffset(15)]
public Byte TrigerBtn;
[FieldOffset(16)]
public bool Polar; // How to interpret force direction Polar (0-360°) or Cartesian (X,Y)
[FieldOffset(20)]
public Byte Direction; // Polar direction: (0x00-0xFF correspond to 0-360°)
[FieldOffset(20)]
public Byte DirX; // X direction: Positive values are To the right of the center (X); Negative are Two's complement
[FieldOffset(21)]
public Byte DirY; // Y direction: Positive values are below the center (Y); Negative are Two's complement
}
[StructLayout(LayoutKind.Explicit)]
public struct FFB_EFF_OP
{
[FieldOffset(0)]
public Byte EffectBlockIndex;
[FieldOffset(4)]
public FFBOP EffectOp;
[FieldOffset(8)]
public Byte LoopCount;
}
[StructLayout(LayoutKind.Explicit)]
public struct FFB_EFF_COND
{
[FieldOffset(0)]
public Byte EffectBlockIndex;
[FieldOffset(4)]
public bool isY;
[FieldOffset(8)]
public Int16 CenterPointOffset; // CP Offset: Range 0x80­0x7F (­10000 ­ 10000)
[FieldOffset(12)]
public Int16 PosCoeff; // Positive Coefficient: Range 0x80­0x7F (­10000 ­ 10000)
[FieldOffset(16)]
public Int16 NegCoeff; // Negative Coefficient: Range 0x80­0x7F (­10000 ­ 10000)
[FieldOffset(20)]
public UInt32 PosSatur; // Positive Saturation: Range 0x00­0xFF (0 10000)
[FieldOffset(24)]
public UInt32 NegSatur; // Negative Saturation: Range 0x00­0xFF (0 10000)
[FieldOffset(28)]
public Int32 DeadBand; // Dead Band: : Range 0x00­0xFF (0 10000)
}
[StructLayout(LayoutKind.Explicit)]
public struct FFB_EFF_ENVLP
{
[FieldOffset(0)]
public Byte EffectBlockIndex;
[FieldOffset(4)]
public UInt16 AttackLevel;
[FieldOffset(8)]
public UInt16 FadeLevel;
[FieldOffset(12)]
public UInt32 AttackTime;
[FieldOffset(16)]
public UInt32 FadeTime;
}
[StructLayout(LayoutKind.Explicit)]
public struct FFB_EFF_PERIOD
{
[FieldOffset(0)]
public Byte EffectBlockIndex;
[FieldOffset(4)]
public UInt32 Magnitude;
[FieldOffset(8)]
public Int16 Offset;
[FieldOffset(12)]
public UInt32 Phase;
[FieldOffset(16)]
public UInt32 Period;
}
[StructLayout(LayoutKind.Explicit)]
public struct FFB_EFF_RAMP
{
[FieldOffset(0)]
public Byte EffectBlockIndex;
[FieldOffset(4)]
public Int16 Start; // The Normalized magnitude at the start of the effect
[FieldOffset(8)]
public Int16 End; // The Normalized magnitude at the end of the effect
}
/***************************************************/
/***** Import from file vJoyInterface.dll (C) ******/
/***************************************************/
///// General driver data
[DllImport("vJoyInterface.dll", EntryPoint = "GetvJoyVersion")]
private static extern short _GetvJoyVersion();
[DllImport("vJoyInterface.dll", EntryPoint = "vJoyEnabled")]
private static extern bool _vJoyEnabled();
[DllImport("vJoyInterface.dll", EntryPoint = "GetvJoyProductString")]
private static extern IntPtr _GetvJoyProductString();
[DllImport("vJoyInterface.dll", EntryPoint = "GetvJoyManufacturerString")]
private static extern IntPtr _GetvJoyManufacturerString();
[DllImport("vJoyInterface.dll", EntryPoint = "GetvJoySerialNumberString")]
private static extern IntPtr _GetvJoySerialNumberString();
[DllImport("vJoyInterface.dll", EntryPoint = "DriverMatch")]
private static extern bool _DriverMatch(ref UInt32 DllVer, ref UInt32 DrvVer);
///// vJoy Device properties
[DllImport("vJoyInterface.dll", EntryPoint = "GetVJDButtonNumber")]
private static extern int _GetVJDButtonNumber(UInt32 rID);
[DllImport("vJoyInterface.dll", EntryPoint = "GetVJDDiscPovNumber")]
private static extern int _GetVJDDiscPovNumber(UInt32 rID);
[DllImport("vJoyInterface.dll", EntryPoint = "GetVJDContPovNumber")]
private static extern int _GetVJDContPovNumber(UInt32 rID);
[DllImport("vJoyInterface.dll", EntryPoint = "GetVJDAxisExist")]
private static extern UInt32 _GetVJDAxisExist(UInt32 rID, UInt32 Axis);
[DllImport("vJoyInterface.dll", EntryPoint = "GetVJDAxisMax")]
private static extern bool _GetVJDAxisMax(UInt32 rID, UInt32 Axis, ref long Max);
[DllImport("vJoyInterface.dll", EntryPoint = "GetVJDAxisMin")]
private static extern bool _GetVJDAxisMin(UInt32 rID, UInt32 Axis, ref long Min);
[DllImport("vJoyInterface.dll", EntryPoint = "isVJDExists")]
private static extern bool _isVJDExists(UInt32 rID);
[DllImport("vJoyInterface.dll", EntryPoint = "GetOwnerPid")]
private static extern int _GetOwnerPid(UInt32 rID);
///// Write access to vJoy Device - Basic
[DllImport("vJoyInterface.dll", EntryPoint = "AcquireVJD")]
private static extern bool _AcquireVJD(UInt32 rID);
[DllImport("vJoyInterface.dll", EntryPoint = "RelinquishVJD")]
private static extern void _RelinquishVJD(UInt32 rID);
[DllImport("vJoyInterface.dll", EntryPoint = "UpdateVJD")]
private static extern bool _UpdateVJD(UInt32 rID, ref JoystickState pData);
[DllImport("vJoyInterface.dll", EntryPoint = "GetVJDStatus")]
private static extern int _GetVJDStatus(UInt32 rID);
//// Reset functions
[DllImport("vJoyInterface.dll", EntryPoint = "ResetVJD")]
private static extern bool _ResetVJD(UInt32 rID);
[DllImport("vJoyInterface.dll", EntryPoint = "ResetAll")]
private static extern bool _ResetAll();
[DllImport("vJoyInterface.dll", EntryPoint = "ResetButtons")]
private static extern bool _ResetButtons(UInt32 rID);
[DllImport("vJoyInterface.dll", EntryPoint = "ResetPovs")]
private static extern bool _ResetPovs(UInt32 rID);
////// Write data
[DllImport("vJoyInterface.dll", EntryPoint = "SetAxis")]
private static extern bool _SetAxis(Int32 Value, UInt32 rID, HID_USAGES Axis);
[DllImport("vJoyInterface.dll", EntryPoint = "SetBtn")]
private static extern bool _SetBtn(bool Value, UInt32 rID, Byte nBtn);
[DllImport("vJoyInterface.dll", EntryPoint = "SetDiscPov")]
private static extern bool _SetDiscPov(Int32 Value, UInt32 rID, uint nPov);
[DllImport("vJoyInterface.dll", EntryPoint = "SetContPov")]
private static extern bool _SetContPov(Int32 Value, UInt32 rID, uint nPov);
[DllImport("vJoyInterface.dll", EntryPoint = "RegisterRemovalCB", CallingConvention = CallingConvention.Cdecl)]
private extern static void _RegisterRemovalCB(WrapRemovalCbFunc cb, IntPtr data);
public delegate void RemovalCbFunc(bool complete, bool First, object userData);
public delegate void WrapRemovalCbFunc(bool complete, bool First, IntPtr userData);
public static void WrapperRemCB(bool complete, bool First, IntPtr userData)
{
object obj = null;
if (userData != IntPtr.Zero)
{
// Convert userData from pointer to object
GCHandle handle2 = (GCHandle)userData;
obj = handle2.Target as object;
}
// Call user-defined CB function
UserRemCB(complete, First, obj);
}
// Force Feedback (FFB)
[DllImport("vJoyInterface.dll", EntryPoint = "FfbRegisterGenCB", CallingConvention = CallingConvention.Cdecl)]
private extern static void _FfbRegisterGenCB(WrapFfbCbFunc cb, IntPtr data);
public delegate void FfbCbFunc(IntPtr data, object userData);
public delegate void WrapFfbCbFunc(IntPtr data, IntPtr userData);
public static void WrapperFfbCB(IntPtr data, IntPtr userData)
{
object obj = null;
if (userData != IntPtr.Zero)
{
// Convert userData from pointer to object
GCHandle handle2 = (GCHandle)userData;
obj = handle2.Target as object;
}
// Call user-defined CB function
UserFfbCB(data, obj);
}
[DllImport("vJoyInterface.dll", EntryPoint = "FfbStart")]
private static extern bool _FfbStart(UInt32 rID);
[DllImport("vJoyInterface.dll", EntryPoint = "FfbStop")]
private static extern bool _FfbStop(UInt32 rID);
[DllImport("vJoyInterface.dll", EntryPoint = "IsDeviceFfb")]
private static extern bool _IsDeviceFfb(UInt32 rID);
[DllImport("vJoyInterface.dll", EntryPoint = "IsDeviceFfbEffect")]
private static extern bool _IsDeviceFfbEffect(UInt32 rID, UInt32 Effect);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_DeviceID")]
private static extern UInt32 _Ffb_h_DeviceID(IntPtr Packet, ref int DeviceID);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_Type")]
private static extern UInt32 _Ffb_h_Type(IntPtr Packet, ref FFBPType Type);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_Packet")]
private static extern UInt32 _Ffb_h_Packet(IntPtr Packet, ref UInt32 Type, ref Int32 DataSize, ref IntPtr Data);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_EBI")]
private static extern UInt32 _Ffb_h_EBI(IntPtr Packet, ref Int32 Index);
#pragma warning disable 618
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_Eff_Const")]
private static extern UInt32 _Ffb_h_Eff_Const(IntPtr Packet, ref FFB_EFF_CONST Effect);
#pragma warning restore 618
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_Eff_Report")]
private static extern UInt32 _Ffb_h_Eff_Report(IntPtr Packet, ref FFB_EFF_REPORT Effect);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_DevCtrl")]
private static extern UInt32 _Ffb_h_DevCtrl(IntPtr Packet, ref FFB_CTRL Control);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_EffOp")]
private static extern UInt32 _Ffb_h_EffOp(IntPtr Packet, ref FFB_EFF_OP Operation);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_DevGain")]
private static extern UInt32 _Ffb_h_DevGain(IntPtr Packet, ref Byte Gain);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_Eff_Cond")]
private static extern UInt32 _Ffb_h_Eff_Cond(IntPtr Packet, ref FFB_EFF_COND Condition);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_Eff_Envlp")]
private static extern UInt32 _Ffb_h_Eff_Envlp(IntPtr Packet, ref FFB_EFF_ENVLP Envelope);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_Eff_Period")]
private static extern UInt32 _Ffb_h_Eff_Period(IntPtr Packet, ref FFB_EFF_PERIOD Effect);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_EffNew")]
private static extern UInt32 _Ffb_h_EffNew(IntPtr Packet, ref FFBEType Effect);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_Eff_Ramp")]
private static extern UInt32 _Ffb_h_Eff_Ramp(IntPtr Packet, ref FFB_EFF_RAMP RampEffect);
[DllImport("vJoyInterface.dll", EntryPoint = "Ffb_h_Eff_Constant")]
private static extern UInt32 _Ffb_h_Eff_Constant(IntPtr Packet, ref FFB_EFF_CONSTANT ConstantEffect);
/***************************************************/
/********** Export functions (C#) ******************/
/***************************************************/
///// General driver data
public short GetvJoyVersion() { return _GetvJoyVersion(); }
public bool vJoyEnabled() { return _vJoyEnabled(); }
public string GetvJoyProductString() { return Marshal.PtrToStringAuto(_GetvJoyProductString()); }
public string GetvJoyManufacturerString() { return Marshal.PtrToStringAuto(_GetvJoyManufacturerString()); }
public string GetvJoySerialNumberString() { return Marshal.PtrToStringAuto(_GetvJoySerialNumberString()); }
public bool DriverMatch(ref UInt32 DllVer, ref UInt32 DrvVer) { return _DriverMatch(ref DllVer, ref DrvVer); }
///// vJoy Device properties
public int GetVJDButtonNumber(uint rID) { return _GetVJDButtonNumber(rID); }
public int GetVJDDiscPovNumber(uint rID) { return _GetVJDDiscPovNumber(rID); }
public int GetVJDContPovNumber(uint rID) { return _GetVJDContPovNumber(rID); }
public bool GetVJDAxisExist(UInt32 rID, HID_USAGES Axis)
{
UInt32 res = _GetVJDAxisExist(rID, (uint)Axis);
if (res == 1)
return true;
else
return false;
}
public bool GetVJDAxisMax(UInt32 rID, HID_USAGES Axis, ref long Max) { return _GetVJDAxisMax(rID, (uint)Axis, ref Max); }
public bool GetVJDAxisMin(UInt32 rID, HID_USAGES Axis, ref long Min) { return _GetVJDAxisMin(rID, (uint)Axis, ref Min); }
public bool isVJDExists(UInt32 rID) { return _isVJDExists(rID); }
public int GetOwnerPid(UInt32 rID) { return _GetOwnerPid(rID); }
///// Write access to vJoy Device - Basic
public bool AcquireVJD(UInt32 rID) { return _AcquireVJD(rID); }
public void RelinquishVJD(uint rID) { _RelinquishVJD(rID); }
public bool UpdateVJD(UInt32 rID, ref JoystickState pData) { return _UpdateVJD(rID, ref pData); }
public VjdStat GetVJDStatus(UInt32 rID) { return (VjdStat)_GetVJDStatus(rID); }
//// Reset functions
public bool ResetVJD(UInt32 rID) { return _ResetVJD(rID); }
public bool ResetAll() { return _ResetAll(); }
public bool ResetButtons(UInt32 rID) { return _ResetButtons(rID); }
public bool ResetPovs(UInt32 rID) { return _ResetPovs(rID); }
////// Write data
public bool SetAxis(Int32 Value, UInt32 rID, HID_USAGES Axis) { return _SetAxis(Value, rID, Axis); }
public bool SetBtn(bool Value, UInt32 rID, uint nBtn) { return _SetBtn(Value, rID, (Byte)nBtn); }
public bool SetDiscPov(Int32 Value, UInt32 rID, uint nPov) { return _SetDiscPov(Value, rID, nPov); }
public bool SetContPov(Int32 Value, UInt32 rID, uint nPov) { return _SetContPov(Value, rID, nPov); }
// Register CB function that takes a C# object as userdata
public void RegisterRemovalCB(RemovalCbFunc cb, object data)
{
// Free existing GCHandle (if exists)
if (hRemUserData.IsAllocated && hRemUserData.Target != null)
hRemUserData.Free();
// Convert object to pointer
hRemUserData = GCHandle.Alloc(data);
// Apply the user-defined CB function
UserRemCB = new RemovalCbFunc(cb);
wrf = new WrapRemovalCbFunc(WrapperRemCB);
_RegisterRemovalCB(wrf, (IntPtr)hRemUserData);
}
// Register CB function that takes a pointer as userdata
public void RegisterRemovalCB(WrapRemovalCbFunc cb, IntPtr data)
{
wrf = new WrapRemovalCbFunc(cb);
_RegisterRemovalCB(wrf, data);
}
/////////////////////////////////////////////////////////////////////////////////////////////
//// Force Feedback (FFB)
// Register CB function that takes a C# object as userdata
public void FfbRegisterGenCB(FfbCbFunc cb, object data)
{
// Free existing GCHandle (if exists)
if (hFfbUserData.IsAllocated && hFfbUserData.Target != null)
hFfbUserData.Free();
// Convert object to pointer
hFfbUserData = GCHandle.Alloc(data);
// Apply the user-defined CB function
UserFfbCB = new FfbCbFunc(cb);
wf = new WrapFfbCbFunc(WrapperFfbCB);
_FfbRegisterGenCB(wf, (IntPtr)hFfbUserData);
}
// Register CB function that takes a pointer as userdata
public void FfbRegisterGenCB(WrapFfbCbFunc cb, IntPtr data)
{
wf = new WrapFfbCbFunc(cb);
_FfbRegisterGenCB(wf, data);
}
[Obsolete("you can remove the function from your code")]
public bool FfbStart(UInt32 rID) { return _FfbStart(rID); }
[Obsolete("you can remove the function from your code")]
public bool FfbStop(UInt32 rID) { return _FfbStop(rID); }
public bool IsDeviceFfb(UInt32 rID) { return _IsDeviceFfb(rID); }
public bool IsDeviceFfbEffect(UInt32 rID, UInt32 Effect) { return _IsDeviceFfbEffect(rID, Effect); }
public UInt32 Ffb_h_DeviceID(IntPtr Packet, ref int DeviceID) { return _Ffb_h_DeviceID(Packet, ref DeviceID); }
public UInt32 Ffb_h_Type(IntPtr Packet, ref FFBPType Type) { return _Ffb_h_Type(Packet, ref Type); }
public UInt32 Ffb_h_Packet(IntPtr Packet, ref UInt32 Type, ref Int32 DataSize, ref Byte[] Data)
{
IntPtr buf = IntPtr.Zero;
UInt32 res = _Ffb_h_Packet(Packet, ref Type, ref DataSize, ref buf);
if (res != 0)
return res;
DataSize -= 8;
Data = new byte[DataSize];
Marshal.Copy(buf, Data, 0, DataSize);
return res;
}
public UInt32 Ffb_h_EBI(IntPtr Packet, ref Int32 Index) { return _Ffb_h_EBI(Packet, ref Index); }
[Obsolete("use Ffb_h_Eff_Report instead")]
public UInt32 Ffb_h_Eff_Const(IntPtr Packet, ref FFB_EFF_CONST Effect) { return _Ffb_h_Eff_Const(Packet, ref Effect); }
public UInt32 Ffb_h_Eff_Report(IntPtr Packet, ref FFB_EFF_REPORT Effect) { return _Ffb_h_Eff_Report(Packet, ref Effect); }
public UInt32 Ffb_h_DevCtrl(IntPtr Packet, ref FFB_CTRL Control) { return _Ffb_h_DevCtrl(Packet, ref Control); }
public UInt32 Ffb_h_EffOp(IntPtr Packet, ref FFB_EFF_OP Operation) { return _Ffb_h_EffOp(Packet, ref Operation); }
public UInt32 Ffb_h_DevGain(IntPtr Packet, ref Byte Gain) { return _Ffb_h_DevGain(Packet, ref Gain); }
public UInt32 Ffb_h_Eff_Cond(IntPtr Packet, ref FFB_EFF_COND Condition) { return _Ffb_h_Eff_Cond(Packet, ref Condition); }
public UInt32 Ffb_h_Eff_Envlp(IntPtr Packet, ref FFB_EFF_ENVLP Envelope) { return _Ffb_h_Eff_Envlp(Packet, ref Envelope); }
public UInt32 Ffb_h_Eff_Period(IntPtr Packet, ref FFB_EFF_PERIOD Effect) { return _Ffb_h_Eff_Period(Packet, ref Effect); }
public UInt32 Ffb_h_EffNew(IntPtr Packet, ref FFBEType Effect) { return _Ffb_h_EffNew(Packet, ref Effect); }
public UInt32 Ffb_h_Eff_Ramp(IntPtr Packet, ref FFB_EFF_RAMP RampEffect) { return _Ffb_h_Eff_Ramp(Packet, ref RampEffect); }
public UInt32 Ffb_h_Eff_Constant(IntPtr Packet, ref FFB_EFF_CONSTANT ConstantEffect) { return _Ffb_h_Eff_Constant(Packet, ref ConstantEffect); }
}
//}
public class vJoyFeeder
{
private static readonly object vJoyLocker = new object();
static bool vJoyInitialized = false;
static bool vJoyAvailable = false;
static VJoy vJoyObj = null;
vJoyFeeder()
{
// Do nothing
}
~vJoyFeeder()
{
// Do nothing
}
public static void InitializeVJoyDevice(uint vJoyID, HID_USAGES axis)
{
lock (vJoyLocker)
{
if (vJoyInitialized) return;
vJoyInitialized = true;
AppLogger.LogToGui("Initializing VJoy virtual joystick driver via vJoyInterface.dll interface", false);
try
{
if (vJoyObj == null) vJoyObj = new VJoy();
if (vJoyObj.vJoyEnabled() && vJoyObj.GetVJDAxisExist(vJoyID, axis))
{
AppLogger.LogToGui("Connection to VJoy virtual joystick established", false);
AppLogger.LogToGui($"VJoy driver. Vendor={vJoyObj.GetvJoyManufacturerString()} Product={vJoyObj.GetvJoyProductString()} Version={vJoyObj.GetvJoySerialNumberString()} Device#={vJoyID} Axis={axis}", false);
// Test if DLL matches the driver
UInt32 DllVer = 0, DrvVer = 0;
if (!vJoyObj.DriverMatch(ref DllVer, ref DrvVer))
AppLogger.LogToGui("WARNING. VJoy version of Driver {DrvVer}) does not match interface DLL Version {DllVer}. This may lead to unexpected problems or crashes. Update VJoy driver and vJoyInterface.dll", false);
VjdStat status = vJoyObj.GetVJDStatus(vJoyID);
if ((status == VjdStat.VJD_STAT_OWN) || ((status == VjdStat.VJD_STAT_FREE) && (!vJoyObj.AcquireVJD(vJoyID))))
{
vJoyAvailable = false;
AppLogger.LogToGui("ERROR. Failed to acquire vJoy device# {vJoyID}. Use another VJoy device or make sure there are no other VJoy feeder apps using the same device", false);
}
else
{
//vJoyObj.GetVJDAxisMax(vJoyID, axis, ref vJoyAxisMaxValue);
//AppLogger.LogToGui($"VJoy axis {axis} max value={vJoyAxisMaxValue}", false);
vJoyObj.ResetVJD(vJoyID);
vJoyAvailable = true;
}
}
else
{
vJoyAvailable = false;
AppLogger.LogToGui($"ERROR. VJoy device# {vJoyID} or {axis} axis not available. Check vJoy driver installation and configuration", false);
}
}
catch
{
vJoyAvailable = false;
AppLogger.LogToGui("ERROR. vJoy initialization failed. Make sure that DS4Windows application can find vJoyInterface.dll library file", false);
}
}
}
// Feed axis value to VJoy virtual joystic driver (DS4Windows sixaxis (SA) motion sensor steering wheel emulation feature can optionally feed VJoy analog axis instead of ScpVBus x360 axis
public static void FeedAxisValue(int value, uint vJoyID, HID_USAGES axis)
{
if (vJoyAvailable)
{
vJoyObj.SetAxis(value, vJoyID, axis);
}
else if (!vJoyInitialized)
{
// If this was the first call to this FeedAxisValue function and VJoy driver connection is not yet initialized
// then try to do it now. Subsequent calls will see the the vJoy as available (if connection succeeded) and
// there is no need to re-initialize the connection everytime the feeder is used.
InitializeVJoyDevice(vJoyID, axis);
}
}
}
}