mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-11 15:59:08 +01:00
Fine tuning vJoy output feeder
This commit is contained in:
parent
853b1ac650
commit
abadfb137b
@ -4128,27 +4128,28 @@ namespace DS4Windows
|
|||||||
|
|
||||||
result = Mapping.ClampInt(maxRangeLeft, result, maxRangeRight);
|
result = Mapping.ClampInt(maxRangeLeft, result, maxRangeRight);
|
||||||
|
|
||||||
|
// Debug log output of SA sensor values
|
||||||
//LogToGuiSACalibrationDebugMsg($"DEBUG gyro=({gyroAccelX}, {gyroAccelZ}) gyroPitchRollYaw=({currentDeviceState.Motion.gyroPitch}, {currentDeviceState.Motion.gyroRoll}, {currentDeviceState.Motion.gyroYaw}) gyroPitchRollYaw=({currentDeviceState.Motion.angVelPitch}, {currentDeviceState.Motion.angVelRoll}, {currentDeviceState.Motion.angVelYaw}) angle={result / (1.0 * C_WHEEL_ANGLE_PRECISION)} fullTurns={controller.wheelFullTurnCount}", false);
|
//LogToGuiSACalibrationDebugMsg($"DEBUG gyro=({gyroAccelX}, {gyroAccelZ}) gyroPitchRollYaw=({currentDeviceState.Motion.gyroPitch}, {currentDeviceState.Motion.gyroRoll}, {currentDeviceState.Motion.gyroYaw}) gyroPitchRollYaw=({currentDeviceState.Motion.angVelPitch}, {currentDeviceState.Motion.angVelRoll}, {currentDeviceState.Motion.angVelYaw}) angle={result / (1.0 * C_WHEEL_ANGLE_PRECISION)} fullTurns={controller.wheelFullTurnCount}", false);
|
||||||
|
|
||||||
// Scale input to a raw x360 16bit output scale, except if output axis of steering wheel emulation is L2+R2 trigger axis.
|
// Scale input to a raw x360 16bit output scale, except if output axis of steering wheel emulation is L2+R2 trigger axis.
|
||||||
// L2+R2 triggers use independent 8bit values, so use -255..0..+255 scaled values (therefore L2+R2 Trigger axis supports only 360 turn range)
|
|
||||||
switch(Global.getSASteeringWheelEmulationAxis(device))
|
switch(Global.getSASteeringWheelEmulationAxis(device))
|
||||||
{
|
{
|
||||||
case SASteeringWheelEmulationAxisType.LX:
|
case SASteeringWheelEmulationAxisType.LX:
|
||||||
case SASteeringWheelEmulationAxisType.LY:
|
case SASteeringWheelEmulationAxisType.LY:
|
||||||
case SASteeringWheelEmulationAxisType.RX:
|
case SASteeringWheelEmulationAxisType.RX:
|
||||||
case SASteeringWheelEmulationAxisType.RY:
|
case SASteeringWheelEmulationAxisType.RY:
|
||||||
// DS4 Stick axis values with configurable range
|
// DS4 thumbstick axis output (-32768..32767 raw value range)
|
||||||
return (((result - maxRangeLeft) * (32767 - (-32768))) / (maxRangeRight - maxRangeLeft)) + (-32768);
|
return (((result - maxRangeLeft) * (32767 - (-32768))) / (maxRangeRight - maxRangeLeft)) + (-32768);
|
||||||
|
|
||||||
case SASteeringWheelEmulationAxisType.L2R2:
|
case SASteeringWheelEmulationAxisType.L2R2:
|
||||||
// DS4 Trigger axis values with fixed 360 range
|
// 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)
|
||||||
result = Convert.ToInt32(Math.Round(result / (1.0 * C_WHEEL_ANGLE_PRECISION)));
|
result = Convert.ToInt32(Math.Round(result / (1.0 * C_WHEEL_ANGLE_PRECISION)));
|
||||||
if (result < 0) result = -181 - result;
|
if (result < 0) result = -181 - result;
|
||||||
return (((result - (-180)) * (255 - (-255))) / (180 - (-180))) + (-255);
|
return (((result - (-180)) * (255 - (-255))) / (180 - (-180))) + (-255);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// VJoy axis values with configurable range
|
// 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);
|
return (((result - maxRangeLeft) * (32767 - (-0))) / (maxRangeRight - maxRangeLeft)) + (-0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,6 +653,8 @@ namespace DS4Windows.VJoyFeeder
|
|||||||
vJoyInitialized = true;
|
vJoyInitialized = true;
|
||||||
AppLogger.LogToGui("Initializing VJoy virtual joystick driver via vJoyInterface.dll interface", false);
|
AppLogger.LogToGui("Initializing VJoy virtual joystick driver via vJoyInterface.dll interface", false);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (vJoyObj == null) vJoyObj = new vJoy();
|
if (vJoyObj == null) vJoyObj = new vJoy();
|
||||||
|
|
||||||
if (vJoyObj.vJoyEnabled() && vJoyObj.GetVJDAxisExist(vJoyID, axis))
|
if (vJoyObj.vJoyEnabled() && vJoyObj.GetVJDAxisExist(vJoyID, axis))
|
||||||
@ -685,6 +687,12 @@ namespace DS4Windows.VJoyFeeder
|
|||||||
AppLogger.LogToGui($"ERROR. VJoy device# {vJoyID} or {axis} axis not available. Check vJoy driver installation and configuration", 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
|
// 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user