Search Unity

Resolved (New Input System) Custom Input Device- Analog reading as 0-1:0-1 for -1:1

Discussion in 'Input System' started by robinlloydmiller, May 26, 2021.

  1. robinlloydmiller

    robinlloydmiller

    Joined:
    Oct 24, 2019
    Posts:
    9
    Hi Unity folks!

    TLDR: Unity input system is reading analog axis incorrectly (differently than how they're viewed in Windows controller profile), and it's seemingly arbitrary to map the axis to the input controls.

    I've been tryna wrap my head around this one- it's definitely due to me being a novice in specific areas here.
    https://gyazo.com/9f3daad779802cb6ee3fbd4c48702ea6
    to start: I'm creating an arcade with some custom joysticks: it's 4 joysticks, 8 buttons in total. I have an Arduino that' I've programmed (with some help!) that works in window's Joystick viewer. (there is an 8th analog axis that works, but windows doesnt show it by default):
    https://gyazo.com/a41597ffed111a514827d64999a7a43f

    The Issue:
    Unity's editor doesn't read the values on a normal linear scale. left and right (and every axis) both go from -1 to 1 (even tho there is a clamp processor) and due to that it seems like the x value is one-minus'ed, as it will go from -1 to 1 in the left handed range, and then reset at where 0 should be, to -1 to 1.
    explanation.png
    https://gyazo.com/ac1b493ee818fb2c682bdaa9344e04be
    Shown here is me moving a single axis from 0, to left, to 0, to right, to zero. You'll notice that at 0, it switches from 0 to 1 rapidly.
    at this point, it may also be appropriate to note that i haven't been able to consistently map the axis to controls yet.

    Here is the code i've added for the custom device- Please excuse the formatting as i was moving things around to see if anything specifically would stick. Even using Field Offset and providing different values, I couldn't map the controls correctly. Am I missing something?
    Code (CSharp):
    1. using System.Linq;
    2. using System.Runtime.InteropServices;
    3. using UnityEngine;
    4. using UnityEngine.InputSystem;
    5. using UnityEngine.InputSystem.Controls;
    6. using UnityEngine.InputSystem.Layouts;
    7. using UnityEngine.InputSystem.LowLevel;
    8. using UnityEngine.InputSystem.Utilities;
    9. #if UNITY_EDITOR
    10. using UnityEditor;
    11. #endif
    12.  
    13. [StructLayout(LayoutKind.Explicit, Size = 32)]
    14. public struct CustomDeviceState : IInputStateTypeInfo
    15. {
    16.     public FourCC format => new FourCC('H', 'I', 'D');
    17.  
    18.     //[FieldOffset(0)] public byte reportId;
    19.  
    20.      
    21.     [InputControl(name = "LeftDash", layout = "Button", bit = 0, displayName = "Left Dash")]
    22.     [InputControl(name = "LeftTrigger", layout = "Button", bit = 1, displayName = "Left Trigger")]
    23.     [InputControl(name = "RightDash", layout = "Button", bit = 2, displayName = "Right Dash")]
    24.     [InputControl(name = "RightTrigger", layout = "Button", bit = 3, displayName = "Right Trigger")]
    25.     [InputControl(name = "EnterCoin", layout = "Button", bit = 4, displayName = "Enter Coin")]
    26.     [InputControl(name = "StartButton", layout = "Button", bit = 5, displayName = "Start Button")]
    27.     [InputControl(name = "Settings", layout = "Button", bit = 6, displayName = "Settings")]
    28.     [InputControl(name = "Option", layout = "Button", bit = 7, displayName = "Option")]
    29.     [FieldOffset(0)]  public ushort buttons;
    30.  
    31.     [InputControl(name = "LeftLowerStick", format = "VC2B", layout = "Stick", displayName = "Left Lower Stick")]
    32.     [InputControl(name = "LeftLowerStick/x", offset = 0, layout = "Axis", format = "BYTE",
    33.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.5")]
    34.  
    35.     [InputControl(name = "LeftLowerStick/left",    offset = 0,
    36.         parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp,clampMin=0,clampMax=0.5,invert")]
    37.     [InputControl(name = "LeftLowerStick/right",   offset = 0,
    38.         parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp,clampMin=0.5,clampMax=1")]
    39.  
    40.     [InputControl(name = "LeftLowerStick/y", offset = 1, layout = "Axis", format = "BYTE",
    41.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.5")]
    42.     [InputControl(name = "LeftLowerStick/up", offset = 1,
    43.         parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp,clampMin=0,clampMax=0.5,invert")]
    44.     [InputControl(name = "LeftLowerStick/down", offset = 1,
    45.         parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp,clampMin=0.5,clampMax=1,invert=false")]
    46.  
    47.     [FieldOffset(7)] public byte llx;
    48.     [FieldOffset(9)] public byte lly;
    49.     ///....................................................
    50.     // Left Upper
    51.     [InputControl(name = "LeftUpperStick", format = "VC2B", layout = "Stick", displayName = "Left Upper Stick")]
    52.     [InputControl(name = "LeftUpperStick/y", offset = 1, layout = "Axis", format = "BYTE",
    53.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0")]
    54.     [InputControl(name = "LeftUpperStick/up",   offset = 1,parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0,clampMax=1")]
    55.     [InputControl(name = "LeftUpperStick/down", offset = 1, parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=-1,clampMax=0,invert")]
    56.     [FieldOffset(3)] public byte luy;
    57.  
    58.     [InputControl(name = "LeftUpperStick/x", offset = 0, layout = "Axis", format = "BYTE",
    59.         parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5")]
    60.     [InputControl(name = "LeftUpperStick/left", offset = 0,parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=2,clampMin=-1,clampMax=0,invert")]
    61.     [InputControl(name = "LeftUpperStick/right", offset = 0, parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=2,clampMin=0,clampMax=1")]
    62.     [FieldOffset(4)] public byte lux;
    63.     ///....................................................
    64.     // Right Lower
    65.  
    66.     [InputControl(name = "RightLowerStick", format = "VC2B", layout = "Stick", displayName = "Right Lower Stick")]
    67.     [InputControl(name = "RightLowerStick/x", layout = "Axis", defaultState = 127, format = "BYTE",
    68.         offset = 0,
    69.         parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5")]
    70.     [InputControl(name = "RightLowerStick/y", layout = "Axis", defaultState = 127, format = "BYTE",
    71.         offset = 1,
    72.         parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5")]
    73.     [InputControl(name = "RightLowerStick/up", parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=2,clampMin=0,clampMax=1")]
    74.     [InputControl(name = "RightLowerStick/down", parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=2,clampMin=-1,clampMax=0,invert")]
    75.     [InputControl(name = "RightLowerStick/left", parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=2,clampMin=-1,clampMax=0,invert")]
    76.     [InputControl(name = "RightLowerStick/right", parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=2,clampMin=0,clampMax=1")]
    77.     [FieldOffset(11)] public byte rlx;
    78.     [FieldOffset(12)] public byte rly;
    79.     ///...................................................
    80.     // Right Upper
    81.     [InputControl(name = "RightUpperStick", format = "VC2B", layout = "Stick", displayName = "Right Upper Stick")]
    82.     [InputControl(name = "RightUpperStick/x", layout = "Axis", defaultState = 127, format = "BYTE",
    83.         offset = 0,
    84.         parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5")]
    85.     [InputControl(name = "RightUpperStick/y", layout = "Axis", defaultState = 127, format = "BYTE",
    86.         offset = 1,
    87.         parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5")]
    88.     [InputControl(name = "RightUpperStick/up",   offset = 1, parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=2,clampMin=0,clampMax=1")]
    89.     [InputControl(name = "RightUpperStick/down", offset = 1, parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=2,clampMin=-1,clampMax=0,invert")]
    90.     [InputControl(name = "RightUpperStick/left" ,  parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=2,clampMin=-1,clampMax=0,invert")]
    91.     [InputControl(name = "RightUpperStick/right",  parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=2,clampMin=0,clampMax=1")]
    92.     [FieldOffset(11)] public byte rux;
    93.     [FieldOffset(12)] public byte ruy;
    94. }
    95.  
    96. [InputControlLayout(stateType = typeof(CustomDeviceState))]
    97. #if UNITY_EDITOR
    98. [InitializeOnLoad]
    99. #endif
    100. public class CustomDevice : InputDevice
    101. {
    102.     static CustomDevice()
    103.     {
    104.         Initialize();
    105.     }
    106.  
    107.     private static void Initialize()
    108.     {
    109.         InputSystem.RegisterLayout<CustomDevice>(
    110.           matches: new InputDeviceMatcher()
    111.               .WithInterface("HID")
    112.               .WithCapability("vendorId", 0x2341)      // Surreality games ;)
    113.               .WithCapability("productId", 0x8036)); // Vestigial Arcade Custom Device
    114.     }
    115.  
    116.     public ButtonControl leftTrigger    { get; private set; }
    117.     public ButtonControl leftDash       { get; private set; }
    118.     public ButtonControl rightTrigger   { get; private set; }
    119.     public ButtonControl rightDash      { get; private set; }
    120.  
    121.     public ButtonControl entercoin { get; private set; }
    122.     public ButtonControl start { get; private set; }
    123.     public ButtonControl settings { get; private set; }
    124.     public ButtonControl option { get; private set; }
    125.  
    126.     public StickControl leftLowerStick  { get; private set; }
    127.     public StickControl leftUpperstick  { get; private set; }
    128.     public StickControl rightLowerstick { get; private set; }
    129.     public StickControl rightUpperstick { get; private set; }
    130.  
    131.     protected override void FinishSetup ()
    132.     {
    133.         leftTrigger = GetChildControl<ButtonControl>("LeftTrigger");
    134.         leftDash = GetChildControl<ButtonControl>("LeftDash");
    135.         rightTrigger = GetChildControl<ButtonControl>("RightTrigger");
    136.         rightDash = GetChildControl<ButtonControl>("RightDash");
    137.  
    138.         entercoin = GetChildControl<ButtonControl>("EnterCoin");
    139.         start = GetChildControl<ButtonControl>("StartButton");
    140.         settings = GetChildControl<ButtonControl>("Settings");
    141.         option = GetChildControl<ButtonControl>("Option");
    142.  
    143.         leftLowerStick = GetChildControl<StickControl>("LeftLowerStick");
    144.         leftUpperstick = GetChildControl<StickControl>("LeftUpperStick");
    145.         rightLowerstick = GetChildControl<StickControl>("RightLowerStick");
    146.         rightUpperstick = GetChildControl<StickControl>("RightUpperStick");
    147.  
    148.         base.FinishSetup();
    149.     }
    150.  
    151.     [RuntimeInitializeOnLoadMethod]
    152.     private static void InitializeInPlayer() { }
    153. }
    154.  
    Please let me know if i'm being unclear! I'm really running my head against the wall trying to map this device to the descriptor-

    // Robin
     
    Last edited: May 27, 2021
    hyprThor likes this.
  2. robinlloydmiller

    robinlloydmiller

    Joined:
    Oct 24, 2019
    Posts:
    9
    Too Add to this: it seems like it ~almost~ works when I use the default (not custom)- most of those are working correctly.


    Except- Thrust and Throttle are still not showing up/being read, and the Stick is reading high values at neutral (like my overridden one was doing)-

    Alternative question- what would be the easiest way to modify what i'm looking at? Sort of lost attempting to create from JSON.

    // Robin
     
    hyprThor likes this.
  3. robinlloydmiller

    robinlloydmiller

    Joined:
    Oct 24, 2019
    Posts:
    9
    wanted to post an update since after a grueling week i seem to have fixed _something_.

    Code (CSharp):
    1.  
    2. using System.Linq;
    3. using System.Runtime.InteropServices;
    4. using UnityEngine;
    5. using UnityEngine.InputSystem;
    6. using UnityEngine.InputSystem.Controls;
    7. using UnityEngine.InputSystem.Layouts;
    8. using UnityEngine.InputSystem.LowLevel;
    9. using UnityEngine.InputSystem.Utilities;
    10. #if UNITY_EDITOR
    11. using UnityEditor;
    12. #endif
    13.  
    14. [StructLayout(LayoutKind.Explicit, Size = 32)]
    15. struct VestigialQuadStickHIDInputReport : IInputStateTypeInfo
    16. {
    17.     public FourCC format => new FourCC('H', 'I', 'D');
    18.    
    19.     [FieldOffset(0)] public byte reportId;
    20.    
    21.  
    22.     [InputControl(name = "trigger", layout = "Button", bit = 0, displayName = "Left Dash")]
    23.     [InputControl(name = "button2", layout = "Button", bit = 1, displayName = "Left Trigger")]
    24.     [InputControl(name = "button3", layout = "Button", bit = 2, displayName = "Right Dash")]
    25.     [InputControl(name = "button4", layout = "Button", bit = 3, displayName = "Right Trigger")]
    26.     [InputControl(name = "button5", layout = "Button", bit = 4, displayName = "Button 5")]
    27.     [InputControl(name = "button6", layout = "Button", bit = 5, displayName = "Button 6")]
    28.     [InputControl(name = "button7", layout = "Button", bit = 6, displayName = "Button 7")]
    29.     [InputControl(name = "button8", layout = "Button", bit = 7, displayName = "Button 8")]
    30.     [FieldOffset(1)] public byte buttons;
    31.  
    32.     // X & Y
    33.     [InputControl(name = "leftStick", layout = "Stick", format = "VEC2", sizeInBits = 32)]
    34.     [InputControl(name = "leftStick/x", offset = 0, format = "SHRT", sizeInBits = 16,
    35.          parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=1")]
    36.     [InputControl(name = "leftStick/left", offset = 0, format = "BYTE",
    37.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=0.0,invert")]
    38.     [InputControl(name = "leftStick/right", offset = 0, format = "BYTE",
    39.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=0.0,clampMax=1")]
    40.  
    41.     [InputControl(name = "leftStick/y", offset = 2, format = "SHRT", sizeInBits = 16,
    42.          parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=1")]
    43.     [InputControl(name = "leftStick/down", offset = 2, format = "BYTE",
    44.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=0,clampMax=1")]
    45.     [InputControl(name = "leftStick/up", offset = 2, format = "BYTE",
    46.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=0,invert")]
    47.     [FieldOffset(2)] public byte leftStickX;
    48.      [FieldOffset(4)] public byte leftStickY;
    49.  
    50.     // Z & RX
    51.     [InputControl(name = "leftLowerStick", layout = "Stick", format = "VEC2", sizeInBits = 32)]
    52.     [InputControl(name = "leftLowerStick/x", offset = 0, displayName = "Left Base X", format = "SHRT", sizeInBits = 16, processors = "AxisDeadzone(min=0.03,max=0.98)",  parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=1")]
    53.     [InputControl(name = "leftLowerStick/right", layout = "Button", offset = 0, format = "BYTE",
    54.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=0,clampMax=1")]
    55.     [InputControl(name = "leftLowerStick/left", layout = "Button", offset = 0, format = "BYTE",
    56.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=0,invert")]
    57.     [FieldOffset(6)] public byte leftLowerStickX;
    58.    
    59.     [InputControl(name = "leftLowerStick/y", offset = 2, displayName = "Left Base Y", format = "SHRT", sizeInBits = 16, processors = "AxisDeadzone(min=0.03,max=0.98)",  parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=1")]
    60.     [InputControl(name = "leftLowerStick/up",  offset = 2, format = "BYTE",
    61.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=0,clampMax=1")]
    62.     [InputControl(name = "leftLowerStick/down",  offset = 2, format = "BYTE",
    63.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=0,invert")]
    64.     [FieldOffset(8)] public byte leftLowerStickY;
    65.  
    66.     // ry & rz
    67.     [InputControl(name = "rightStick", layout = "Stick", format = "VEC2", sizeInBits = 32)]
    68.     [InputControl(name = "rightStick/x", offset = 0,  displayName = "Right Upper X", format = "SHRT", sizeInBits = 16, processors = "AxisDeadzone(min=0.04,max=0.97)",  parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=1")]
    69.     [InputControl(name = "rightStick/right", layout = "Button", offset = 0, format = "BYTE",
    70.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=0,clampMax=1")]
    71.     [InputControl(name = "rightStick/left", layout = "Button", offset = 0, format = "BYTE",
    72.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=0,invert")]
    73.     [FieldOffset(10)] public byte rightStickX;
    74.  
    75.     [InputControl(name = "rightStick/y",     offset = 2, displayName = "Right Upper Y",      format = "SHRT", processors = "AxisDeadzone(min=0.03,max=0.98)", sizeInBits = 16, parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=1")]
    76.     [InputControl(name = "rightStick/down", layout = "Button", offset = 2, format = "BYTE",
    77.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=0,clampMax=1")]
    78.     [InputControl(name = "rightStick/up", layout = "Button", offset = 2, format = "BYTE",
    79.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=0,invert")]
    80.     [FieldOffset(12)] public byte rightStickY;
    81.  
    82.     // Throttle and Thrust
    83.     [InputControl(name = "rightLowerStick", layout = "Stick", format = "VEC2", sizeInBits = 32)]
    84.  
    85.     [InputControl(name = "rightLowerStick/x", offset = 0, displayName = "Right Base X", format = "SHRT", processors = "AxisDeadzone(min=0.03,max=0.98)", sizeInBits = 16, parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=1")]
    86.     [InputControl(name = "rightLowerStick/right", layout = "Button", offset = 0, format = "BYTE",
    87.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=0,clampMax=1")]
    88.     [InputControl(name = "rightLowerStick/left", layout = "Button", offset = 0, format = "BYTE",
    89.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=0,invert")]
    90.     [FieldOffset(14)] public byte rightLowerStickX;
    91.  
    92.     [InputControl(name = "rightLowerStick/y", offset = 2, displayName = "Right Base Y",   format = "SHRT",  processors= "AxisDeadzone(min=0.03,max=0.98)",  sizeInBits = 16, parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=1")]
    93.     [InputControl(name = "rightLowerStick/up", layout = "Button", offset = 2, format = "BYTE",
    94.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=0,clampMax=1")]
    95.     [InputControl(name = "rightLowerStick/down", layout = "Button", offset = 2, format = "BYTE",
    96.         parameters = "normalize,normalizeMin=-1,normalizeMax=1,normalizeZero=0.0,clamp,clampMin=-1,clampMax=0,invert")]
    97.     [FieldOffset(16)] public byte rightLowerSticky;
    98.    
    99. }
    100.  
    101. [InputControlLayout(stateType = typeof(VestigialQuadStickHIDInputReport))]
    102. #if UNITY_EDITOR
    103. [InitializeOnLoad]
    104. #endif
    105. public class CustomDevice : InputDevice
    106. {
    107.     static CustomDevice()
    108.     {
    109.         Initialize();
    110.     }
    111.  
    112.     private static void Initialize()
    113.     {
    114.         InputSystem.RegisterLayout<CustomDevice>(
    115.           matches: new InputDeviceMatcher()
    116.               .WithInterface("HID")
    117.               .WithCapability("vendorId", 0x2341)      // Surreality games ;)
    118.               .WithCapability("productId", 0x8036)); // Vestigial Arcade Custom Device
    119.     }
    120.  
    121.     public ButtonControl leftTrigger    { get; private set; }
    122.     public ButtonControl leftDash       { get; private set; }
    123.     public ButtonControl rightTrigger   { get; private set; }
    124.     public ButtonControl rightDash      { get; private set; }
    125.  
    126.     public ButtonControl entercoin { get; private set; }
    127.     public ButtonControl start { get; private set; }
    128.     public ButtonControl settings { get; private set; }
    129.     public ButtonControl option { get; private set; }
    130.  
    131.     public StickControl leftUpperStick { get; private set; }
    132.     public StickControl leftLowerStick { get; private set; }
    133.     public StickControl rightUpperStick { get; private set; }
    134.     public StickControl rightLowerStick { get; private set; }
    135.  
    136.     protected override void FinishSetup ()
    137.     {
    138.         leftTrigger = GetChildControl<ButtonControl>("trigger");
    139.         leftDash = GetChildControl<ButtonControl>("button2");
    140.         rightTrigger = GetChildControl<ButtonControl>("button3");
    141.         rightDash = GetChildControl<ButtonControl>("button4");
    142.  
    143.         entercoin = GetChildControl<ButtonControl>("button5");
    144.         start = GetChildControl<ButtonControl>("button6");
    145.         settings = GetChildControl<ButtonControl>("button7");
    146.         option = GetChildControl<ButtonControl>("button8");
    147.  
    148.         //Axis
    149.         leftUpperStick = GetChildControl<StickControl>("leftStick");
    150.         leftLowerStick = GetChildControl<StickControl>("leftLowerStick");
    151.         rightUpperStick = GetChildControl<StickControl>("rightStick");
    152.         rightLowerStick = GetChildControl<StickControl>("rightLowerStick");
    153.  
    154.         base.FinishSetup();
    155.     }
    156.  
    157.     [RuntimeInitializeOnLoadMethod]
    158.     private static void InitializeInPlayer() { }
    159. }
    160.  
    I basically worked my way backwards- started with the HID Override code for the PS4, and just modified it until i got the original HID for the default layout. once i was able to match the default layout, i added thrust and rudder, and then converted those into use as joysticks. It seems like a lot of my problems were due to it being 16 bit values, and thus an offset of 1 was not enough- i had to offset each by 2 (ergo, 0 and 2 for each control respectively).

    Hope this helps anyone who might be trying to do a custom HID override.
     
    hyprThor likes this.