Skip to content

Instantly share code, notes, and snippets.

@Ryochan7
Created February 11, 2019 17:35
Show Gist options
  • Save Ryochan7/2b29455bac7c38f38d0341a8f805e0c2 to your computer and use it in GitHub Desktop.
Save Ryochan7/2b29455bac7c38f38d0341a8f805e0c2 to your computer and use it in GitHub Desktop.
Proposed changes to DS4Windows 360 steering that change performance
diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs
index 7af90bd..cd82824 100644
--- a/DS4Windows/DS4Control/Mapping.cs
+++ b/DS4Windows/DS4Control/Mapping.cs
@@ -1579,11 +1579,16 @@ namespace DS4Windows
if (macroControl[24]) MappedState.RY = 0;
}
- if (getSASteeringWheelEmulationAxis(device) != SASteeringWheelEmulationAxisType.None)
+ 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)
{
InputMethods.MoveCursorBy(mouseDeltaX, mouseDeltaY);
@@ -3999,7 +4004,7 @@ namespace DS4Windows
//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.
- switch(Global.getSASteeringWheelEmulationAxis(device))
+ switch(Global.GetSASteeringWheelEmulationAxis(device))
{
case SASteeringWheelEmulationAxisType.LX:
case SASteeringWheelEmulationAxisType.LY:
diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs
index 3e41280..bcea071 100644
--- a/DS4Windows/DS4Control/ScpUtil.cs
+++ b/DS4Windows/DS4Control/ScpUtil.cs
@@ -734,7 +734,7 @@ namespace DS4Windows
}
public static SASteeringWheelEmulationAxisType[] SASteeringWheelEmulationAxis => m_Config.sASteeringWheelEmulationAxis;
- public static SASteeringWheelEmulationAxisType getSASteeringWheelEmulationAxis(int index)
+ public static SASteeringWheelEmulationAxisType GetSASteeringWheelEmulationAxis(int index)
{
return m_Config.sASteeringWheelEmulationAxis[index];
}
diff --git a/DS4Windows/DS4Control/X360Device.cs b/DS4Windows/DS4Control/X360Device.cs
index a8244ee..5a5f87b 100644
--- a/DS4Windows/DS4Control/X360Device.cs
+++ b/DS4Windows/DS4Control/X360Device.cs
@@ -129,7 +129,7 @@ namespace DS4Windows
if (state.PS) Output[11] |= (Byte)(1 << 2); // Guide
- SASteeringWheelEmulationAxisType steeringWheelMappedAxis = Global.getSASteeringWheelEmulationAxis(device);
+ SASteeringWheelEmulationAxisType steeringWheelMappedAxis = Global.GetSASteeringWheelEmulationAxis(device);
Int32 ThumbLX;
Int32 ThumbLY;
Int32 ThumbRX;
@@ -140,6 +140,9 @@ namespace DS4Windows
switch(steeringWheelMappedAxis)
{
+ case SASteeringWheelEmulationAxisType.None:
+ goto default;
+
case SASteeringWheelEmulationAxisType.LX:
ThumbLX = state.SASteeringWheelEmulationUnit;
ThumbLY = Scale(state.LY, true);
diff --git a/DS4Windows/DS4Forms/Options.cs b/DS4Windows/DS4Forms/Options.cs
index 90e466b..4838985 100644
--- a/DS4Windows/DS4Forms/Options.cs
+++ b/DS4Windows/DS4Forms/Options.cs
@@ -720,7 +720,7 @@ namespace DS4Windows
triggerCondAndCombo.SelectedIndex = SATriggerCond[device] ? 0 : 1;
gyroMouseDzNUD.Value = GyroMouseDeadZone[device];
- cBSteeringWheelEmulationAxis.SelectedIndex = (int) getSASteeringWheelEmulationAxis(device);
+ cBSteeringWheelEmulationAxis.SelectedIndex = (int) GetSASteeringWheelEmulationAxis(device);
int idxSASteeringWheelEmulationRange = cBSteeringWheelEmulationRange.Items.IndexOf(getSASteeringWheelEmulationRange(device).ToString());
if (idxSASteeringWheelEmulationRange >= 0) cBSteeringWheelEmulationRange.SelectedIndex = idxSASteeringWheelEmulationRange;
diff --git a/DS4Windows/VJoyFeeder/vJoyFeeder.cs b/DS4Windows/VJoyFeeder/vJoyFeeder.cs
index 8304cbb..e7a4770 100644
--- a/DS4Windows/VJoyFeeder/vJoyFeeder.cs
+++ b/DS4Windows/VJoyFeeder/vJoyFeeder.cs
@@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
+using System.Security;
namespace DS4Windows.VJoyFeeder
{
@@ -105,6 +106,7 @@ namespace DS4Windows.VJoyFeeder
//namespace vJoyInterfaceWrap
//{
+ [SuppressUnmanagedCodeSecurity]
public class vJoy
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment