UI 자동화를 위해 바인딩 기능 구현
- 유니티 에셋 인증 오류로 meta 재생성
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
using UnityEngine.InputSystem.Layouts;
|
||||
|
||||
namespace UnityEngine.InputSystem.DualShock
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds support for PS4 DualShock controllers.
|
||||
/// </summary>
|
||||
#if UNITY_DISABLE_DEFAULT_INPUT_PLUGIN_INITIALIZATION
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
static class DualShockSupport
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
InputSystem.RegisterLayout<DualShockGamepad>();
|
||||
|
||||
// HID version for platforms where we pick up the controller as a raw HID.
|
||||
// This works without any PS4-specific drivers but does not support the full
|
||||
// range of capabilities of the controller (the HID format is undocumented
|
||||
// and only partially understood).
|
||||
//
|
||||
// NOTE: We match by PID and VID here as that is the most reliable way. The product
|
||||
// and manufacturer strings we get from APIs often return inconsistent results
|
||||
// or none at all. E.g. when connected via Bluetooth on OSX, the DualShock will
|
||||
// not return anything from IOHIDDevice_GetProduct() and IOHIDevice_GetManufacturer()
|
||||
// even though it will report the expected results when plugged in via USB.
|
||||
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_WSA || UNITY_EDITOR || UNITY_STANDALONE_LINUX
|
||||
InputSystem.RegisterLayout<DualSenseGamepadHID>(
|
||||
matches: new InputDeviceMatcher()
|
||||
.WithInterface("HID")
|
||||
.WithCapability("vendorId", 0x54C) // Sony Entertainment.
|
||||
.WithCapability("productId", 0xDF2)); // Dual Sense Edge
|
||||
InputSystem.RegisterLayout<DualSenseGamepadHID>(
|
||||
matches: new InputDeviceMatcher()
|
||||
.WithInterface("HID")
|
||||
.WithCapability("vendorId", 0x54C) // Sony Entertainment.
|
||||
.WithCapability("productId", 0xCE6)); // Dual Sense
|
||||
InputSystem.RegisterLayout<DualShock4GamepadHID>(
|
||||
matches: new InputDeviceMatcher()
|
||||
.WithInterface("HID")
|
||||
.WithCapability("vendorId", 0x54C) // Sony Entertainment.
|
||||
.WithCapability("productId", 0x9CC)); // Wireless controller.
|
||||
InputSystem.RegisterLayoutMatcher<DualShock4GamepadHID>(
|
||||
new InputDeviceMatcher()
|
||||
.WithInterface("HID")
|
||||
.WithCapability("vendorId", 0x54C) // Sony Entertainment.
|
||||
.WithCapability("productId", 0x5C4)); // Wireless controller.
|
||||
|
||||
// Just to make sure, also set up a matcher that goes by strings so that we cover
|
||||
// all bases.
|
||||
InputSystem.RegisterLayoutMatcher<DualShock4GamepadHID>(
|
||||
new InputDeviceMatcher()
|
||||
.WithInterface("HID")
|
||||
.WithManufacturerContains("Sony")
|
||||
.WithProduct("Wireless Controller"));
|
||||
|
||||
InputSystem.RegisterLayout<DualShock3GamepadHID>(
|
||||
matches: new InputDeviceMatcher()
|
||||
.WithInterface("HID")
|
||||
.WithCapability("vendorId", 0x54C) // Sony Entertainment.
|
||||
.WithCapability("productId", 0x268)); // PLAYSTATION(R)3 Controller.
|
||||
|
||||
InputSystem.RegisterLayoutMatcher<DualShock3GamepadHID>(
|
||||
new InputDeviceMatcher()
|
||||
.WithInterface("HID")
|
||||
.WithManufacturerContains("Sony")
|
||||
.WithProduct("PLAYSTATION(R)3 Controller", supportRegex: false));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user