-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.InputSystem; | ||
using UnityEngine.InputSystem.Layouts; | ||
|
||
namespace YARG.Input { | ||
|
||
#if UNITY_EDITOR | ||
// Make sure static constructor is called during startup. | ||
[InitializeOnLoad] | ||
#endif | ||
|
||
[InputControlLayout(stateType = typeof(HIDProGuitarInputReport))] | ||
public class HIDProGuitarGampad : AbstractProGuitarGampad { | ||
static HIDProGuitarGampad() { | ||
// Wii Fender Mustang | ||
InputSystem.RegisterLayout<HIDProGuitarGampad>(matches: new InputDeviceMatcher() | ||
.WithInterface("HID") | ||
.WithCapability("vendorId", 0x1BAD) | ||
.WithCapability("productId", 0x3430)); | ||
|
||
// PS3 Fender Mustang | ||
InputSystem.RegisterLayout<HIDProGuitarGampad>(matches: new InputDeviceMatcher() | ||
.WithInterface("HID") | ||
.WithCapability("vendorId", 0x12BA) | ||
.WithCapability("productId", 0x2430)); | ||
} | ||
|
||
// Make sure the static constructor above is called during startup (runtime). | ||
[RuntimeInitializeOnLoadMethod] | ||
private static void Init() { | ||
|
||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.InputSystem; | ||
using UnityEngine.InputSystem.Layouts; | ||
|
||
namespace YARG.Input { | ||
|
||
#if UNITY_EDITOR | ||
// Make sure static constructor is called during startup. | ||
[InitializeOnLoad] | ||
#endif | ||
|
||
[InputControlLayout(stateType = typeof(XInpProGuitarInputReport))] | ||
public class XInpProGuitarGampad : AbstractProGuitarGampad { | ||
static XInpProGuitarGampad() { | ||
// Xbox Fender Mustang | ||
// NOTE: Should only works on Windows. XInput is handled differently on different platforms. | ||
InputSystem.RegisterLayout<XInpProGuitarGampad>(matches: new InputDeviceMatcher() | ||
.WithInterface("XInput") | ||
.WithCapability("subType", 25)); | ||
} | ||
|
||
// Make sure the static constructor above is called during startup (runtime). | ||
[RuntimeInitializeOnLoadMethod] | ||
private static void Init() { | ||
|
||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.Runtime.InteropServices; | ||
using UnityEngine.InputSystem.Layouts; | ||
using UnityEngine.InputSystem.LowLevel; | ||
using UnityEngine.InputSystem.Utilities; | ||
|
||
namespace YARG.Input { | ||
[StructLayout(LayoutKind.Explicit, Size = 27)] | ||
public struct XInpProGuitarInputReport : IInputStateTypeInfo { | ||
public FourCC format => new('X', 'I', 'N', 'P'); | ||
|
||
[InputControl(name = "fret0", format = "BIT", layout = "Integer", bit = 0, sizeInBits = 5)] | ||
[InputControl(name = "fret1", format = "BIT", layout = "Integer", bit = 5, sizeInBits = 5)] | ||
[InputControl(name = "fret2", format = "BIT", layout = "Integer", bit = 10, sizeInBits = 5)] | ||
[InputControl(name = "fret3", format = "BIT", layout = "Integer", bit = 16, sizeInBits = 5)] | ||
[InputControl(name = "fret4", format = "BIT", layout = "Integer", bit = 21, sizeInBits = 5)] | ||
[InputControl(name = "fret5", format = "BIT", layout = "Integer", bit = 26, sizeInBits = 5)] | ||
[FieldOffset(6)] | ||
public int fretStates; | ||
|
||
[InputControl(name = "string0", format = "BIT", layout = "Integer", bit = 0, sizeInBits = 7)] | ||
[FieldOffset(10)] | ||
public byte str0Velocity; | ||
[InputControl(name = "string1", format = "BIT", layout = "Integer", bit = 0, sizeInBits = 7)] | ||
[FieldOffset(11)] | ||
public byte str1Velocity; | ||
[InputControl(name = "string2", format = "BIT", layout = "Integer", bit = 0, sizeInBits = 7)] | ||
[FieldOffset(12)] | ||
public byte str2Velocity; | ||
[InputControl(name = "string3", format = "BIT", layout = "Integer", bit = 0, sizeInBits = 7)] | ||
[FieldOffset(13)] | ||
public byte str3Velocity; | ||
[InputControl(name = "string4", format = "BIT", layout = "Integer", bit = 0, sizeInBits = 7)] | ||
[FieldOffset(14)] | ||
public byte str4Velocity; | ||
[InputControl(name = "string5", format = "BIT", layout = "Integer", bit = 0, sizeInBits = 7)] | ||
[FieldOffset(15)] | ||
public byte str5Velocity; | ||
|
||
[FieldOffset(25)] | ||
public short reportId; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.